blob: b7c8b266431187b54647e78fc573789627dabc3e [file] [log] [blame]
Andy Bavierc5178522018-12-12 15:36:30 -07001/* voltha-publish pipeline */
2pipeline {
3
4 /* no label, executor is determined by JJB */
5 agent {
6 label "${params.executorNode}"
7 }
8 stages {
9
10 stage('repo') {
11 steps {
12 checkout(changelog: false, \
13 poll: false,
14 scm: [$class: 'RepoScm', \
15 manifestRepositoryUrl: "${params.manifestUrl}", \
16 manifestBranch: "${params.manifestBranch}", \
Andy Bavierda0d6ba2018-12-13 13:06:37 -070017 manifestGroup: 'voltha', \
Andy Bavierc5178522018-12-12 15:36:30 -070018 currentBranch: true, \
19 destinationDir: 'cord', \
Andy Bavierf88fa092019-07-01 14:51:49 -070020 forceSync: true, \
Andy Bavierc5178522018-12-12 15:36:30 -070021 resetFirst: true, \
22 quiet: true, \
23 jobs: 4, \
24 showAllChanges: true] \
25 )
26 }
27 }
28
29 stage('build'){
30 steps {
31 sh """
Andy Bavier3fd92f02019-07-01 11:39:58 -070032 #!/usr/bin/env bash
Andy Bavierc5178522018-12-12 15:36:30 -070033
Andy Bavier3fd92f02019-07-01 11:39:58 -070034 pushd cord/incubator/voltha
35 if [ "${params.manifestBranch}" == "master" ]
36 then
Andy Bavierf88fa092019-07-01 14:51:49 -070037 TAG="latest"
Andy Bavier3fd92f02019-07-01 11:39:58 -070038 else
Andy Bavierf88fa092019-07-01 14:51:49 -070039 TAG="${params.manifestBranch}"
Andy Bavier3fd92f02019-07-01 11:39:58 -070040 fi
Andy Bavierf88fa092019-07-01 14:51:49 -070041 VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=\$TAG make build
Andy Bavier3fd92f02019-07-01 11:39:58 -070042 popd
43 """
Andy Bavierc5178522018-12-12 15:36:30 -070044 }
45 }
46
47 stage('push'){
48 steps {
49 withDockerRegistry([credentialsId: 'docker-artifact-push-credentials', url: '']) {
50 sh """
51 #!/usr/bin/env bash
52
53 pushd cord/incubator/voltha
Andy Bavier3fd92f02019-07-01 11:39:58 -070054 if [ "${params.manifestBranch}" == "master" ]
Andy Bavierf159a202019-03-21 16:01:24 -070055 then
Andy Bavierf88fa092019-07-01 14:51:49 -070056 TAG="latest"
Andy Bavierf159a202019-03-21 16:01:24 -070057 else
Andy Bavierf88fa092019-07-01 14:51:49 -070058 TAG="${params.manifestBranch}"
Andy Bavier3fd92f02019-07-01 11:39:58 -070059 fi
60
61 if [ "${params.releaseTag}" != "" ]
62 then
Andy Bavierf88fa092019-07-01 14:51:49 -070063 VOLTHA_BUILD=docker TAG=\$TAG TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.releaseTag} make push
Andy Bavier3fd92f02019-07-01 11:39:58 -070064 else
Andy Bavierf88fa092019-07-01 14:51:49 -070065 VOLTHA_BUILD=docker TAG=\$TAG TARGET_REPOSITORY=voltha/ TARGET_TAG=\$TAG make push
Andy Bavierf159a202019-03-21 16:01:24 -070066 fi
Andy Bavierc5178522018-12-12 15:36:30 -070067 popd
68 """
69 }
70 }
71 }
72 }
73
74 post {
75 failure {
76 emailext (
77 subject: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS",
78 body: "Check console output at $BUILD_URL to view the results.",
79 to: "${params.failureEmail}"
80 )
81 }
82 }
83}