From f1f5b7660c3cebb57f9cdfd596734443b83fa6c4 Mon Sep 17 00:00:00 2001 From: beierlm Date: Tue, 6 Apr 2021 13:51:33 -0400 Subject: [PATCH] Fixup path 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 --- Dockerfile | 2 ++ jenkins/ci-pipelines/ci_stage_2.groovy | 10 +++--- jenkins/ci-pipelines/ci_stage_3.groovy | 45 ++++++++++++++------------ 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3297dac..5717b7ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/jenkins/ci-pipelines/ci_stage_2.groovy b/jenkins/ci-pipelines/ci_stage_2.groovy index 4edbd2bf..379ecbd0 100644 --- a/jenkins/ci-pipelines/ci_stage_2.groovy +++ b/jenkins/ci-pipelines/ci_stage_2.groovy @@ -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') } } diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index d7175b80..63683817 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -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" -- 2.17.1