2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
6 http://www.apache.org/licenses/LICENSE-2.0
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 See the License for the specific language governing permissions and
13 limitations under the License.
17 string(defaultValue: env.BRANCH_NAME, description: '', name: 'GERRIT_BRANCH'),
18 string(defaultValue: 'osm/NBI', description: '', name: 'GERRIT_PROJECT'),
19 string(defaultValue: env.GERRIT_REFSPEC, description: '', name: 'GERRIT_REFSPEC'),
20 string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'),
21 string(defaultValue: env.GERRIT_EVENT_TYPE, description: '', name: 'GERRIT_EVENT_TYPE'),
22 string(defaultValue: 'https://osm.etsi.org/gerrit', description: '', name: 'PROJECT_URL_PREFIX'),
23 booleanParam(defaultValue: false, description: '', name: 'TEST_INSTALL'),
24 string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
25 string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'),
29 def devops_checkout() {
31 git url: "${PROJECT_URL_PREFIX}/osm/devops", branch: params.GERRIT_BRANCH
36 stage('CURRENT PIPELINE') {
40 ci_stage_2 = load "devops/jenkins/ci-pipelines/ci_stage_2.groovy"
41 ci_stage_2.ci_pipeline('NBI',
42 params.PROJECT_URL_PREFIX,
43 params.GERRIT_PROJECT,
45 params.GERRIT_REFSPEC,
46 params.GERRIT_PATCHSET_REVISION,
47 // params.TEST_INSTALL,
49 params.ARTIFACTORY_SERVER)
51 stage('NEW PIPELINE') {
52 // a devops changes in new-pipeline branch is required to receive GERRIT_EVENT_TYPE
53 // https://osm.etsi.org/gerrit/#/c/osm/devops/+/9701/
54 // Meanwhile, stage_name is predefined
55 def stage_name = "patchset"
57 switch(GERRIT_EVENT_TYPE) {
62 case "patchset-created":
63 stage_name = "patchset"
68 println("No gerrit event found")
71 def downstream_params = [
72 string(name: 'GERRIT_BRANCH', value: params.GERRIT_BRANCH),
73 string(name: 'GERRIT_PROJECT', value: params.GERRIT_PROJECT),
74 string(name: 'GERRIT_REFSPEC', value: params.GERRIT_REFSPEC),
75 string(name: 'GERRIT_PATCHSET_REVISION', value: params.GERRIT_PATCHSET_REVISION),
76 string(name: 'PROJECT_URL_PREFIX', value: params.PROJECT_URL_PREFIX),
77 booleanParam(name: 'TEST_INSTALL', value: params.TEST_INSTALL),
78 // next params will have to be updated with the proper values
79 string(name: 'IMAGENAME', value: 'opensourcemano/nbi'),
80 string(name: 'DOCKER_REGISTRY', value: 'localhost:5000'),
81 string(name: 'DOCKER_REGISTRY_PROTOCOL', value: 'http://'),
82 string(name: 'DOCKER_CREDENTIALS', value: '')
85 downstream_job_name = "NBI-${stage_name}"
86 echo "Triggering NEW PIPELINE"
87 build job: "${downstream_job_name}", parameters: downstream_params
88 // build job: "${downstream_job_name}", parameters: downstream_params, propagate: true
89 // It calls the new pipeline defined in Jenkinsfile.new
91 //build job: '<Job name>', parameters: [[$class: 'StringParameterValue', name: 'param1', value: 'test_param']]