2019-02-16 04:16:49 +08:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
pipeline {
|
2019-02-21 01:06:06 +08:00
|
|
|
agent { label 'docker' }
|
2019-02-16 04:16:49 +08:00
|
|
|
|
2019-02-21 01:06:06 +08:00
|
|
|
options {
|
|
|
|
ansiColor('xterm')
|
|
|
|
}
|
2019-02-20 23:41:00 +08:00
|
|
|
|
2019-02-21 01:06:06 +08:00
|
|
|
environment {
|
|
|
|
NAME = "${env.GERRIT_REFSPEC}".minus('refs/changes/').replaceAll('/','.')
|
|
|
|
IMAGE_TAG = "$DOCKER_REGISTRY_FQDN/canvas-lms:$NAME"
|
|
|
|
}
|
2019-02-16 04:16:49 +08:00
|
|
|
|
2019-02-21 01:06:06 +08:00
|
|
|
stages {
|
|
|
|
stage("Build Image") {
|
|
|
|
steps {
|
|
|
|
timeout(time: 20, unit: 'MINUTES') {
|
|
|
|
sh """docker build -t $IMAGE_TAG ."""
|
2019-02-16 04:16:49 +08:00
|
|
|
}
|
2019-02-21 01:06:06 +08:00
|
|
|
}
|
|
|
|
}
|
2019-02-16 04:16:49 +08:00
|
|
|
|
2019-02-21 01:06:06 +08:00
|
|
|
/*
|
|
|
|
stage("Publish Image") {
|
|
|
|
when { environment name: "GERRIT_EVENT_TYPE", value: "change-merged" }
|
|
|
|
steps {
|
|
|
|
timeout(time: 5, unit: 'MINUTES') {
|
|
|
|
sh """docker push $IMAGE_TAG"""
|
2019-02-16 04:16:49 +08:00
|
|
|
}
|
2019-02-21 01:06:06 +08:00
|
|
|
}
|
2019-02-16 04:16:49 +08:00
|
|
|
}
|
2019-02-21 01:06:06 +08:00
|
|
|
*/
|
|
|
|
}
|
2019-02-16 04:16:49 +08:00
|
|
|
}
|