Skip to content

Instantly share code, notes, and snippets.

@HwDhyeon
Created March 11, 2020 00:30
Show Gist options
  • Save HwDhyeon/9c316c0d45746b23bc1e36b31d03d86e to your computer and use it in GitHub Desktop.
Save HwDhyeon/9c316c0d45746b23bc1e36b31d03d86e to your computer and use it in GitHub Desktop.
젠킨스 빌드 시 파라미터가 존재하는지 확인하고 없다면 기본값 설정하기
def MY_VARIABLE = null
if(env.my_parameter) {
MY_VARIABLE = env.my_parameter
} else {
MY_VARIABLE = "default value"
}
echo "parameter set: ${MY_VARIABLE}"
pipeline {
agent any
stages {
stage('Parameter Check') {
steps {
echo "${MY_VARIABLE}"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment