-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
49 lines (43 loc) · 1.17 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
#! /usr/bin/env groovy
pipeline {
agent { label 'docker' }
stages {
stage('Build') {
steps {
dockerCacheLoad(image: 'inst_statsd')
sh 'docker build -t inst_statsd .'
}
}
stage('Lint') {
steps {
sh "docker run --rm inst_statsd bin/rubocop"
}
}
stage('Test') {
steps {
sh 'docker run --rm -e BUNDLE_LOCKFILE=rails-6.0 inst_statsd bin/rspec'
sh 'docker run --rm -e BUNDLE_LOCKFILE=rails-6.1 inst_statsd bin/rspec'
sh 'docker run --rm -e BUNDLE_LOCKFILE=rails-7.0 inst_statsd bin/rspec'
sh 'docker run --rm -e BUNDLE_LOCKFILE=Gemfile.lock inst_statsd bin/rspec'
}
}
stage('Publish') {
when {
allOf {
expression { GERRIT_BRANCH == "master" }
environment name: "GERRIT_EVENT_TYPE", value: "change-merged"
}
}
steps {
withCredentials([string(credentialsId: 'rubygems-rw', variable: 'GEM_HOST_API_KEY')]) {
sh 'docker run -e GEM_HOST_API_KEY --rm inst_statsd /bin/bash -lc "./bin/publish.sh"'
}
}
}
}
post {
success {
dockerCacheStore(image: 'inst_statsd')
}
}
}