This repository was archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile.groovy
60 lines (45 loc) · 1.71 KB
/
Jenkinsfile.groovy
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
#!groovy
@Library('jenkins-shared-lib') _
node('jenkins-slave-1') {
useNodeWithVersion("12")
ansiColor('xterm') {
shouldBuildSkip = false
def isMaster = "master" == env.BRANCH_NAME
def isPR = !!env.CHANGE_ID
if (!isMaster && !isPR) {
stage('Skip build') {
printout "Skipping Build of branch $env.BRANCH_NAME: Neither master nor PR."
currentBuild.result = 'SUCCESS'
}
return
}
stage('Git checkout') {
def scmVars = checkout scm
shouldBuildSkip = shouldBuildAbort(scmVars)
if (shouldBuildSkip) {
printout "Skipping Build of branch $env.BRANCH_NAME"
currentBuild.result = 'SUCCESS'
stage ("Eat MunchBot") {}
stage ("Terraform - Prod") {}
return
}
stage("Eat MunchBot") {
withCredentials([
[$class : 'FileBinding',
credentialsId: 'npmrc-springmedia-github-packages',
variable : 'NPMRC']
]) {
sshagent(credentials: ['github-sshkey-ep-tech-user']) {
sh 'cp -f $NPMRC .npmrc'
sh "mkdir -p ~/.ssh/"
sh "ssh-keyscan github.com >> ~/.ssh/known_hosts"
sh 'yarn install; yarn run test; yarn run build'
}
}
}
stage('Terraform - Prod') {
terraformDeployment("terraform", "base prod")
}
}
}
}