updated readme
This commit is contained in:
parent
be3c522f14
commit
32eaa11037
2 changed files with 17 additions and 19 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# status-reporter
|
||||
|
||||
The status reporter is a controller that watches pipelineruns for status cahnges.
|
||||
The status reporter is a controller that watches tekton `PipelineRuns` for status cahnges.
|
||||
These are synced to the associated git commit hashes.
|
||||
|
||||
For successful runs a preview environment comment will be added to the pull request.
|
||||
|
|
@ -13,11 +13,11 @@ Params:
|
|||
* issue - pull request issue id
|
||||
* scheme - `http://` or `https://`
|
||||
* tektonurl - `http://tekton-dashboard.example.com`
|
||||
* previewurl - url to your deployed preview environment
|
||||
* previewurl - `my-preview-env.example.com`
|
||||
|
||||
Resources:
|
||||
|
||||
* git - revision: githash, url: clone_url
|
||||
* git - revision: git commit hash, url: `https://github.com/example/repo.git`
|
||||
|
||||
# Requirements
|
||||
|
||||
|
|
|
|||
30
main.go
30
main.go
|
|
@ -21,12 +21,11 @@ import (
|
|||
pipelinev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
|
||||
"github.com/tektoncd/pipeline/pkg/client/clientset/versioned"
|
||||
extinf "github.com/tektoncd/pipeline/pkg/client/informers/externalversions"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
//"k8s.io/apimachinery/pkg/types"
|
||||
//"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
|
@ -88,7 +87,7 @@ func NewStatusCache() *StatusCache {
|
|||
return &StatusCache{cache: make(map[string]Status)}
|
||||
}
|
||||
|
||||
func (sc *StatusCache) Set(sha, status string, st, fin time.Time) bool {
|
||||
func (sc *StatusCache) Set(sha, status string, st, fin time.Time) (ret bool) {
|
||||
sc.Lock()
|
||||
defer sc.Unlock()
|
||||
s, ok := sc.cache[sha]
|
||||
|
|
@ -102,26 +101,25 @@ func (sc *StatusCache) Set(sha, status string, st, fin time.Time) bool {
|
|||
return true
|
||||
}
|
||||
if fin.After(s.Date) {
|
||||
log.Printf("updating status in cache: %s %s", sha, status)
|
||||
sc.cache[sha] = Status{status, fin}
|
||||
return true
|
||||
ret = true
|
||||
}
|
||||
if st.After(s.Date) {
|
||||
log.Printf("updating status in cache: %s %s", sha, status)
|
||||
if !ret && st.After(s.Date) {
|
||||
sc.cache[sha] = Status{status, st}
|
||||
return true
|
||||
ret = true
|
||||
}
|
||||
if fin.Equal(s.Date) && s.Type != status {
|
||||
log.Printf("updating status in cache: %s %s", sha, status)
|
||||
if !ret && fin.Equal(s.Date) && s.Type != status {
|
||||
sc.cache[sha] = Status{status, fin}
|
||||
return true
|
||||
ret = true
|
||||
}
|
||||
if st.Equal(s.Date) && s.Type != status {
|
||||
log.Printf("updating status in cache: %s %s", sha, status)
|
||||
if !ret && st.Equal(s.Date) && s.Type != status {
|
||||
sc.cache[sha] = Status{status, st}
|
||||
return true
|
||||
ret = true
|
||||
}
|
||||
return false
|
||||
if ret {
|
||||
log.Printf("updating status in cache: %s %s", sha, status)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (sc *StatusCache) Remove(sha string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue