공부
[jenkins] pipeline groovy use secret `printenv NAME`
승가비
2022. 9. 8. 23:03
728x90
pipeline {
agent {
kubernetes {
inheritFrom 'seunggabi-batch'
defaultContainer 'seunggabi-batch'
}
}
environment {
COUNTRY = "kr"
ENV = "prod"
CLASS = "seunggabi.batch.job.TestJob"
}
stages {
stage('Run Job') {
steps {
script {
ARGS = sorted(params).collect { /$it.value/ } join ","
}
sh "/app/static/sh/emr.sh 1 20 ${COUNTRY} ${ENV} ${CLASS} \$(printenv MAIL_DOMAIN),\$(printenv MAIL_ID),\$(printenv MAIL_PW),\"${ARGS}\""
}
}
}
}
@NonCPS
def sorted(def m){
m.sort { /$it.key/ }
}
printenv - Display the values of environment variables
Format printenv [name] tcsh shell: printenv [name] Description The printenv command displays the values of environment variables. If the name argument is specified, only the value associated with name is printed. If it is not specified, printenv displays t
www.ibm.com
https://e.printstacktrace.blog/jenkins-pipeline-environment-variables-the-definitive-guide/
Jenkins Pipeline Environment Variables - The Definitive Guide
In this blog post, I will show you how you can work with Jenkins pipeline environment variables effectively. You will learn how to set env variable, how to use it in different context, as well as how
e.printstacktrace.blog
728x90