Jenkins Pipeline - Set process.env variable from build parameter Jenkins Pipeline - Set process.env variable from build parameter jenkins jenkins

Jenkins Pipeline - Set process.env variable from build parameter


things defined in the environment block can be accessed elsewhere in the Jenkinsfile via env.MY_VAR (like echo env.MY_VAR).

things defined in the parameters block can be accessed elsewhere in the Jenkinsfile via params.MY_OTHER_VAR.

both can be accessed in scripts called by the Jenkinsfile as environment variables. it sounds like you're using node-based scripts and that you had better luck with the environment block for some reason. i'd probably just use that and, if you need to, refer to your variables via env.THE_NAME_OF_YOUR_VAR.