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'),
11 def Get_MDG(project) {
13 def values = project.split('/')
14 if ( values.size() > 1 ) {
17 // no prefix, likely just the project name then
21 def project_checkout() {
22 // checkout the project
23 git url: "https://osm.etsi.org/gerrit/${GERRIT_PROJECT}"
25 sh "git fetch origin ${GERRIT_REFSPEC}"
26 if (GERRIT_PATCHSET_REVISION.size() > 0 ) {
27 sh "git checkout -f ${GERRIT_PATCHSET_REVISION}"
31 def devops_checkout() {
33 git url: 'https://osm.etsi.org/gerrit/osm/devops'
38 mdg = Get_MDG("${GERRIT_PROJECT}")
39 println("MDG is ${mdg}")
41 if ( env.GERRIT_EVENT_TYPE != null ) {
42 // pipeline running from gerrit trigger.
43 // kickoff the downstream multibranch pipeline
44 def downstream_params = [
45 string(name: 'GERRIT_BRANCH', value: GERRIT_BRANCH),
46 string(name: 'GERRIT_PROJECT', value: GERRIT_PROJECT),
47 string(name: 'GERRIT_REFSPEC', value: GERRIT_REFSPEC),
48 string(name: 'GERRIT_PATCHSET_REVISION', value: GERRIT_PATCHSET_REVISION),
50 result = build job: "${mdg}/${GERRIT_BRANCH}", parameters: downstream_params, propagate: true
51 if (result.getResult() != 'SUCCESS') {
52 project = result.getProjectName()
53 build = result.getNumber()
54 error("${project} build ${build} failed")
67 container_name = "${GERRIT_PROJECT}-${GERRIT_BRANCH}"
69 stage('Docker-Build') {
70 sh "docker build -t ${container_name} ."
73 withDockerContainer("${container_name}") {
74 stage('Docker-Setup') {
76 groupadd -o -g $(id -g) -r jenkins
77 useradd -o -u $(id -u) --create-home -r -g jenkins jenkins
81 sh 'devops-stages/stage-test.sh'
84 sh 'devops-stages/stage-build.sh'
87 sh 'devops-stages/stage-archive.sh'
88 archiveArtifacts artifacts: "dists/**,pool/${mdg}/*.deb", fingerprint: true