blob: b5af5550d30816ec84aed75dfc37204da8afa391 [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', \
20 forceSync: true,
21 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 Bavier64d4e902019-07-01 13:51:53 -070033 set -x
Andy Bavierc5178522018-12-12 15:36:30 -070034
Andy Bavier3fd92f02019-07-01 11:39:58 -070035 pushd cord/incubator/voltha
36 if [ "${params.manifestBranch}" == "master" ]
37 then
38 tag="latest"
39 else
40 tag="${params.manifestBranch}"
41 fi
42 VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=${tag} make build
43 popd
44 """
Andy Bavierc5178522018-12-12 15:36:30 -070045 }
46 }
47
48 stage('push'){
49 steps {
50 withDockerRegistry([credentialsId: 'docker-artifact-push-credentials', url: '']) {
51 sh """
52 #!/usr/bin/env bash
Andy Bavier64d4e902019-07-01 13:51:53 -070053 set -x
Andy Bavierc5178522018-12-12 15:36:30 -070054
55 pushd cord/incubator/voltha
Andy Bavier3fd92f02019-07-01 11:39:58 -070056 if [ "${params.manifestBranch}" == "master" ]
Andy Bavierf159a202019-03-21 16:01:24 -070057 then
Andy Bavier3fd92f02019-07-01 11:39:58 -070058 tag="latest"
Andy Bavierf159a202019-03-21 16:01:24 -070059 else
Andy Bavier3fd92f02019-07-01 11:39:58 -070060 tag="${params.manifestBranch}"
61 fi
62
63 if [ "${params.releaseTag}" != "" ]
64 then
65 VOLTHA_BUILD=docker TAG=${tag} TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.releaseTag} make push
66 else
67 VOLTHA_BUILD=docker TAG=${tag} TARGET_REPOSITORY=voltha/ TARGET_TAG=${tag} make push
Andy Bavierf159a202019-03-21 16:01:24 -070068 fi
Andy Bavierc5178522018-12-12 15:36:30 -070069 popd
70 """
71 }
72 }
73 }
74 }
75
76 post {
77 failure {
78 emailext (
79 subject: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS",
80 body: "Check console output at $BUILD_URL to view the results.",
81 to: "${params.failureEmail}"
82 )
83 }
84 }
85}