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

TFS plugin does not create label as trigger value is not saved in config

      Add the Post Build step to create a Label in TFS.

      • Enter the label text.
      • Select either of the triggers - Always or only for success.
      • Save the job
      • Open the job configuration and neither of the triggers are selected.

      Reviewed the job config.xml and entry is written as
      <hudson.plugins.tfs.TFSLabeler plugin="tfs@3.1.1">
      <labelName>test label</labelName>
      </hudson.plugins.tfs.TFSLabeler>

      Checked the source at https://github.com/jenkinsci/tfs-plugin/blob/master/src/main/java/hudson/plugins/tfs/TFSLabeler.java
      Looks like there should be a value for the 'whenToLabel' in the config.

          [JENKINS-23344] TFS plugin does not create label as trigger value is not saved in config

          Nabel Sawiris added a comment -

          I would also like to report this issue for Windows Server 2008R2.

          I did happen to find a work around:

          1. Open config.xml for the particular job you want
          2. After the label element add one of the following
            • <whenToLabel>success</whenToLabel>
            • <whenToLabel>always</whenToLabel>
          3. So it should look something like this
            • <hudson.plugins.tfs.TFSLabeler plugin="tfs@3.1.1">
              <labelName>MyLabel-123<labelName>
              <whenToLabel>success</whenToLabel>
              </hudson.plugins.tfs.TFSLabeler>
          4. Restart Jenkins Server
          5. If you have to make changes to the job
            • Manually update xml file, or
            • Run through steps 1 through 4, after you makes changes through UI

          I know these steps are not ideal, but at least you can label without writing a separate script or Job.

          Nabel Sawiris added a comment - I would also like to report this issue for Windows Server 2008R2. I did happen to find a work around: Open config.xml for the particular job you want After the label element add one of the following <whenToLabel>success</whenToLabel> <whenToLabel>always</whenToLabel> So it should look something like this <hudson.plugins.tfs.TFSLabeler plugin="tfs@3.1.1"> <labelName>MyLabel-123<labelName> <whenToLabel>success</whenToLabel> </hudson.plugins.tfs.TFSLabeler> Restart Jenkins Server If you have to make changes to the job Manually update xml file, or Run through steps 1 through 4, after you makes changes through UI I know these steps are not ideal, but at least you can label without writing a separate script or Job.

          Chad Strauch added a comment -

          I submitted a pull request that seems to have fixed to issue.

          https://github.com/jenkinsci/tfs-plugin/pull/29

          Chad Strauch added a comment - I submitted a pull request that seems to have fixed to issue. https://github.com/jenkinsci/tfs-plugin/pull/29

          I also observed that whenToLabel is not saved to the job's config.xml.
          Although, adding it manually did not fix it in my case (might be another configuration problem on my side).

          Hannes Strautmann added a comment - I also observed that whenToLabel is not saved to the job's config.xml. Although, adding it manually did not fix it in my case (might be another configuration problem on my side).

          Chad Strauch added a comment -

          Hannes, you need to reload configuration after adding it manually.

          It seems no one is maintaining the repo anymore. I'll try to gain access so I can merge my pull request that fixes this issue.

          Chad Strauch added a comment - Hannes, you need to reload configuration after adding it manually. It seems no one is maintaining the repo anymore. I'll try to gain access so I can merge my pull request that fixes this issue.

          Thanks for pointing that out. It seems to work after reloading the configuration from disk.

          Hannes Strautmann added a comment - Thanks for pointing that out. It seems to work after reloading the configuration from disk.

          Code changed in jenkins
          User: Chad Strauch
          Path:
          src/main/java/hudson/plugins/tfs/TFSLabeler.java
          http://jenkins-ci.org/commit/tfs-plugin/98af3db1a544d9e43512add0be0ccd5bdf3e6631
          Log:
          https://issues.jenkins-ci.org/browse/JENKINS-23344 - Fixed whenToLabel in config.xml

          The overridden newInstance() method was causing the <whenToLabel>
          element to be removed from a job's config.xml file. TFSLabeler is
          already instantiated because of @DataBoundConstructor.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Chad Strauch Path: src/main/java/hudson/plugins/tfs/TFSLabeler.java http://jenkins-ci.org/commit/tfs-plugin/98af3db1a544d9e43512add0be0ccd5bdf3e6631 Log: https://issues.jenkins-ci.org/browse/JENKINS-23344 - Fixed whenToLabel in config.xml The overridden newInstance() method was causing the <whenToLabel> element to be removed from a job's config.xml file. TFSLabeler is already instantiated because of @DataBoundConstructor.

          Code changed in jenkins
          User: Olivier "Oli" Dagenais
          Path:
          src/main/java/hudson/plugins/tfs/TFSLabeler.java
          http://jenkins-ci.org/commit/tfs-plugin/37e4c3b763ec0b4c94290abdeaab6b9a597b3d8b
          Log:
          Merge pull request #29 from boatski/JENKINS-23344

          JENKINS-23344: Fix missing whenToLabel in config.xml

          Compare: https://github.com/jenkinsci/tfs-plugin/compare/6651056f252b...37e4c3b763ec

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier "Oli" Dagenais Path: src/main/java/hudson/plugins/tfs/TFSLabeler.java http://jenkins-ci.org/commit/tfs-plugin/37e4c3b763ec0b4c94290abdeaab6b9a597b3d8b Log: Merge pull request #29 from boatski/ JENKINS-23344 JENKINS-23344 : Fix missing whenToLabel in config.xml Compare: https://github.com/jenkinsci/tfs-plugin/compare/6651056f252b...37e4c3b763ec

          Fixed in version 3.2.0

          Olivier Dagenais added a comment - Fixed in version 3.2.0

            oli_at_jsi Olivier Dagenais
            phil_larsen Philip Larsen
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: