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

Jenkins doesn't pass additional parameters to initial build after notifyCommit is requested

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins: v2.105
      GIT plugin: v4.0.0-beta2
      GIT client plugin: v3.0.0-beta3

      I am using Multibranch pipeline project driven by declarative Jenkinsfile.
      After new branch is pushed to the origin and new PR is created, Pull Request Notifier for Bitbucket plugin sends notifyCommit request like:

      https://***/git/notifyCommit?url=https://***/bitbucket/scm/jen/jenkins.git&sha1=28c31ee2da09e0e2852c126bc00ddab792ed08df&pullRequestId=25&branches=feature%2FISSUE-12&toBranch=develop&toHash=199317771629da73d0dd557c594fe46c10763958&mergeCommit=&fromHash=28c31ee2da09e0e2852c126bc00ddab792ed08df&action=OPENED&author=***&reviewers="
      

      Jenkins registers this call, creates new job based on the branch name, performs "First time build" but doesn't pass additional parammeters down to the build. Jenkins build output:

      Branch event
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh rev-parse --is-inside-work-tree # timeout=10
      Setting origin to https://***/bitbucket/scm/jen/jenkins.git
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config remote.origin.url https://***/bitbucket/scm/jen/jenkins.git # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh --version # timeout=10
      using GIT_ASKPASS to set credentials AD\jenkins
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
      Seen branch in repository origin/develop
      Seen branch in repository origin/feature/ISSUE-12
      Seen branch in repository origin/master
      Seen 3 remote branches
      Obtained Jenkinsfile from 28c31ee2da09e0e2852c126bc00ddab792ed08df
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] node
      Running on Jenkins in /srv/jenkins/workspace/ins-global_feature_ISSUE-12-DYLF54U2KDTIS7XTVZEE5ZFZWJG6M4VJGQQBHGGGSLYIAPZ5OYGQ
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Declarative: Checkout SCM)
      [Pipeline] checkout
      Cloning the remote Git repository
      Cloning with configured refspecs honoured and without tags
      Cloning repository https://***/bitbucket/scm/jen/jenkins.git
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh init /srv/jenkins/workspace/ins-global_feature_ISSUE-12-DYLF54U2KDTIS7XTVZEE5ZFZWJG6M4VJGQQBHGGGSLYIAPZ5OYGQ # timeout=10
      Fetching upstream changes from https://***/bitbucket/scm/jen/jenkins.git
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh --version # timeout=10
      using GIT_ASKPASS to set credentials AD\jenkins
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh fetch --no-tags --progress https://***/bitbucket/scm/jen/jenkins.git +refs/heads/*:refs/remotes/origin/*
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config remote.origin.url https://***/bitbucket/scm/jen/jenkins.git # timeout=10
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config remote.origin.url https://***/bitbucket/scm/jen/jenkins.git # timeout=10
      Fetching without tags
      Fetching upstream changes from https://***/bitbucket/scm/jen/jenkins.git
      using GIT_ASKPASS to set credentials AD\jenkins
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh fetch --no-tags --progress https://***/bitbucket/scm/jen/jenkins.git +refs/heads/*:refs/remotes/origin/*
      Checking out Revision 28c31ee2da09e0e2852c126bc00ddab792ed08df (feature/ISSUE-12)
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh config core.sparsecheckout # timeout=10
       > /opt/rh/rh-git29/root/usr/bin/git-launch.sh checkout -f 28c31ee2da09e0e2852c126bc00ddab792ed08df
      Commit message: "ISSUE-12 created new feature."
      First time build. Skipping changelog.
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Print parameters)
      [Pipeline] echo
      Jenkins parameters:
      [Pipeline] echo
      build number='1'
      [Pipeline] echo
      Parameters passed from Bitbucket:
      [Pipeline] echo
      pullRequestId=''
      [Pipeline] echo
      toBranch=''
      [Pipeline] echo
      toHash=''
      [Pipeline] echo
      mergeCommit=''
      [Pipeline] echo
      fromHash=''
      [Pipeline] echo
      action=''
      [Pipeline] echo
      author=''
      [Pipeline] echo
      reviewers=''
      [Pipeline] }
      

      So at this point I am not able to notify BitBucket about checkstyle violations, send emails, etc. because parameters like pullRequestId or author are empty.

      Next requests to notifyCommit endpoint end up with JENKINS-51875 issue.

      Thank you.

            Unassigned Unassigned
            ferda_mravenec Ferda Mravenec
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: