-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (57 loc) · 1.65 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
49
50
51
52
53
54
55
56
57
58
pipeline {
agent { label 'docker' }
environment {
SERVICE = "denv"
SLACK_CHANNEL = "#funding_fathers_n"
}
stages {
stage('build') {
environment {
PUBLIC = credentials('acimabot_public_key')
PRIVATE = credentials('acimabot_private_key')
}
steps {
script {
try {
checkout scm
sh '''
docker build -f ./Dockerfile.ci -t $SERVICE --build-arg PRIVATE="$PRIVATE" --build-arg PUBLIC="$PUBLIC" .
'''
} catch (exc) {
echo "EXCEPTION: ${exc}"
throw exc
} finally {
}
}
}
}
stage('test') {
steps {
checkout scm
ansiColor('xterm') {
sh '''
docker-compose -f docker-compose.ci.yml up -d
sleep 5
docker-compose -f docker-compose.ci.yml run web rake spec
docker-compose -f docker-compose.ci.yml run web rake rubocop
'''
}
}
}
}
post {
failure {
// alert of any failures--master or topic branches
slackSend channel: "$SLACK_CHANNEL", color: 'danger', message: "<$RUN_DISPLAY_URL|Build $BUILD_NUMBER> on ${env.JOB_NAME.replace('%2F', '/')} failed! (<$RUN_CHANGES_DISPLAY_URL|Changes>)"
}
success {
script {
if (env.BRANCH_NAME == 'master') {
slackSend channel: "$SLACK_CHANNEL", color: 'good', message: "<$RUN_DISPLAY_URL|Build $BUILD_NUMBER> on ${env.JOB_NAME.replace('%2F', '/')} passed. (<$RUN_CHANGES_DISPLAY_URL|Changes>)"
} else {
// do nothing if a topic branch succeeds
}
}
}
}
}