Home > Mobile >  Programmatically set Timestamper plugin "Enabled for all Pipeline builds" option
Programmatically set Timestamper plugin "Enabled for all Pipeline builds" option

Time:02-05

Is it possible to set Timestamper plugin "Enabled for all Pipeline builds" option programmatically (upon Jenkins installation)?

CodePudding user response:

You could use Groovy init scripts with something like:

import hudson.plugins.*

instance = Jenkins.getInstance()

tsconfig = instance.getDescriptorByType(timestamper.TimestamperConfig)

tsconfig.setAllPipelines(true)

tsconfig.save()

See: https://www.jenkins.io/doc/book/managing/groovy-hook-scripts/

And: https://javadoc.jenkins.io/plugin/timestamper/index.html?hudson/plugins/timestamper/api/TimestamperAPI.html

  •  Tags:  
  • Related