-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
48 lines (48 loc) · 1.45 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline {
agent { label "master" }
environment {
COMPOSE_PROJECT_NAME = "${env.JOB_NAME}"
GITHUB_TOKEN = credentials('masbuild-github-token')
}
stages {
stage('prepare') {
steps {
script {
docker.withRegistry('https://masdevtestregistry.azurecr.io', 'acr_credentials') {
sh 'docker-compose -f docker-compose.yml build --force-rm'
sh 'docker-compose -f docker-compose.yml up -d'
}
}
}
}
stage ('branch-test') {
when { not { branch 'PR-*' } }
steps {
sh 'docker-compose -f docker-compose.yml run --rm rails ./jenkins/test'
}
}
stage ('pr-test') {
when { branch 'PR-*' }
environment {
DANGER_CHANGE_ID = "${env.CHANGE_ID}"
DANGER_GIT_URL = "${env.GIT_URL}"
DANGER_JENKINS_URL = "${env.JENKINS_URL}"
}
steps {
sh 'docker-compose -f docker-compose.yml run --rm rails ./jenkins/test'
}
}
stage('build') {
when {branch 'master'}
steps {
sh "docker-compose -f docker-compose.yml run --rm rails ./jenkins/build"
}
}
}
post {
always {
sh 'docker-compose -f docker-compose.yml down --remove-orphans'
cleanWs()
}
}
}