jenkinsci / jenkins-multijob-plugin

A new multijob plugin was created by Tikal ALM team. Using this job you can add full hierarchy of Jenkins jobs that will be executed in sequence or in parallel.
https://plugins.jenkins.io/jenkins-multijob-plugin/
MIT License
72 stars 134 forks source link

job-name field should support Variable names #154

Open dstruct88 opened 6 years ago

dstruct88 commented 6 years ago

Generic build could be used by multiple groups , and the only difference between them is one phase. This phase should be passed as a parameter.

Example: I've got a string parameter which is the JobName, and I would like to write in the MultiJob phase job-name field something like: $JobName

The JobName could be basic job or a MultiJob.

This is a recreation of a ticket in the previous project (https://issues.jenkins-ci.org/browse/JENKINS-30627)

Vyrnos commented 5 years ago

Have the same problem, I think the "Job name" field should support variable names.

The workaround I have implemented is another intermediate job that is called before the target job. The intermediate job has trigger build with parameters which does support variable names as input.

Pros: Gets the job done, doesnt loose the multijob functionality by calling always that intermediate job from the multijob, which then invokes the target job. Cons: Wasting another executor slot.

I think the ability of parameterizing job name field would be a nice addition to the multijob plugin.

bergstenarn commented 5 years ago

This is something I've been trying to accomplish now for several months. If implemented it would ease things considerably.

yorammi commented 5 years ago

What you all wish for is actually to make the Jenkins job programmable, which is what Jenkins Pipeline actually does. But multiJob has no Pipeline support and it probably won't have. Instead, we (Tikal Knowledge) develop now a similar solution for Pipelines. Soon it will be published and I will add link to it from the multiJob plugin page

dstruct88 commented 5 years ago

I would have to disagree. I can’t speak for everyone else but I simply want variable support in the job name, not a programmable job. Pipelines can be useful but they require you to rewrite your job entirely using a pipeline, which I certainly wouldn’t want to do just to get support for variable name expansion.

yorammi commented 5 years ago

Well, if someone will PR us with the requested feature, we'll test and merge it, but nowadays the Jenkins world moved to pipelines, so we'll provide a Pipeline solution and we'll make efforts to provide migration of a multiJob jobs into the new Pipeline solution.

On Tue, Jan 29, 2019 at 4:59 AM dstruct88 notifications@github.com wrote:

I would have to disagree. I can’t speak for everyone else but I simply want variable support in the job name, not a programmable job. Pipelines can be useful but they require you to rewrite your job entirely using a pipeline, which I certainly wouldn’t want to do just to get support for variable name expansion.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/tikal-multijob-plugin/issues/154#issuecomment-458388846, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWQkh038OSg70KZLoaAKnzwj_ArE4cAks5vH7kIgaJpZM4VH00D .

-- Yoram Michaeli DevOps Tech Leader 052-5766838 yorammi@tikalk.com

mohammaddehnavi commented 3 years ago

Hello there! using double quote for job name if you want to user variable:

 build job: "Deploy-$SERVICE", parameters: [string(name: "SERVICE", value: "${SERVICE}"), string(name: "OKD", value: "${OKD}"), string(name: "NAMESPACE", value: "${ENVIRONMENT}"), string(name: "VERSION", value: "${TAG}")]