github.com/fafucoder/cilium@v1.6.11/jenkinsfiles/Jenkinsfile.nightly (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 GOPATH = "${WORKSPACE}" 37 TESTDIR = "${WORKSPACE}/${PROJ_PATH}/test" 38 SERVER_BOX = "cilium/ubuntu" 39 NIGHTLY_TAG = "${new Date().format("yyyyMMdd")}-${BUILD_NUMBER}" 40 } 41 42 options { 43 timeout(time: 700, unit: 'MINUTES') 44 timestamps() 45 ansiColor('xterm') 46 } 47 48 stages { 49 stage('Checkout') { 50 steps { 51 Status("PENDING", "$JOB_BASE_NAME") 52 sh 'env' 53 sh 'rm -rf src; mkdir -p src/github.com/cilium' 54 sh 'ln -s $WORKSPACE src/github.com/cilium/cilium' 55 checkout scm 56 sh '/usr/local/bin/cleanup || true' 57 } 58 } 59 stage('Preload vagrant boxes') { 60 steps { 61 sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb' 62 } 63 post { 64 unsuccessful { 65 script { 66 if (!currentBuild.displayName.contains('fail')) { 67 currentBuild.displayName = 'preload vagrant boxes fail' + currentBuild.displayName 68 } 69 } 70 } 71 } 72 } 73 stage('Nightly-Docker-Image') { 74 when { 75 environment name: 'GIT_BRANCH', value: 'origin/master' 76 } 77 steps { 78 withDockerRegistry([ credentialsId: "NIGHTLY_DOCKER_HUB_CRED", url: "" ]) { 79 sh 'make docker-image' 80 sh 'docker tag cilium/cilium:latest cilium/nightly:latest' 81 sh 'docker tag cilium/nightly:latest cilium/nightly:${NIGHTLY_TAG}' 82 sh 'docker push cilium/nightly:${NIGHTLY_TAG}' 83 sh 'docker push cilium/nightly:latest' 84 } 85 } 86 } 87 stage('Nightly-Tests') { 88 environment { 89 K8S_NODES=4 90 K8S_VERSION=1.12 91 MEMORY=4096 92 CPU=4 93 FAILFAST=setIfLabel("ci/fail-fast", "true", "false") 94 } 95 96 options { 97 timeout(time: 460, unit: 'MINUTES') 98 } 99 100 steps { 101 parallel( 102 "Nightly":{ 103 sh 'cd ${TESTDIR}; ginkgo --focus="Nightly*" -v --failFast=${FAILFAST} -- -cilium.timeout=450m' 104 }, 105 ) 106 } 107 post { 108 always { 109 sh 'cd test/; ./post_build_agent.sh || true' 110 sh 'cd test/; vagrant destroy -f || true' 111 sh 'cd test/; ./archive_test_results.sh || true' 112 archiveArtifacts artifacts: '*.zip' 113 junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'test/*.xml' 114 } 115 } 116 } 117 } 118 post { 119 always { 120 sh "cd ${TESTDIR}; K8S_VERSION=1.12 vagrant destroy -f || true" 121 sh "cd ${TESTDIR}; vagrant destroy -f || true" 122 sh 'cd ${TEST_DIR}; ./post_build_agent.sh || true' 123 cleanWs() 124 sh '/usr/local/bin/cleanup || true' 125 } 126 success { 127 Status("SUCCESS", "$JOB_BASE_NAME") 128 } 129 failure { 130 Status("FAILURE", "$JOB_BASE_NAME") 131 } 132 } 133 }