Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 1 | /* voltha-publish pipeline */ |
| 2 | pipeline { |
| 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 Bavier | da0d6ba | 2018-12-13 13:06:37 -0700 | [diff] [blame] | 17 | manifestGroup: 'voltha', \ |
Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 18 | currentBranch: true, \ |
| 19 | destinationDir: 'cord', \ |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 20 | forceSync: true, \ |
Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 21 | resetFirst: true, \ |
| 22 | quiet: true, \ |
| 23 | jobs: 4, \ |
| 24 | showAllChanges: true] \ |
| 25 | ) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | stage('build'){ |
| 30 | steps { |
| 31 | sh """ |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 32 | #!/usr/bin/env bash |
Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 33 | |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 34 | pushd cord/incubator/voltha |
| 35 | if [ "${params.manifestBranch}" == "master" ] |
| 36 | then |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 37 | TAG="latest" |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 38 | else |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 39 | TAG="${params.manifestBranch}" |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 40 | fi |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 41 | VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=\$TAG make build |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 42 | popd |
| 43 | """ |
Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 44 | } |
| 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 Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 54 | if [ "${params.manifestBranch}" == "master" ] |
Andy Bavier | f159a20 | 2019-03-21 16:01:24 -0700 | [diff] [blame] | 55 | then |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 56 | TAG="latest" |
Andy Bavier | f159a20 | 2019-03-21 16:01:24 -0700 | [diff] [blame] | 57 | else |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 58 | TAG="${params.manifestBranch}" |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 59 | fi |
| 60 | |
Andy Bavier | 46c6e19 | 2019-07-09 08:05:48 -0700 | [diff] [blame] | 61 | # Check for SemVer in VERSION (only numbers and dots) |
| 62 | RELEASETAG=\$(cat voltha/VERSION|tr -d ' '|egrep '^[0-9]+(\\.[0-9]+)*\$'||true) |
Andy Bavier | 5e50f15 | 2019-07-02 16:36:04 -0700 | [diff] [blame] | 63 | if [ "\$RELEASETAG" != "" ] |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 64 | then |
Andy Bavier | 5e50f15 | 2019-07-02 16:36:04 -0700 | [diff] [blame] | 65 | VOLTHA_BUILD=docker TAG=\$TAG TARGET_REPOSITORY=voltha/ TARGET_TAG=\$RELEASETAG make push |
Andy Bavier | 3fd92f0 | 2019-07-01 11:39:58 -0700 | [diff] [blame] | 66 | else |
Andy Bavier | f88fa09 | 2019-07-01 14:51:49 -0700 | [diff] [blame] | 67 | VOLTHA_BUILD=docker TAG=\$TAG TARGET_REPOSITORY=voltha/ TARGET_TAG=\$TAG make push |
Andy Bavier | f159a20 | 2019-03-21 16:01:24 -0700 | [diff] [blame] | 68 | fi |
Andy Bavier | c517852 | 2018-12-12 15:36:30 -0700 | [diff] [blame] | 69 | 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 | } |