3 string(defaultValue: env.GERRIT_BRANCH, description: '', name: 'GERRIT_BRANCH'),
4 string(defaultValue: env.GERRIT_PROJECT, description: '', name: 'GERRIT_PROJECT'),
5 string(defaultValue: env.GERRIT_REFSPEC, description: '', name: 'GERRIT_REFSPEC'),
6 string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'),
10 def Get_MDG(project) {
12 def values = project.split('/')
13 if ( values.size() > 1 ) {
16 // no prefix, likely just the project name then
20 def project_checkout() {
21 // checkout the project
22 git url: "https://osm.etsi.org/gerrit/${GERRIT_PROJECT}"
24 sh "git fetch origin ${GERRIT_REFSPEC}"
25 if (GERRIT_PATCHSET_REVISION.size() > 0 ) {
26 sh "git checkout -f ${GERRIT_PATCHSET_REVISION}"
30 def devops_checkout() {
32 git url: 'https://osm.etsi.org/gerrit/osm/devops'
37 mdg = Get_MDG("${GERRIT_PROJECT}")
38 println("MDG is ${mdg}")
40 if ( env.GERRIT_EVENT_TYPE != null ) {
41 // pipeline running from gerrit trigger.
42 // kickoff the downstream multibranch pipeline
43 def downstream_params = [
44 string(name: 'GERRIT_BRANCH', value: GERRIT_BRANCH),
45 string(name: 'GERRIT_PROJECT', value: GERRIT_PROJECT),
46 string(name: 'GERRIT_REFSPEC', value: GERRIT_REFSPEC),
47 string(name: 'GERRIT_PATCHSET_REVISION', value: GERRIT_PATCHSET_REVISION),
49 result = build job: "${mdg}/${GERRIT_BRANCH}", parameters: downstream_params, propagate: true
50 if (result.getResult() != 'SUCCESS') {
51 project = result.getProjectName()
52 build = result.getNumber()
53 error("${project} build ${build} failed")
66 container_name = "${GERRIT_PROJECT}-${GERRIT_BRANCH}"
68 stage('Docker-Build') {
69 sh "docker build -t ${container_name} ."
72 withDockerContainer("${container_name}") {
73 stage('Docker-Setup') {
75 groupadd -o -g $(id -g) -r jenkins
76 useradd -o -u $(id -u) --create-home -r -g jenkins jenkins
80 sh 'devops-stages/stage-test.sh'
83 sh 'devops-stages/stage-build.sh'
86 sh 'devops-stages/stage-archive.sh'
87 archiveArtifacts artifacts: "dists/**,pool/${mdg}/*.deb", fingerprint: true