I have a job creator job that creates other jobs in jenkins and I would like to use the created jobs name in the description.
For example for name "JobXX" i would like to have:
"This is documentation for JobXX etc.."
In "Execute shell" build step I can refer to the jobs name via $JOB_NAME parameter but that does not seem to work in the description field.
Any ideas on how to do this? Or if it's even possible?
Never used it, but take a look to the Project Description Setter Plugin:
https://wiki.jenkins.io/display/JENKINS/Project+Description+Setter+Plugin
In this blog it explains better how to use it:
http://www.tothenew.com/blog/setting-dynamic-project-description-and-build-description-in-jenkins/
Among the different variables you can use there is {PROJECT_NAME} which fits your needs.
Besides this, this plugin allows you also to automatically set descriptions to each specific build.
Related
I have a job ( parameterized build) I am using BUILD_ID as a parameter and I need to add time stamp for the every BUILD_ID.
How to add time-stamp to the parameter.
I need the BUILD_ID value like Test_Build_{time-stamp}.
Kindly help me
There are numerous ways to do this.
Probably your best bet is the Dynamic Parameter Plugin. On the plugin page, one of its main examples does almost exactly what you described.
The Active Choices Plugin allows you to run groovy code to generate your parameter value(s). Here's a screenshot of the plugin setup along with the groovy code:
The EnvInject Plugin allows you to insert environment variables from a properties file as a build step. Using this method you would basically have to have 2 build steps, one to create the properties file and another to read it.
Or using the Groovy Plugin, you can add a groovy script build step to modify the parameter value.
I'm sure there a number of other ways to accomplish this as well.
Install Zen Timestamp plugin and use variable $BUILD_TIMESTAMP
Is it possible to configure a "Job Template" (this is a particular kind of Jenkins item) with the groovy template coming from SCM as is possible in other job types? I don't see it as an option in ours, but perhaps there is another plugin required for this?
There is not such an option. The closest equivalent would be to create a job template using the Pipeline transformer, where the inline script is merely boilerplate running a load step to load the “real” code. (An existing RFE CJP-1718 suggests removing the need for this boilerplate; if that would be useful to you, file a support ticket mentioning it.)
we have many Jenkins Test Jobs dependening on one library. Every Job has multiple parameters (always identical).
Now the problem is that if we change or add an parameter in the library, we have to touch every single jenkins job configuration.
Is there a way to configure the parameters of multiple jobs in a central place? Like defining the parameters in a file and refering to that? or is there jenkins plugin for that use case?
Thanks,
Marco
You can edit parameters (and much more) of multiple jobs in one place with Configuration Slicing Plugin:
Job Parameters (aka "This build is parameterized") can be configured across multiple jobs at one time through the "Parameters" link. To indicate which parameter you are configuring, note the "JobName[ParameterName]" syntax.
Not sure if this can help if you use some advanced parameters like File parameter, Dynamic parameter etc.
Use Build Flow plugin
You can run same or multiple jobs many times with different configuration.
Use Multijob Plugin and parameterized plugin
You can pass different parameter by using these plugins
So I need a job parameter to contain the next build number as its default value. This is mostly for information purposes to the user, so could go into the job description instead.
I've taken a look at dynamic parameters, to little avail.
Obviously, environment variables like BUILD_NUMBER are not set until the job has started building.
This is a stand alone job.
Edit:
The purpose of this parameter is just to provide information to the user who is kicking off the job. The parameter will contain a path to a directory that will be created during the job execution. The name of that dir will contain the build number that created it. /Testing/myTest_job$BUILD_NUMBER
If you want to have a generic description, you can user the Description Setter Plugin.
Install the plugin
Add Build Step "Set build description" as first Build Step
Set "Description" to /Testing/myTest_job${BUILD_NUMBER} and leave "Regular expression" blank
Alternative:
I would suggest to use the post build step "archive artefacts". This will provide the files your job creates as i.e. download link:
http://jenkins.foo.bar/job/example/lastSuccessfulBuild/artifact/yourfile.exe
I need to add a same boolean parameter ( from "Add Parameter" drop-down menu) to 100 existing jobs.
What is a better way to do it?
Thanks
This is a job for Jenkins job-dsl https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
This exposes the job structure to an API which can be used to modify the configuration. This is run as a separate Jenkins build step in a job
There is also a somewhat unwieldy, yet oftentimes-handy, plugin called Configuration Slicing. I've found it useful sometimes, in this situation.
Use Build Flow plugin. It allows to write DSL scripts.
example:
build("job-name", parameter:"vlaue1")
build("job-name", parameter:"vlaue2")
you can pass as many values like this.