I need to access system environment variable from my Jenkins file. I know that there are some predefined variables (e.g. JOB_NAME or BUILD_NUMBER), but I need to access custom environment variable which I set previously. What are the way to do this? It seems that env.MY_VARIABLE and env['MY_VARIABLE'] but those don't work. I need this to have access to the variable which would be specified during the pipeline build inside a bash script. Probably there are more convenient ways to pass information from bash script to Jenkins file, which called this bash script.
Add a comment
|
1 Answer
You access environment variables like ${DB_ENGINE} or $DB_ENGINE from bash or in your Groovy job/pipeline DSL script where DB_ENGINE is the custom environment variable you set.
Check documentation.