forked from mozilla/remo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
46 lines (41 loc) · 1.3 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
node('master'){
switch(env.BRANCH_NAME) {
case "master":
environment = "staging"
break
case "production":
environment = "production"
break
default:
print "Invalid branch"
currentBuild.result = "FAILURE"
throw err
break
}
type = 'group'
}
node('mesos') {
def image
def params
def app_id = "remo"
def dockerRegistry = "docker-registry.ops.mozilla.community:443"
stage('Prep') {
checkout scm
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
params = [string(name: 'environment', value: environment),
string(name: 'commit_id', value: gitCommit),
string(name: 'marathon_id', value: app_id),
string(name: 'marathon_config', value: 'remo_' + environment + '.json'),
string(name: 'type', value: 'group')]
}
stage('Build') {
image = docker.build(app_id + ":" + gitCommit, "-f docker/prod .")
}
stage('Push') {
sh "docker tag ${image.imageName()} " + dockerRegistry + "/${image.imageName()}"
sh "docker push " + dockerRegistry + "/${image.imageName()}"
}
stage('Deploy') {
build job: 'deploy-test', parameters: params
}
}