forked from aristanetworks/goarista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_deps.Jenkinsfile
54 lines (52 loc) · 1.81 KB
/
update_deps.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
def pipelinevars
// Select the SSH credentials for git operations managed by this pipeline.
def credentials = "jenkins-rsa-key"
pipeline {
options {
skipDefaultCheckout()
}
environment {
GOPATH = "${WORKSPACE}"
GOARISTA = "${GOPATH}/src/goarista"
GOCACHE = "/var/cache/jenkins/.gocache"
PATH = "PATH=${PATH}:${WORKSPACE}/bin:/usr/local/go/bin"
}
agent { label 'jenkins-agent-cloud' }
stages {
stage ("setup") {
steps {
sh "mkdir -p ${GOARISTA}"
sh "mkdir -p ${GOCACHE}"
sshagent (credentials: [credentials]) {
dir("${GOARISTA}") {
git url: 'ssh://jenkins@gerrit.corp.arista.io:29418/goarista',
credentialsId: credentials
sh "git config user.name 'Arista Jenkins'"
sh "git config user.email jenkins@arista.com"
sh "scp -o BatchMode=yes -p -P 29418 jenkins@gerrit.corp.arista.io:hooks/commit-msg .git/hooks/"
}
}
script {
pipelinevars = load "${GOARISTA}/pipelinevars.groovy"
}
}
}
stage("update deps") {
agent { docker reuseNode: true, image: "${pipelinevars.goimage}" }
steps {
sshagent (credentials: [credentials]) {
dir("${GOARISTA}") {
sh "PATH=${env.PATH} ./update_deps.sh"
}
}
}
}
stage ("push") {
steps {
sshagent (credentials: [credentials]) {
dir("${GOARISTA}") { sh "git push origin HEAD:refs/for/master" }
}
}
}
}
}