Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60437

Manually setting git commit status sets it for two contexts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • github-api-plugin
    • None
    • Jenkins: 2.190.1
      Git plugin: 4.0.0

      I'm trying to create two different jobs, the build job and E2E tests job. 

      I'd like the two jobs to annotate the git commit with their results and the results not to get mixed up. 

      On  the build job, I didn't change any configuration and the git plugin does its magic in the background as expected. 

      In my E2E Jenkinsfile, I'm setting the git commit status manually as lots of guys on the internet suggest, with a method:

      void setBuildStatus (String message, JobResult jobResult, def repoName) {
        step([
          $class : "GitHubCommitStatusSetter",
            reposSource : [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/myOrg/myRepo"],
            contextSource : [$class: "ManuallyEnteredCommitContextSource", context: "E2E tests"],
            errorHandlers : [[$class: "ChangingBuildStatusErrorHandler", result: JobResult.UNSTABLE.name()]],
              statusResultSource: [$class: "ConditionalStatusResultSource", results:
                [[$class: "AnyBuildResult", message: message, state: jobResult.name()]]
          ]
        ])
      }
      

      Which is used at startup, in post > success and post > failure.

      When only the build job runs, the git commit is marked with continuous-integration/jenkins/branch, the details link points to my build job, this is as intended.

      When the E2E tests run though, the commit gets marked with E2E tests (good) but the continuous-integration/jenkins/branch ** gets overwritten by the result of the E2E tests job and that's not intended. Both details link now point to the E2E job.

      The details links both point to the E2E tests job which is unexpected.

      The logs from my E2E job: 

       

       [Set GitHub commit status (universal)] FAILURE on repos [GHRepository@431ca6e9[description=XXXXXXX,homepage=,name=tat-client,fork=false,archived=false,size=47243,milestones={},language=Java,commits={},source=<null>,parent=<null>,responseHeaderFields={null=[HTTP/1.1 200 OK], Access-Control-Allow-Origin=[*], Access-Control-Expose-Headers=[ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type], Cache-Control=[private, max-age=60, s-maxage=60], Content-Encoding=[gzip], Content-Security-Policy=[default-src 'none'], Content-Type=[application/json; charset=utf-8], Date=[Wed, 11 Dec 2019 09:35:58 GMT], ETag=[W/"fd8af705e8350025323a01b7c75547f8"], Last-Modified=[Fri, 06 Dec 2019 10:37:49 GMT], OkHttp-Received-Millis=[1576056958700], OkHttp-Response-Source=[CONDITIONAL_CACHE 200], OkHttp-Selected-Protocol=[http/1.1], OkHttp-Sent-Millis=[1576056958550], Referrer-Policy=[origin-when-cross-origin, strict-origin-when-cross-origin], Server=[GitHub.com], Status=[200 OK], Strict-Transport-Security=[max-age=31536000; includeSubdomains; preload], Transfer-Encoding=[chunked], Vary=[Accept, Authorization, Cookie, X-GitHub-OTP], X-Accepted-OAuth-Scopes=[repo], X-Content-Type-Options=[nosniff], X-Frame-Options=[deny], X-GitHub-Media-Type=[github.v3; format=json], X-GitHub-Request-Id=[E2E6:3173:1490F4B:3584BD1:5DF0B87E], X-OAuth-Scopes=[admin:repo_hook, read:discussion, read:org, repo], X-RateLimit-Limit=[5000], X-RateLimit-Remaining=[4996], X-RateLimit-Reset=[1576060432], X-XSS-Protection=[1; mode=block]},url=[https://api.github.com/repos/myOrg/myRepo,id=126450515|https://api.github.com/repos/myOrg/myRepo,id=126450515]]] (sha:9a0d406) with context:E2E tests
       Setting commit status on GitHub for [https://github.com/myOrg/myRepo/commit/9a0d40654fdc3c51d008ef5d226c7e976f960bbb|https://github.com/myOrg/myRepo/commit/9a0d40654fdc3c51d008ef5d226c7e976f960bbb]
      

      It looks like the automatic commit status setter is triggered and I don't know nor can find how to deactivate it. 

            Unassigned Unassigned
            quilicicf Cyprien Quilici
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: