-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
34 lines (33 loc) · 1017 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@Library('pipeline-library') _
pipeline {
agent { label 'docker' }
stages {
stage('Build') {
steps {
sh "docker build -t openstax/cnx-easybake:${GIT_COMMIT} ."
}
}
stage('Publish Dev Container') {
steps {
// 'docker-registry' is defined in Jenkins under credentials
withDockerRegistry([credentialsId: 'docker-registry', url: '']) {
sh "docker push openstax/cnx-easybake:${GIT_COMMIT}"
}
}
}
stage('Publish Release') {
when { buildingTag() }
environment {
release = getVersion()
}
steps {
withDockerRegistry([credentialsId: 'docker-registry', url: '']) {
sh "docker tag openstax/cnx-easybake:${GIT_COMMIT} openstax/cnx-easybake:${release}"
sh "docker tag openstax/cnx-easybake:${GIT_COMMIT} openstax/cnx-easybake:latest"
sh "docker push openstax/cnx-easybake:${release}"
sh "docker push openstax/cnx-easybake:latest"
}
}
}
}
}