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

Programmatically set Timestamper plugin "Enabled for all Pipeline builds" option

    XMLWordPrintable

Details

    Description

      Is it possible to set Timestamper plugin "Enabled for all Pipeline builds" option programmatically (upon Jenkins installation)? If so, it'd be nice to have an example in Timestamper doc.

      Attachments

        Issue Links

          Activity

            Configuration as Code generates the following YAML for that setting:

            unclassified: 
              timestamper: 
                allPipelines: true
            

            I have not tested whether adding that to jenkins.yaml changes the setting, but I don't see why it wouldn't.

            kon Kalle Niemitalo added a comment - Configuration as Code generates the following YAML for that setting: unclassified: timestamper: allPipelines: true I have not tested whether adding that to jenkins.yaml changes the setting, but I don't see why it wouldn't.

            kon thank you so much for your help! How does it generate it?

            romannewaza Roman Borysenko added a comment - kon  thank you so much for your help! How does it generate it?
            kon Kalle Niemitalo added a comment - - edited

            If you have installed the Configuration as Code plugin, then the "System Configuration" section of the "Manage Jenkins" page includes a "Configuration as Code" link. Click that to navigate to the "Configuration as Code" page. There, click "View Configuration" in the "Actions" section. That generates YAML from the current settings of Jenkins. If you have also installed the Timestamper plugin and set the "Enabled for all Pipeline builds" option, then the displayed YAML includes the allPipelines: true setting that I showed above.

            See https://github.com/jenkinsci/timestamper-plugin/pull/63 and JENKINS-62445 for how this was implemented.

            kon Kalle Niemitalo added a comment - - edited If you have installed the Configuration as Code plugin, then the "System Configuration" section of the "Manage Jenkins" page includes a "Configuration as Code" link. Click that to navigate to the "Configuration as Code" page. There, click "View Configuration" in the "Actions" section. That generates YAML from the current settings of Jenkins. If you have also installed the Timestamper plugin and set the "Enabled for all Pipeline builds" option, then the displayed YAML includes the allPipelines: true setting that I showed above. See https://github.com/jenkinsci/timestamper-plugin/pull/63 and JENKINS-62445 for how this was implemented.

            Alternatively, I guess you could set the setting by calling TimestamperConfig.setAllPipelines from Groovy Hook Scripts. I did not test but something like this might work:

            import hudson.plugins.timestamper.TimestamperConfig
            
            def timestamperConfig = TimestamperConfig.get()
            timestamperConfig.setAllPipelines(true)
            
            kon Kalle Niemitalo added a comment - Alternatively, I guess you could set the setting by calling TimestamperConfig.setAllPipelines from Groovy Hook Scripts . I did not test but something like this might work: import hudson.plugins.timestamper.TimestamperConfig def timestamperConfig = TimestamperConfig.get() timestamperConfig.setAllPipelines( true )

            kon thanks for your help!

            romannewaza Roman Borysenko added a comment - kon  thanks for your help!

            If the documentation was not changed, then is Fixed the correct resolution?

            kon Kalle Niemitalo added a comment - If the documentation was not changed, then is Fixed the correct resolution?

            kon you are right - let's keep it opened

            romannewaza Roman Borysenko added a comment - kon  you are right - let's keep it opened

            People

              Unassigned Unassigned
              romannewaza Roman Borysenko
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: