代码拉取完成,页面将自动刷新
#!groovy
// Get the AWS prefix if it exists
def aws_prefix() {
try { if ('' != AWS_PREFIX) { return AWS_PREFIX } }
catch (MissingPropertyException e) { return false }
}
// Stop the pipeline after provision / deprovision for QA to do something manual
def pipeline_provision_stop() {
try { if ('' != PIPELINE_PROVISION_STOP) { return PIPELINE_PROVISION_STOP } }
catch (MissingPropertyException e) { return false }
}
def pipeline_deprovision_stop() {
try { if ('' != PIPELINE_DEPROVISION_STOP) { return PIPELINE_DEPROVISION_STOP } }
catch (MissingPropertyException e) { return false }
}
// SLACK_CHANNEL resolution is first via Jenkins Build Parameter SLACK_CHANNEL fed in from console,
// then from $DOCKER_TRIGGER_TAG which is sourced from the Docker Hub Jenkins plugin webhook.
def slack_channel() {
try { if ('' != SLACK_CHANNEL) { return SLACK_CHANNEL } }
catch (MissingPropertyException e) { return '#ci_cd' }
}
// simplify the generation of Slack notifications for start and finish of Job
def jenkinsSlack(type) {
channel = slack_channel()
aws_prefix = aws_prefix()
def jobInfo = "\n » ${aws_prefix} :: ${JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|job>) (<${env.BUILD_URL}/console|console>)"
if (type == 'start'){
slackSend channel: channel, color: 'blue', message: "build started${jobInfo}"
}
if (type == 'finish'){
def buildColor = currentBuild.result == null? "good": "warning"
def buildStatus = currentBuild.result == null? "SUCCESS": currentBuild.result
def msg = "build finished - ${buildStatus}${jobInfo}"
slackSend channel: channel, color: buildColor, message: "${msg}"
}
}
def lastBuildResult() {
def previous_build = currentBuild.getPreviousBuild()
if ( null != previous_build ) { return previous_build.result } else { return 'UKNOWN' }
}
try {
node {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm', 'defaultFg': 2, 'defaultBg':1]) {
jenkinsSlack('start')
checkout scm
stage('bootstrap') {
sh "./scripts/bootstrap.sh"
}
stage ('syntax') {
sh "docker run --rm " +
"-v jenkins_home:/var/jenkins_home " +
"rancherlabs/ci-validation-tests /bin/bash -c \'cd \"\$(pwd)\" && invoke syntax\'"
}
stage ('lint') {
sh "docker run --rm " +
"-v jenkins_home:/var/jenkins_home " +
"rancherlabs/ci-validation-tests /bin/bash -c \'cd \"\$(pwd)\" && invoke lint\'"
}
stage ('configure .env file') {
withEnv(["RANCHER_ORCHESTRATION=StandAlone", "RANCHER_VERSION=SA", "RANCHER_SERVER_OPERATINGSYSTEM=${RANCHER_AGENT_OPERATINGSYSTEM}"]) {
sh "./scripts/configure.sh"
}
}
stage ('deprovision Rancher Agents') {
sh "docker run --rm " +
"-v jenkins_home:/var/jenkins_home " +
"--env-file .env " +
"rancherlabs/ci-validation-tests /bin/bash -c \'cd \"\$(pwd)\" && invoke rancher_agents.deprovision\'"
}
if ( "false" == "${PIPELINE_DEPROVISION_STOP}" ) {
stage ('provision Standalone Rancher Agents') {
sh "docker run --rm " +
"-v jenkins_home:/var/jenkins_home " +
"--env-file .env " +
"rancherlabs/ci-validation-tests /bin/bash -c \'cd \"\$(pwd)\" && invoke rancher_agents.provisionstandalone\'"
}
} // PIPELINE_DEPROVISION_STOP
} // wrap
} // node
} catch(err) { currentBuild.result = 'FAILURE' }
jenkinsSlack('finish')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。