blob: 2abcf494de571bf6101317bd3a9f361368277bad [file] [log] [blame]
Joey Armstrong775a20f2022-12-02 12:55:43 -05001// Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
You Wang5c15a7a2020-04-02 11:24:33 -07002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
You Wangd78fec62021-02-08 16:07:46 -080015// Builds and publishes OMEC docker images. Triggered by GitHub PR merge.
You Wang5c15a7a2020-04-02 11:24:33 -070016
You Wang5c15a7a2020-04-02 11:24:33 -070017
18pipeline {
19
20 agent {
21 label "${params.buildNode}"
22 }
23
You Wang40239452020-06-11 20:17:15 -070024 stages {
25 stage('Build and Publish') {
You Wang5c15a7a2020-04-02 11:24:33 -070026 steps {
Jeremy Ronquillod91e3082020-04-09 11:32:41 -070027 script {
You Wang425d49f2020-07-29 21:43:28 -070028 build_job_name = "docker-publish-github_$repoName"
29 if ("${repoName}" == "spgw"){
30 build_job_name = "aether-member-only-jobs/" + build_job_name
31 }
Jeremy Ronquillod91e3082020-04-09 11:32:41 -070032 abbreviated_commit_hash = commitHash.substring(0, 7)
Jeremy Ronquillo6e42f8c2020-04-27 14:13:51 -070033 tags_to_build = [ "${branchName}-latest",
You Wang7673e482020-09-18 16:33:34 -070034 "${branchName}-${abbreviated_commit_hash}" ]
35 env_vars = [ "", "" ]
36 if ("${repoName}" == "upf-epc"){
37 tags_to_build += [ "${branchName}-latest-ivybridge",
38 "${branchName}-${abbreviated_commit_hash}-ivybridge" ]
39 env_vars = [ "CPU=haswell", "CPU=haswell", "CPU=ivybridge", "CPU=ivybridge" ]
Jeremy Ronquillo6e42f8c2020-04-27 14:13:51 -070040 }
You Wang7673e482020-09-18 16:33:34 -070041 def builds = [:]
42 for(i = 0; i < tags_to_build.size(); i += 1) {
43 def tag_to_build = tags_to_build[i]
44 def env_var = env_vars[i]
45 builds["${build_job_name}${i}"] = {
46 build job: "${build_job_name}", parameters: [
47 string(name: 'gitUrl', value: "${repoUrl}"),
48 string(name: 'gitRef', value: "${branchName}"),
49 string(name: 'branchName', value: tag_to_build),
50 string(name: 'projectName', value: "${repoName}"),
51 string(name: 'extraEnvironmentVars', value: env_var),
52 ]
53 }
54 }
55 parallel builds
Jeremy Ronquillod91e3082020-04-09 11:32:41 -070056 }
You Wang5c15a7a2020-04-02 11:24:33 -070057 }
58 }
You Wang5c15a7a2020-04-02 11:24:33 -070059 }
60 post {
61 failure {
62 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${params.maintainers}", sendToIndividuals: false])
63 }
64 }
65}