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

bitbucketStatusNotify ignores commitId parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None

      bitbucket-build-status-notifier appears to pick up the wrong commit ID when executed from a shared pipeline library (fetched from SCM) even though I explicitly specify the commitId as a parameter.

      In my library, I have this code:

      def commitId = script.env.GIT_COMMIT
      echo "notify: using commitId=${commitId}"
      bitbucketStatusNotify(
          buildState: buildState,
          buildKey: 'build',
          buildName: "Building, testing and deploying",
          repoSlug: script.env.BITBUCKET_REPO,
          commitId: commitId
      ) 

      When executing this build, the log shows:

      notify: using commitId=7a1e07dfb6199e4ea6b28bab7f540628f0be3348
      [Pipeline] bitbucketStatusNotify
      Sending build status INPROGRESS for commit f8d74b54b87d08657d4a98858df70ab1e0d1c025 to BitBucket is done!
      Sending build status INPROGRESS for commit f8d74b54b87d08657d4a98858df70ab1e0d1c025 to BitBucket is done!

      The commitId that the plugin is using (f8d74b54b87) references the shared-library repository, not the code being built. The script environment of the library (unfortunately) doesn't have the appropriate value for env.GIT_COMMIT which is why I specify it explicitly, but it appears that the plugin is ignoring the parameter and using the environment anyway.

      I've tried looking through the plugin code and can't find any place where it would actually pick up the commitId parameter. But there might be some implicit magic that's supposed to happen that I'm missing since I'm not a plugin developer myself.

      At this point I'm not seeing any way to call bitbucketStatusNotify from a shared library in a manner that works as expected.

            flagbit Antonio Mansilla
            tias Mattias
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: