forked from aristanetworks/goarista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toGit.Jenkinsfile
27 lines (27 loc) · 1.12 KB
/
toGit.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
// Used to forward gerrit commits to public github. yaml config found in
// ardc-config/ops/ansible/inventories/infra/files/jenkins_controller/cvp/jobs/arista-go-github.yml
pipeline {
agent { label 'jenkins-agent-cloud' }
stages {
stage('Mirror to Github') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: '*/master']],
extensions: [
[$class: 'CleanBeforeCheckout'],
],
userRemoteConfigs: [[
url: 'https://gerrit.corp.arista.io/goarista',
]],
])
sshagent (credentials: ['jenkins-rsa-key']) {
// Nodes by default don't have a .ssh folder
sh 'if [ ! -d "~/.ssh" ]; then mkdir ~/.ssh; fi'
sh 'if ! grep -q github.com ~/.ssh/known_hosts; then ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts; fi'
sh 'git push [email protected]:aristanetworks/goarista.git HEAD:master'
}
}
}
}
}