Hi,
I'm not entirely sure what are you looking for but I want to tell you that 
you can use variables as image name, or at least you can do for agent 
labels:

agent{ label "${builder.label" }

We use the above in our pipelines to have different agents depending on the 
branch and PR number and other environment factors.

Cheers,
Gianluca.


On Monday, 15 June 2020 13:20:05 UTC+1, Marco Sacchetto wrote:
>
> Hi,
>
> I'm currently using a Jenkins declarative pipeline (note: if my issue 
> would be solved with a scripted pipeline, I can switch).
> The builds run inside an ephemeral docker agent spinned up by the pipeline 
> using a syntax similar to
>
> agent{ docker{ image "my-image"}}}
>
> The issue with that is that I'm going to have a big number of pipelines 
> defined as Jenkinsfiles which are all kind of similar
> to each other, and all of them will be running using the same docker agent.
> As such, I'd love to be able to parameterise the image name by defining it 
> as a variable or as a function inside a jenkins
> library, so that if the image needs to be change I don't have to commit 
> back to all of the existing Jenkinsfile.
>
> I saw it's possible to define the whole declarative pipeline inside a 
> function, but there seems to be no option to set instead 
> just some String variable to be used when setting up the agent, and no 
> possibility to define anything to run outside of the
> normal pipeline steps - is that correct?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/95d98d96-f65f-4519-8c16-751ab6e746e6o%40googlegroups.com.

Reply via email to