티스토리 뷰

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/ }
}

https://www.ibm.com/docs/en/zos/2.4.0?topic=descriptions-printenv-display-values-environment-variables 

 

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
댓글