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

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

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • timestamper-plugin
    • None

      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.

          [JENKINS-67723] Programmatically set Timestamper plugin "Enabled for all Pipeline builds" option

          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.

          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?

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

          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.

          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)
          

          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!

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

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

          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

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

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

              Created:
              Updated: