forked from NVIDIA/spark-xgboost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.automerge
52 lines (46 loc) · 1.97 KB
/
Jenkinsfile.automerge
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
@Library('shared-libs') _
pipeline {
agent any
triggers { cron('H 3 * * *') }
parameters {
string(name: 'SOURCE_BRANCH', defaultValue: 'cudf-interop')
string(name: 'TARGET_BRANCH', defaultValue: 'nv-cudf-interop')
string(name: 'REF', defaultValue: 'nv-cudf-interop')
}
stages {
stage('Update Branch') {
steps {
withCredentials([sshUserPrivateKey(credentialsId:'svcngcc_pubpriv', keyFileVariable: 'SSH_KEY_FILE_PATH')]) {
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -i ${env.SSH_KEY_FILE_PATH}"]) {
script {
List<String> sourceChanged =
sh(returnStdout: true, script: "git diff --name-only origin/${params.SOURCE_BRANCH}..origin/${params.TARGET_BRANCH}").split()
if (sourceChanged.size()>0) {
echo "Changed files: ${sourceChanged}"
sh "git checkout ${params.TARGET_BRANCH}"
sh "git merge origin/${params.SOURCE_BRANCH}"
sh "git push origin ${params.TARGET_BRANCH}"
}
else{
echo "${params.TARGET_BRANCH} and ${params.SOURCE_BRANCH} match"
}
}
}
}
}
}
}
post {
always {
script {
if (currentBuild.currentResult == "SUCCESS") {
updateGitlabCommitStatus(name: 'Jenkins CI', state: "success")
slack("#rapidsai-spark-cicd", "Success", color: "#33CC33")
} else {
updateGitlabCommitStatus(name: 'Jenkins CI', state: "failed")
slack("#rapidsai-spark-cicd", "Failed", color: "#FF0000")
}
}
}
}
}