Skip to content

Commit

Permalink
[breaking] Namespace GitHub results with job spec name
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed Jun 11, 2021
1 parent 3fa6678 commit 43a8bba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/github-integration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
)

var (
werftGithubContext = "continuous-integration/werft"
werftResultGithubContext = "continuous-integration/werft/result"
werftGithubContextPrefix = "ci/werft"
werftResultChannelPrefix = "github-check-"

// annotationStatusUpdate is set on jobs whoose status needs to be updated on GitHub.
Expand Down Expand Up @@ -141,10 +140,11 @@ func (p *githubTriggerPlugin) updateGitHubStatus(job *v1.JobStatus) error {
}
}
url := fmt.Sprintf("%s/job/%s", p.Config.BaseURL, job.Name)
jobGHctx := werftGithubContextPrefix + "/" + job.Metadata.JobSpecName
ghstatus := &github.RepoStatus{
State: &state,
Description: &desc,
Context: &werftGithubContext,
Context: &jobGHctx,
TargetURL: &url,
}

Expand Down Expand Up @@ -176,13 +176,13 @@ func (p *githubTriggerPlugin) updateGitHubStatus(job *v1.JobStatus) error {
for _, c := range r.Channels {
if c == "github" {
ok = true
ghctx = fmt.Sprintf("%s-%03d", werftResultGithubContext, idx)
ghctx = fmt.Sprintf("%s/results/%03d", jobGHctx, idx)
idx++
break
}
if strings.HasPrefix(c, werftResultChannelPrefix) {
ok = true
ghctx = fmt.Sprintf("%s-%s", werftResultGithubContext, strings.TrimPrefix(c, werftResultChannelPrefix))
ghctx = fmt.Sprintf("%s/results/%s", jobGHctx, strings.TrimPrefix(c, werftResultChannelPrefix))
break
}
}
Expand Down

0 comments on commit 43a8bba

Please sign in to comment.