HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is it possible to pass environment variables to multibranch pipeline job in a time of generating it via DSL?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
passmultibranchtimeenvironmentpossiblegeneratingviadslvariablesjob

Problem

I want to pass some environment variables in the time of generating the multibranch pipelines, so upon the build start, it will already have these variables.

The only thing I found was this envInject plugin which is not supported by multibranch DSL generation.

https://jenkinsci.github.io/job-dsl-plugin/#plugin/envinject

Does anyone know the way to do that?

Solution

You can use Jenkins DSL and pass the environment variable as mentioned in below links:

https://jenkins.io/doc/book/pipeline/syntax/#environment
https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#withenv-set-environment-variables

Context

StackExchange DevOps Q#8919, answer score: 1

Revisions (0)

No revisions yet.