blob: 4d3e65a68ee33d8fa704939a2834caef0a27ae3c [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 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
37 tag="latest"
38 else
39 tag="${params.manifestBranch}"
40 fi
41 VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=${tag} make build
42 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 Bavier3fd92f02019-07-01 11:39:58 -070056 tag="latest"
Andy Bavierf159a202019-03-21 16:01:24 -070057 else
Andy Bavier3fd92f02019-07-01 11:39:58 -070058 tag="${params.manifestBranch}"
59 fi
60
61 if [ "${params.releaseTag}" != "" ]
62 then
63 VOLTHA_BUILD=docker TAG=${tag} TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.releaseTag} make push
64 else
65 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}