-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathupdate_deps.Jenkinsfile
54 lines (52 loc) · 1.92 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://[email protected]:29418/goarista',
credentialsId: credentials
sh "git config user.name 'Arista Jenkins'"
sh "git config user.email [email protected]"
sh "mkdir -p `git rev-parse --git-dir`/hooks/ && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit.corp.arista.io/tools/hooks/commit-msg && chmod +x `git rev-parse --git-dir`/hooks/commit-msg"
}
}
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" }
}
}
}
}
}