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

Git Publisher is not working after promotion of build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • git-plugin
    • None

      When i tried to add git publisher plugin after the promotion i'm not able to create tag, but if i add same plugin after the build it is working fine.

      Here is the error

      failed build hudson.plugins.git.GitPublisher@5bd458de SUCCESS
      Notifying upstream projects of job completion
      Finished: FAILURE

          [JENKINS-38578] Git Publisher is not working after promotion of build

          Mark Waite added a comment - - edited

          Please provide step by step instructions which will allow someone else to see the problem.

          When I say "step by step", I mean that you should describe how to duplicate the problem in such a way that someone (like me) who does not know what you mean by "after the promotion" can still reproduce the problem. One way to do that is to describe a numbered series of steps that can be followed. Another way is to provide a screencast, preferably with narration. Another way might be to create a docker image and share the definition of the docker image which shows the problem.

          Mark Waite added a comment - - edited Please provide step by step instructions which will allow someone else to see the problem. When I say "step by step", I mean that you should describe how to duplicate the problem in such a way that someone (like me) who does not know what you mean by "after the promotion" can still reproduce the problem. One way to do that is to describe a numbered series of steps that can be followed. Another way is to provide a screencast, preferably with narration. Another way might be to create a docker image and share the definition of the docker image which shows the problem.

          Maneesh Mehra added a comment - - edited

          I ran into this issue as well. Here are the steps to reproduce the problem:

          0. Install the Git plugin along with the Jenkins Promoted Builds plugin. In my case, I had the following versions installed:

          1. Create a freestyle Jenkins job.

          2. Configure the job and add a link to a git repository. In my case, I integrated my Jenkins environment against a Gitlab CE server and used that.

          3. Test connection to the Git remote repository to ensure connectivity and access.

          4. Check the "Promote builds when..." checkbox under "General" section.

          4.1 Give a descriptive name to the promotion.

          4.2 Add an action for "Git Publisher".

          4.3. Within the Git Publisher action, select the "Push Only If Build Succeeds" checkbox. Add the option to push a new tag to the repository by providing a tag token of the form:JENKINS_${BUILD_ID}, a tag message and the checkbox to "create new tag".

          5. Save the Jenkins build job.

          6. Run the job. Since we did not any build steps to the job, as long as Jenkins is able to clone the Git repo successfully, the job will be successful.

          7. On the job results page, click the "Promotion Status" link.

          8. Press the box which says "Force Promotion" or "Re-execute Promotion". The former will be available for a new job that has never been promoted or attempted to be promoted. The latter will be available for previously promoted/attempted to be promoted jobs.

          9. Notice that the promotion job will now run and its console will present something like the following as the error message:

          build hudson.tasks.Shell@61a99866 SUCCESS
          failed build hudson.plugins.git.GitPublisher@11fd2de1 SUCCESS
          Finished: FAILURE

          I debugged the Git plugin upto a certain point and noticed that that on line 179 of hudson.plugins.git.GitPublisher class (in version 3.0.3 of source code this was SCM scm = build.getProject().getScm() in the perform() method), scm's value was NullSCM. I am suspecting that since the promotion job is run separately from the main Jenkins job, Jenkins is not providing any knowledge of the SCM system (git) to the promotion job. I am not particularly familiar with how the promotion jobs run and so unable to tell why the SCM value was not set when the execution hits this portion of the code.

          I hope this helps debug the issue a bit more.

          Thanks,

          Maneesh

          Maneesh Mehra added a comment - - edited I ran into this issue as well. Here are the steps to reproduce the problem: 0. Install the Git plugin along with the Jenkins Promoted Builds plugin. In my case, I had the following versions installed: Git Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin ) v3.0.3 Promoted Builds Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin ) v2.28 1. Create a freestyle Jenkins job. 2. Configure the job and add a link to a git repository. In my case, I integrated my Jenkins environment against a Gitlab CE server and used that. 3. Test connection to the Git remote repository to ensure connectivity and access. 4. Check the "Promote builds when..." checkbox under "General" section. 4.1 Give a descriptive name to the promotion. 4.2 Add an action for "Git Publisher". 4.3. Within the Git Publisher action, select the "Push Only If Build Succeeds" checkbox. Add the option to push a new tag to the repository by providing a tag token of the form:JENKINS_${BUILD_ID}, a tag message and the checkbox to "create new tag". 5. Save the Jenkins build job. 6. Run the job. Since we did not any build steps to the job, as long as Jenkins is able to clone the Git repo successfully, the job will be successful. 7. On the job results page, click the "Promotion Status" link. 8. Press the box which says "Force Promotion" or "Re-execute Promotion". The former will be available for a new job that has never been promoted or attempted to be promoted. The latter will be available for previously promoted/attempted to be promoted jobs. 9. Notice that the promotion job will now run and its console will present something like the following as the error message: build hudson.tasks.Shell@61a99866 SUCCESS failed build hudson.plugins.git.GitPublisher@11fd2de1 SUCCESS Finished: FAILURE I debugged the Git plugin upto a certain point and noticed that that on line 179 of hudson.plugins.git.GitPublisher class (in version 3.0.3 of source code this was SCM scm = build.getProject().getScm() in the perform() method), scm's value was NullSCM. I am suspecting that since the promotion job is run separately from the main Jenkins job, Jenkins is not providing any knowledge of the SCM system (git) to the promotion job. I am not particularly familiar with how the promotion jobs run and so unable to tell why the SCM value was not set when the execution hits this portion of the code. I hope this helps debug the issue a bit more. Thanks, Maneesh

          Thomas Bender added a comment -

          I can confirm this exactly. Still unfixed.
          Please make the exception for project instances of PromotedBuildPlugin to get the SCM of the parent (promoted) project!

          Thomas Bender added a comment - I can confirm this exactly. Still unfixed. Please make the exception for project instances of PromotedBuildPlugin to get the SCM of the parent (promoted) project!

            Unassigned Unassigned
            dasarinikhilesh Nikhilesh Dasari
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: