At the moment I have a working Jenkins declarative pipeline set up as a paramterized build, and a git pre-push hook set up to build it.
I would like to migrate to a multi-branch setup, where the feature/<someCoolFeature>
and development
branches are configured to deploy to one server, test
is configured to deploy to a different server and production
to the production server.
I am comfortable with triggering builds and defining parameters for which branches are built when, but all the documentation, questions and blog posts skip over a central thing:
How do I configure the deployment variables for the different servers?
As I see it, since you don't have switch
and if
control structures in declarative pipelines. I have to create a library which looks up which BRANCH_NAME
I am building, and set the environment variables, or choose the corresponding application-<env>.yml
based on that, but there must be a best practice somewhere that I am missing.