I'm running Jenkins ver. 2.73.3, master with multiple Linux slaves,
      postbuildscript-plugin version 0.17.

      I'm using postbuildscript plugin to tag my GitHub repo when the build successful completes:

      git tag -a -f -m "release on $(date)" ${BUILD_NUMBER}
      git push GithubRepo ${BUILD_NUMBER}
      

      Attaching screenshot of the working conf.

      After updating to 2.5.0 the tagging script isn't working, tried changing the Execute script on Master I get:

      [ssh-agent] Stopped.
       [PostBuildScript] - Executing post build scripts.
       [PostBuildScript] - Node does not have the role MASTER. Did not execute build step #0.
      Sending e-mails to: dev@mycompany.com
      Finished: SUCCESS
      

      Tried to have the execution on the Slave I get the following error:

      [ssh-agent] Stopped.
       [PostBuildScript] - Executing post build scripts.
       [builder-backend-j8] $ /bin/bash /tmp/jenkins4390017699665485219.sh
      git tag -a -f -m 'release on Wed Feb 14 23:57:34 UTC 2018' 754
      git push FGithubRepo 754
      Permission denied (publickey).
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      and the repository exists.
      Build step 'Execute Scripts' changed build result to FAILURE
      Build step 'Execute Scripts' marked build as failure
      Sending e-mails to: dev@mycompany.com
      Finished: FAILURE
      

      In this case, I believe the error exists because the ssh-agent isn't present at this step on the slave.

      Using version 0.17, using MATRIX config I get the Github repo properly tagged:

      > git rev-list --no-walk 4e8177475488332a275d42a84329404ae4db8c18 # timeout=10
      Triggering app » builder
      app » builder completed with result SUCCESS
       [PostBuildScript] - Execution post build scripts.
       [workspace] $ /bin/bash /tmp/jenkins2029997385938416345.sh
      git tag -a -f -m 'release on Thu Feb 15 00:39:55 UTC 2018' 762
      git push GithubRepo 762
      To github.com:comapany/app.git
       * [new tag] 762 -> 762
      Finished: SUCCESS
      

      This works (i believe) because the script runs on master, and the Github credentials are available.

      How can I tag the master node in a way to fix this:

      [PostBuildScript] - Node does not have the role MASTER. Did not execute build step #0.
      

      I already tried to add a tag in the node config but it didn't work.

        1. img1.png
          img1.png
          56 kB
        2. JENKINS-495585-output.png
          JENKINS-495585-output.png
          61 kB
        3. JENKINS-49585.png
          JENKINS-49585.png
          57 kB

          [JENKINS-49585] [Question] Assign MASTER role

          Daniel Heid added a comment -

          Hi Luigi,

          I tried to reproduce the problem by adding a job with the following settings:

          It runs the bash script:

          Sorry, but I need more information. Could you please post the config.xml file or parts of it? Just go to

          http://your-jenkins-host:8080/jenkins/job/the-job-name/config.xml

          and upload it here. Thanks!

          Daniel Heid added a comment - Hi Luigi, I tried to reproduce the problem by adding a job with the following settings: It runs the bash script: Sorry, but I need more information. Could you please post the config.xml file or parts of it? Just go to http://your-jenkins-host:8080/jenkins/job/the-job-name/config.xml and upload it here. Thanks!

          dheid thank you for the quick reply, this is my config:

          <?xml version='1.0' encoding='UTF-8'?>
          <matrix-project plugin="matrix-project@1.12">
            <actions/>
            <description></description>
            <keepDependencies>false</keepDependencies>
            <properties>
              <jenkins.model.BuildDiscarderProperty>
                <strategy class="hudson.tasks.LogRotator">
                  <daysToKeep>-1</daysToKeep>
                  <numToKeep>50</numToKeep>
                  <artifactDaysToKeep>-1</artifactDaysToKeep>
                  <artifactNumToKeep>-1</artifactNumToKeep>
                </strategy>
              </jenkins.model.BuildDiscarderProperty>
              <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.29.0">
                <projectUrl>https://github.com/mycompany/myrepo/</projectUrl>
                <displayName></displayName>
              </com.coravy.hudson.plugins.github.GithubProjectProperty>
              <com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty plugin="naginator@1.17.2">
                <optOut>false</optOut>
              </com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty>
            </properties>
            <scm class="org.jenkinsci.plugins.multiplescms.MultiSCM" plugin="multiple-scms@0.6">
              <scms>
                <hudson.plugins.git.GitSCM plugin="git@3.7.0">
                  <configVersion>2</configVersion>
                  <userRemoteConfigs>
                    <hudson.plugins.git.UserRemoteConfig>
                      <name>GithubRepo</name>
                      <url>git@github.com:mycompany/myrepo.git</url>
                      <credentialsId>omitted</credentialsId>
                    </hudson.plugins.git.UserRemoteConfig>
                  </userRemoteConfigs>
                  <branches>
                    <hudson.plugins.git.BranchSpec>
                      <name>master</name>
                    </hudson.plugins.git.BranchSpec>
                  </branches>
                  <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
                  <submoduleCfg class="list"/>
                  <extensions>
                    <hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
                      <relativeTargetDir>myrepo</relativeTargetDir>
                    </hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
                  </extensions>
                </hudson.plugins.git.GitSCM>
              </scms>
            </scm>
            <assignedNode>master</assignedNode>
            <canRoam>false</canRoam>
            <disabled>false</disabled>
            <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
            <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
            <triggers/>
            <concurrentBuild>false</concurrentBuild>
            <axes>
              <hudson.matrix.LabelAxis>
                <name>label</name>
                <values>
                  <string>builder</string>
                </values>
              </hudson.matrix.LabelAxis>
            </axes>
            <builders>
              <hudson.tasks.Shell>
                <command>
          scripts/build
              </hudson.tasks.Shell>
            </builders>
            <publishers>
              <org.jenkinsci.plugins.postbuildscript.PostBuildScript plugin="postbuildscript@0.17">
                <buildSteps>
                  <hudson.tasks.Shell>
                    <command>
          git tag -a -f -m &quot; release on $(date)&quot; ${BUILD_NUMBER}
          git push GithubRepo ${BUILD_NUMBER}
          exit 0</command>
                  </hudson.tasks.Shell>
                </buildSteps>
                <scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
                <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
                <markBuildUnstable>false</markBuildUnstable>
                <executeOn>MATRIX</executeOn>
              </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
            </publishers>
            <buildWrappers>
              <hudson.plugins.build__timeout.BuildTimeoutWrapper plugin="build-timeout@1.19">
                <strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
                  <timeoutMinutes>55</timeoutMinutes>
                </strategy>
                <operationList/>
              </hudson.plugins.build__timeout.BuildTimeoutWrapper>
              <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper plugin="ssh-agent@1.15">
                <credentialIds>
                  <string>omitted</string>
                </credentialIds>
                <ignoreMissing>false</ignoreMissing>
              </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
            </buildWrappers>
            <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
              <runSequentially>false</runSequentially>
            </executionStrategy>
          

          Luigi Tagliamonte added a comment - dheid thank you for the quick reply, this is my config: <?xml version= '1.0' encoding= 'UTF-8' ?> <matrix-project plugin= "matrix-project@1.12" > <actions/> <description></description> <keepDependencies> false </keepDependencies> <properties> <jenkins.model.BuildDiscarderProperty> <strategy class= "hudson.tasks.LogRotator" > <daysToKeep>-1</daysToKeep> <numToKeep>50</numToKeep> <artifactDaysToKeep>-1</artifactDaysToKeep> <artifactNumToKeep>-1</artifactNumToKeep> </strategy> </jenkins.model.BuildDiscarderProperty> <com.coravy.hudson.plugins.github.GithubProjectProperty plugin= "github@1.29.0" > <projectUrl>https: //github.com/mycompany/myrepo/</projectUrl> <displayName></displayName> </com.coravy.hudson.plugins.github.GithubProjectProperty> <com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty plugin= "naginator@1.17.2" > <optOut> false </optOut> </com.chikli.hudson.plugin.naginator.NaginatorOptOutProperty> </properties> <scm class= "org.jenkinsci.plugins.multiplescms.MultiSCM" plugin= "multiple-scms@0.6" > <scms> <hudson.plugins.git.GitSCM plugin= "git@3.7.0" > <configVersion>2</configVersion> <userRemoteConfigs> <hudson.plugins.git.UserRemoteConfig> <name>GithubRepo</name> <url>git@github.com:mycompany/myrepo.git</url> <credentialsId>omitted</credentialsId> </hudson.plugins.git.UserRemoteConfig> </userRemoteConfigs> <branches> <hudson.plugins.git.BranchSpec> <name>master</name> </hudson.plugins.git.BranchSpec> </branches> <doGenerateSubmoduleConfigurations> false </doGenerateSubmoduleConfigurations> <submoduleCfg class= "list" /> <extensions> <hudson.plugins.git.extensions.impl.RelativeTargetDirectory> <relativeTargetDir>myrepo</relativeTargetDir> </hudson.plugins.git.extensions.impl.RelativeTargetDirectory> </extensions> </hudson.plugins.git.GitSCM> </scms> </scm> <assignedNode>master</assignedNode> <canRoam> false </canRoam> <disabled> false </disabled> <blockBuildWhenDownstreamBuilding> false </blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding> false </blockBuildWhenUpstreamBuilding> <triggers/> <concurrentBuild> false </concurrentBuild> <axes> <hudson.matrix.LabelAxis> <name>label</name> <values> <string>builder</string> </values> </hudson.matrix.LabelAxis> </axes> <builders> <hudson.tasks.Shell> <command> scripts/build </hudson.tasks.Shell> </builders> <publishers> <org.jenkinsci.plugins.postbuildscript.PostBuildScript plugin= "postbuildscript@0.17" > <buildSteps> <hudson.tasks.Shell> <command> git tag -a -f -m &quot; release on $(date)&quot; ${BUILD_NUMBER} git push GithubRepo ${BUILD_NUMBER} exit 0</command> </hudson.tasks.Shell> </buildSteps> <scriptOnlyIfSuccess> true </scriptOnlyIfSuccess> <scriptOnlyIfFailure> false </scriptOnlyIfFailure> <markBuildUnstable> false </markBuildUnstable> <executeOn>MATRIX</executeOn> </org.jenkinsci.plugins.postbuildscript.PostBuildScript> </publishers> <buildWrappers> <hudson.plugins.build__timeout.BuildTimeoutWrapper plugin= "build-timeout@1.19" > <strategy class= "hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy" > <timeoutMinutes>55</timeoutMinutes> </strategy> <operationList/> </hudson.plugins.build__timeout.BuildTimeoutWrapper> <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper plugin= "ssh-agent@1.15" > <credentialIds> <string>omitted</string> </credentialIds> <ignoreMissing> false </ignoreMissing> </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper> </buildWrappers> <executionStrategy class= "hudson.matrix.DefaultMatrixExecutionStrategyImpl" > <runSequentially> false </runSequentially> </executionStrategy>

          Daniel Heid added a comment -

          Sorry, I tried and tried, but I still cannot reproduce the problem. I used your configuration and it works on the agent as well as the master. Could you please open your job configuration, save it and send me the resulting config.xml (http://your-jenkins-host:8080/jenkins/job/the-job-name/config.xml)? It seems to me, that the newly introduced role is for whatever reason is not correctly migrated (should be BOTH by default, but seems to be MASTER in your case). With the config.xml provided by you, I want to check, whether the role is correctly assigned.

          Daniel Heid added a comment - Sorry, I tried and tried, but I still cannot reproduce the problem. I used your configuration and it works on the agent as well as the master. Could you please open your job configuration, save it and send me the resulting config.xml ( http://your-jenkins-host:8080/jenkins/job/the-job-name/config.xml)? It seems to me, that the newly introduced role is for whatever reason is not correctly migrated (should be BOTH by default, but seems to be MASTER in your case). With the config.xml provided by you, I want to check, whether the role is correctly assigned.

          Daniel Heid added a comment -

          Closing the issue due to a lack of information.

          Daniel Heid added a comment - Closing the issue due to a lack of information.

            dheid Daniel Heid
            ltagliamonte Luigi Tagliamonte
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: