I have a project with several pipelines, each one for one microservice and its 'dev' branch counterpart.

I was wondering thares a way of declaring these variables globally in the Jenkins pipeline, so that they would become visible not only from within my Jenkinsfiles but also from inside my dockerfiles.

For better understanding: We used to build on a TravisCI version that wouldn't allow me to even pick the appropriate branch, let alone create separate environments for each branch. Everything needed to be declared within TravisCI dashboard like twice e.g. NPM_TOKEN, NPM_TOKEN_DEV).

We had also to put conditionals inside travis.yml to validate when we were supposed to build master or dev. I managed to separate the pipelines in the Jenkins, but I still have to declare some stuff within the respective Jenkinsfiles and Dockerfiles as well.

Is there a a way of making it smarter?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.