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 ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func mapState(s string) string {
|
func mapState(s string) (state, description string) {
|
||||||
switch s {
|
switch s {
|
||||||
case "Running":
|
case "Running":
|
||||||
return "pending"
|
return "pending", "Pending - Job triggered."
|
||||||
case "PipelineRunCancelled":
|
case "PipelineRunCancelled":
|
||||||
return "error"
|
return "error", "Job cancelled."
|
||||||
case "Failed":
|
case "Failed":
|
||||||
return "failure"
|
return "failure", "Job failed."
|
||||||
case "Succeeded":
|
case "Succeeded":
|
||||||
return "success"
|
return "success", "Job succeeded."
|
||||||
}
|
}
|
||||||
return ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
type Status struct {
|
type Status struct {
|
||||||
|
|
@ -184,7 +184,7 @@ func statusUpdate(obj interface{}, s *StatusCache, sec typedcorev1.SecretInterfa
|
||||||
fin = (*f).Time
|
fin = (*f).Time
|
||||||
}
|
}
|
||||||
sha, url := getGit(pr)
|
sha, url := getGit(pr)
|
||||||
if sha == "" {
|
if sha == "" || sha == "master" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !s.Set(sha, status, start, fin) {
|
if !s.Set(sha, status, start, fin) {
|
||||||
|
|
@ -263,10 +263,15 @@ func postStatus(pr *PipelineRun, gitUrl, sha, status string, sec *corev1.Secret)
|
||||||
if tektonurl == "" {
|
if tektonurl == "" {
|
||||||
log.Printf("missing tektonurl parameter for %s/%s", pr.Namespace, pr.Name)
|
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{
|
s := &GitStatus{
|
||||||
Context: "tekton",
|
Context: pipeline,
|
||||||
Description: pr.Name,
|
Description: desc,
|
||||||
State: mapState(status),
|
State: state,
|
||||||
TargetURL: tektonurl,
|
TargetURL: tektonurl,
|
||||||
}
|
}
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
|
@ -401,7 +406,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sha, _ := getGit(pr)
|
sha, _ := getGit(pr)
|
||||||
if sha != "" {
|
if sha != "" && sha != "master" {
|
||||||
s.Remove(sha)
|
s.Remove(sha)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue