github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/toGit.Jenkinsfile (about)

     1  // Used to forward gerrit commits to public github. yaml config found in
     2  // ardc-config/ops/ansible/inventories/infra/files/jenkins_controller/cvp/jobs/arista-go-github.yml
     3  pipeline {
     4      agent { label 'jenkins-agent-cloud' }
     5      stages {
     6          stage('Mirror to Github') {
     7              steps {
     8                  checkout([
     9                      $class: 'GitSCM',
    10                      branches: [[name: '*/master']],
    11                      extensions: [
    12                          [$class: 'CleanBeforeCheckout'],
    13                      ],
    14                      userRemoteConfigs: [[
    15                          url: 'https://gerrit.corp.arista.io/goarista',
    16                      ]],
    17                  ])
    18                  sshagent (credentials: ['jenkins-rsa-key']) {
    19                      // Nodes by default don't have a .ssh folder
    20                      sh 'if [ ! -d "~/.ssh" ]; then mkdir ~/.ssh; fi'
    21                      sh 'if ! grep -q github.com ~/.ssh/known_hosts; then ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts; fi'
    22                      sh 'git push git@github.com:aristanetworks/goarista.git HEAD:master'
    23                  }
    24              }
    25          }
    26      }
    27  }