I try to create new build step plugin.
In the GUI ( jelly ) I want to create the"Add" button with drop down list. Like we have in parameter job that we have a option to add diff parameter types ( String, choose, ...)
Can you please advise how to do it in jelly and what I need implement in java code?
Where I can find documentation for it?
Refer this github repo which is a basic Jenkins plugins to connect Corestack orchestrator. Don't care about the application, but you can refer the implementation part on how to add a build/post build step in config.jelly and its corresponding java side implementation in CorestackNotifier.java soure code.
I got the answer from google groups.
You can find how to do it in the below post 1
Related
I struggled few days, But still, I could not find a solution for this.
I am trying to deploy Marathon apps with Jenkins and follow this tutorial.
https://docs.mesosphere.com/1.10/tutorials/deploy-on-marathon/
I want to configure a parameterized project for this. Eg :
Builder can select one choice out of four choices.
As an Example: Suppose the user has selected the vault option.
Then I need to change the file name(Definition File) base on what user has selected on above options.
I am using Marathon deployment plugin.
For this configs I am getting below error :
18:12:40 [Marathon] Application Definition not found:
18:12:40 [Marathon] Could not find file 'deployment_files/"($CONTAINER)".json'
18:12:40 Build step 'Marathon Deployment' changed build result to FAILURE
Could you please help me to achieve this problem or suggest a better way to do this?
When referencing a build parameter in another setting (or another parameter) the way you are trying to, I typically use the following format:
deployment_files/${CONTAINER}.json
There is some good reading to be done in the following thread on using $VAR vs ${VAR}
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.
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
My question was too long so I've shortened it:
Is it possible to create or edit a Jenkins Project on the fly with a template/environment variables/coding/etc, and would this be possible via a trigger from Gitlab/hub/etc.? If someone could point me in the right direction that would be great! Thanks!
Yes.
Your options are to use the rest API (and there's more detailed information in your own Jenkins, check the link in the bottom right corner of every page), or to create the job directory structure and XML files manually and have Jenkins re-scan its workspace directories.
I strongly recommend the rest API. It's designed for this sort of thing.
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.