This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
65 lines (56 loc) · 1.5 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
#!/usr/bin/env groovy
@Library("liveramp-base@v1") _
pipeline {
options {
ansiColor('xterm')
disableConcurrentBuilds()
// This discards builds after there are either 50 unique builds
// or a build is older than 30 days
buildDiscarder(logRotator(numToKeepStr: '50', daysToKeepStr: '30'))
}
environment {
// SonarCloud access token for report upload
SONAR_TOKEN = credentials('sonar--jenkins-access-token')
IMAGE_TAG = "local-registry/ts-mutations"
}
triggers {
// Github hook to build whenever a commit is pushed
githubPush()
// This creates a trigger to run dependency builds
snapshotDependencies()
// Github hook to build whenever 'jenkins please' is in a comment on github
issueCommentTrigger('.*jenkins\\W+(((test|build|run|do)\\W+this)|again|git\\W+r\\W+done|please|make it so).*')
}
agent any
stages {
stage('Build image') {
steps {
sh 'docker build . -t $IMAGE_TAG'
}
}
stage('Execute tests') {
steps {
sh 'bin/jenkins/run-tests'
}
}
stage('Run SonarCloud Analysis'){
steps {
sshagent(credentials: ['ops-github--github.com']) {
withCredentials(bindings: [
file(
credentialsId: 'gcp-gcr--liveramp-jenkins',
variable: 'GOOGLE_APPLICATION_CREDENTIALS'
)
]) {
sh './bin/jenkins/sonarcloud'
}
}
}
}
}
post {
always {
sendNotifications {}
}
}
}