-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
71 lines (59 loc) · 1.62 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
59
60
61
62
63
64
65
66
67
68
69
70
71
pipeline {
agent {
docker { image 'ruby:2.7' }
}
environment {
PLATFORM_CREDENTIALS = credentials("heroku-api-token")
RAINFOREST_TOKEN = credentials("rainforest-auth-token")
}
stages {
stage("install and build") {
steps {
echo "installing and setting up the application"
sh "gem install bundler"
sh "bundle install"
// Install the latest stable version of rainforest-cli.
// This will allow us to trigger a Rainforest run before we deploy.
sh "curl https://api.github.com/repos/rainforestapp/rainforest-cli/releases/latest | jq -r '.assets[].browser_download_url' | grep linux-amd64 | xargs wget -O rainforest-cli.tgz"
sh "tar xvf rainforest-cli.tgz"
}
}
stage("test") {
steps {
echo "testing the application"
// Run unit tests
sh "bundle exec rake"
// Run Rainforest tests
// Trigger Rainforest run and wait for results
sh "./rainforest run --run-group 7597 --token ${RAINFOREST_TOKEN}"
}
}
stage("deploy_develop") {
when {
expression {
BRANCH_NAME == "develop"
}
}
steps {
echo "deploying the application to develop branch"
sh "git push -f heroku-staging HEAD:develop"
}
}
stage("deploy_master") {
when {
expression {
BRANCH_NAME == "master"
}
}
steps {
echo "deploying the application to master branch"
sh "git push -f heroku-prd HEAD:master"
}
}
}
post {
failure {
echo "Oh my heck, my release failed"
}
}
}