github.com/datadog/cilium@v1.6.12/jenkinsfiles/kubernetes-upstream.Jenkinsfile (about)

     1  @Library('cilium') _
     2  
     3  pipeline {
     4      agent {
     5          label 'baremetal'
     6      }
     7  
     8      parameters {
     9          string(defaultValue: '${ghprbPullDescription}', name: 'ghprbPullDescription')
    10          string(defaultValue: '${ghprbActualCommit}', name: 'ghprbActualCommit')
    11          string(defaultValue: '${ghprbTriggerAuthorLoginMention}', name: 'ghprbTriggerAuthorLoginMention')
    12          string(defaultValue: '${ghprbPullAuthorLoginMention}', name: 'ghprbPullAuthorLoginMention')
    13          string(defaultValue: '${ghprbGhRepository}', name: 'ghprbGhRepository')
    14          string(defaultValue: '${ghprbPullLongDescription}', name: 'ghprbPullLongDescription')
    15          string(defaultValue: '${ghprbCredentialsId}', name: 'ghprbCredentialsId')
    16          string(defaultValue: '${ghprbTriggerAuthorLogin}', name: 'ghprbTriggerAuthorLogin')
    17          string(defaultValue: '${ghprbPullAuthorLogin}', name: 'ghprbPullAuthorLogin')
    18          string(defaultValue: '${ghprbTriggerAuthor}', name: 'ghprbTriggerAuthor')
    19          string(defaultValue: '${ghprbCommentBody}', name: 'ghprbCommentBody')
    20          string(defaultValue: '${ghprbPullTitle}', name: 'ghprbPullTitle')
    21          string(defaultValue: '${ghprbPullLink}', name: 'ghprbPullLink')
    22          string(defaultValue: '${ghprbAuthorRepoGitUrl}', name: 'ghprbAuthorRepoGitUrl')
    23          string(defaultValue: '${ghprbTargetBranch}', name: 'ghprbTargetBranch')
    24          string(defaultValue: '${ghprbPullId}', name: 'ghprbPullId')
    25          string(defaultValue: '${ghprbActualCommitAuthor}', name: 'ghprbActualCommitAuthor')
    26          string(defaultValue: '${ghprbActualCommitAuthorEmail}', name: 'ghprbActualCommitAuthorEmail')
    27          string(defaultValue: '${ghprbTriggerAuthorEmail}', name: 'ghprbTriggerAuthorEmail')
    28          string(defaultValue: '${GIT_BRANCH}', name: 'GIT_BRANCH')
    29          string(defaultValue: '${ghprbPullAuthorEmail}', name: 'ghprbPullAuthorEmail')
    30          string(defaultValue: '${sha1}', name: 'sha1')
    31          string(defaultValue: '${ghprbSourceBranch}', name: 'ghprbSourceBranch')
    32      }
    33  
    34      environment {
    35          PROJ_PATH = "src/github.com/cilium/cilium"
    36          TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
    37          MEMORY = "5120"
    38          K8S_VERSION="1.16"
    39          SERVER_BOX = "cilium/ubuntu"
    40          CNI_INTEGRATION=setIfLabel("integration/cni-flannel", "FLANNEL", "")
    41      }
    42  
    43      options {
    44          timeout(time: 180, unit: 'MINUTES')
    45          timestamps()
    46          ansiColor('xterm')
    47      }
    48  
    49      stages {
    50          stage('Checkout') {
    51              steps {
    52                  sh 'env'
    53                  Status("PENDING", "${env.JOB_NAME}")
    54                  sh 'rm -rf src; mkdir -p src/github.com/cilium'
    55                  sh 'ln -s $WORKSPACE src/github.com/cilium/cilium'
    56                  checkout scm
    57                  sh '/usr/local/bin/cleanup || true'
    58              }
    59          }
    60          stage('Preload vagrant boxes'){
    61              options {
    62                  timeout(time: 20, unit: 'MINUTES')
    63              }
    64  
    65              steps {
    66                  sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'
    67              }
    68          }
    69          stage('Boot VMs'){
    70              options {
    71                  timeout(time: 60, unit: 'MINUTES')
    72              }
    73  
    74              steps {
    75                  retry(3){
    76                      sh 'cd ${TESTDIR}; vagrant destroy k8s1-${K8S_VERSION} --force'
    77                      sh 'cd ${TESTDIR}; vagrant destroy k8s2-${K8S_VERSION} --force'
    78                      sh 'cd ${TESTDIR}; vagrant up k8s1-${K8S_VERSION}'
    79                      sh 'cd ${TESTDIR}; vagrant up k8s2-${K8S_VERSION}'
    80                  }
    81              }
    82          }
    83  
    84          stage('BDD-tests'){
    85              options {
    86                  timeout(time: 45, unit: 'MINUTES')
    87              }
    88  
    89              steps {
    90                  sh 'cd ${TESTDIR}; vagrant ssh k8s1-${K8S_VERSION} -c "cd /home/vagrant/go/${PROJ_PATH}; ./test/kubernetes-test.sh"'
    91              }
    92          }
    93  
    94          stage('Netperf tests'){
    95  
    96              when {
    97                  environment name: 'GIT_BRANCH', value: 'origin/master'
    98              }
    99  
   100              options {
   101                  timeout(time: 120, unit: 'MINUTES')
   102              }
   103  
   104              environment {
   105                  PROMETHEUS_URL="https://metrics.cilium.io/metrics/job/upstream_job"
   106                  PROMETHEUS=credentials("metrics")
   107              }
   108  
   109              steps {
   110                  sh '''
   111                      cd ${TESTDIR}; vagrant ssh k8s1-${K8S_VERSION} -c "
   112                          cd /home/vagrant/go/${PROJ_PATH}/test;
   113                          ./kubernetes-netperftest.sh '$PROMETHEUS_URL' '$PROMETHEUS_USR' '$PROMETHEUS_PSW'"
   114                  '''
   115              }
   116          }
   117      }
   118      post {
   119          always {
   120              sh 'cd ${TESTDIR}; K8S_VERSION=${K8S_VERSION} vagrant destroy -f || true'
   121              cleanWs()
   122              sh '/usr/local/bin/cleanup || true'
   123          }
   124          success {
   125              Status("SUCCESS", "$JOB_BASE_NAME")
   126          }
   127          failure {
   128              Status("FAILURE", "$JOB_BASE_NAME")
   129          }
   130      }
   131  }