better description
This commit is contained in:
parent
1fcc37126d
commit
9ee2dc4d06
1 changed files with 16 additions and 11 deletions
27
main.go
27
main.go
|
|
@ -59,18 +59,18 @@ func mapGitAPI(s string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func mapState(s string) string {
|
||||
func mapState(s string) (state, description string) {
|
||||
switch s {
|
||||
case "Running":
|
||||
return "pending"
|
||||
return "pending", "Pending - Job triggered."
|
||||
case "PipelineRunCancelled":
|
||||
return "error"
|
||||
return "error", "Job cancelled."
|
||||
case "Failed":
|
||||
return "failure"
|
||||
return "failure", "Job failed."
|
||||
case "Succeeded":
|
||||
return "success"
|
||||
return "success", "Job succeeded."
|
||||
}
|
||||
return ""
|
||||
return "", ""
|
||||
}
|
||||
|
||||
type Status struct {
|
||||
|
|
@ -184,7 +184,7 @@ func statusUpdate(obj interface{}, s *StatusCache, sec typedcorev1.SecretInterfa
|
|||
fin = (*f).Time
|
||||
}
|
||||
sha, url := getGit(pr)
|
||||
if sha == "" {
|
||||
if sha == "" || sha == "master" {
|
||||
return
|
||||
}
|
||||
if !s.Set(sha, status, start, fin) {
|
||||
|
|
@ -263,10 +263,15 @@ func postStatus(pr *PipelineRun, gitUrl, sha, status string, sec *corev1.Secret)
|
|||
if tektonurl == "" {
|
||||
log.Printf("missing tektonurl parameter for %s/%s", pr.Namespace, pr.Name)
|
||||
}
|
||||
pipeline := "tekton"
|
||||
if pr.Spec.PipelineRef != nil {
|
||||
pipeline += "-" + pr.Spec.PipelineRef.Name
|
||||
}
|
||||
state, desc := mapState(status)
|
||||
s := &GitStatus{
|
||||
Context: "tekton",
|
||||
Description: pr.Name,
|
||||
State: mapState(status),
|
||||
Context: pipeline,
|
||||
Description: desc,
|
||||
State: state,
|
||||
TargetURL: tektonurl,
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
|
|
@ -401,7 +406,7 @@ func main() {
|
|||
return
|
||||
}
|
||||
sha, _ := getGit(pr)
|
||||
if sha != "" {
|
||||
if sha != "" && sha != "master" {
|
||||
s.Remove(sha)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue