Fixup path 83/10583/4
authorbeierlm <mark.beierl@canonical.com>
Tue, 6 Apr 2021 17:51:33 +0000 (13:51 -0400)
committerbeierlm <mark.beierl@canonical.com>
Tue, 6 Apr 2021 19:42:44 +0000 (15:42 -0400)
Specify correct location of pre-merge software to stage.
Runs commands without -l (login) so the environment is preserved.

Change-Id: I226cdfd62bcb40f65dbe5977d1a4b78d2e5fe061
Signed-off-by: beierlm <mark.beierl@canonical.com>
Dockerfile
jenkins/ci-pipelines/ci_stage_2.groovy
jenkins/ci-pipelines/ci_stage_3.groovy

index c3297da..5717b7a 100644 (file)
@@ -26,6 +26,8 @@
 
 FROM ubuntu:18.04
 ENV LANG en_IN.UTF-8
+ENV LC_ALL en_IN.UTF-8
+ENV LANGUAGE en_IN.UTF-8
 
 RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
     DEBIAN_FRONTEND=noninteractive apt-get -y install \
index 4edbd2b..379ecbd 100644 (file)
@@ -63,7 +63,7 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa
             sh "useradd -o -u $UID -d `pwd` -r -g jenkins jenkins"
             sh "echo '#! /bin/sh' > /usr/bin/mesg"
             sh "chmod 755 /usr/bin/mesg"
-            sh "runuser -l jenkins -c devops-stages/stage-test.sh"
+            sh "runuser jenkins -c devops-stages/stage-test.sh"
             if (fileExists('coverage.xml')) {
                 cobertura coberturaReportFile: 'coverage.xml'
             }
@@ -73,13 +73,13 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa
         }
         stage('Build') {
             sh(returnStdout:true,
-                script: "runuser -l $USER -c devops-stages/stage-build.sh").trim()
+                script: "runuser jenkins -c devops-stages/stage-build.sh").trim()
         }
         stage('Archive') {
-            sh "runuser -l jenkins -c 'mkdir -p changelog'"
-            sh "runuser -l jenkins -c \"tools/generatechangelog-pipeline.sh > changelog/changelog-${mdg}.html\""
+            sh "runuser jenkins -c 'mkdir -p changelog'"
+            sh "runuser jenkins -c \"devops/tools/generatechangelog-pipeline.sh > changelog/changelog-${mdg}.html\""
             sh(returnStdout:true,
-                script: "runuser -l jenkins -c devops-stages/stage-archive.sh").trim()
+                script: "runuser jenkins -c devops-stages/stage-archive.sh").trim()
             ci_helper.archive(artifactory_server,mdg,branch,'untested')
         }
     }
index d7175b8..6368381 100644 (file)
@@ -201,21 +201,25 @@ node("${params.NODE}") {
 
                         step ([$class: 'CopyArtifact',
                                projectName: "${params.UPSTREAM_JOB_NAME}",
-                               selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
+                               selector: [$class: 'SpecificBuildSelector',
+                               buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
                               ])
 
-                        upstreamComponent = ci_helper.get_mdg_from_project(ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
-
-                        // the upstream job name contains suffix with the project. Need this stripped off
-                        def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
-                        def packages = ci_helper.get_archive(params.ARTIFACTORY_SERVER,
-                            upstreamComponent,
-                            GERRIT_BRANCH,
-                            "${project_without_branch} :: ${GERRIT_BRANCH}",
-                            ci_helper.get_env_value('build.env','BUILD_NUMBER'))
-
-                        packageList.addAll(packages)
-                        println("${params.UPSTREAM_JOB_NAME}: ${packages}")
+                        upstreamComponent = ci_helper.get_mdg_from_project(
+                            ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
+                        def buildNumber = ci_helper.get_env_value('build.env','BUILD_NUMBER')
+                        dir("$upstreamComponent") {
+                            // the upstream job name contains suffix with the project. Need this stripped off
+                            def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
+                            def packages = ci_helper.get_archive(params.ARTIFACTORY_SERVER,
+                                upstreamComponent,
+                                GERRIT_BRANCH,
+                                "${project_without_branch} :: ${GERRIT_BRANCH}",
+                                buildNumber)
+
+                            packageList.addAll(packages)
+                            println("Fetched pre-merge ${params.UPSTREAM_JOB_NAME}: ${packages}")
+                        }
                     }
 
                     parallelSteps = [:]
@@ -247,15 +251,14 @@ node("${params.NODE}") {
                     parallel parallelSteps
 
 ///////////////////////////////////////////////////////////////////////////////////////
-// Create APT repository
+// Create Devops APT repository
 ///////////////////////////////////////////////////////////////////////////////////////
-                    for ( component in [ "devops" ] ) {
-                        sh "mv ${component}/pool/${component} pool"
-                        sh "dpkg-sig --sign builder -k ${GPG_KEY_NAME} pool/${component}/*"
-                        sh "mkdir -p dists/${params.REPO_DISTRO}/${component}/binary-amd64/"
-                        sh "apt-ftparchive packages pool/${component} > dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
-                        sh "gzip -9fk dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
-                    }
+                    sh "mv devops/pool/ pool"
+                    sh "dpkg-sig --sign builder -k ${GPG_KEY_NAME} pool/devops/*"
+                    sh "mkdir -p dists/${params.REPO_DISTRO}/devops/binary-amd64/"
+                    sh "apt-ftparchive packages pool/devops > dists/${params.REPO_DISTRO}/devops/binary-amd64/Packages"
+                    sh "gzip -9fk dists/${params.REPO_DISTRO}/devops/binary-amd64/Packages"
+
                     // create and sign the release file
                     sh "apt-ftparchive release dists/${params.REPO_DISTRO} > dists/${params.REPO_DISTRO}/Release"
                     sh "gpg --yes -abs -u ${GPG_KEY_NAME} -o dists/${params.REPO_DISTRO}/Release.gpg dists/${params.REPO_DISTRO}/Release"