From: Anil Belur Date: Wed, 27 Jul 2022 21:27:13 +0000 (+1000) Subject: Fix: Change input to allow embedded refs X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=6c5b7050182c72da20867ed36ba778694b7d1eba;p=releng%2Fpipelines.git Fix: Change input to allow embedded refs Change the single-quoted string to double quotes to allow embedded references to variables without which the credentials files do not get created under $HOME. Error: [ERROR] failed to expand variables in target location '$HOME/.aws/credentials' : Error processing tokens copy managed file [jenkins-s3-log-ship] to file:/w/workspace/aaa-ci-pipeline_70_101670_21/$HOME/ .aws/credentials Update the test to add $HOME mock variable. Issue-ID: RELENG-4327 Signed-off-by: Anil Belur Change-Id: I8019d0c0bc9aa3eacf8eb902e33102271de303bb Signed-off-by: Anil Belur --- diff --git a/src/test/groovy/LFInfraShipLogsSpec.groovy b/src/test/groovy/LFInfraShipLogsSpec.groovy index 18ec81b..f1a48d9 100644 --- a/src/test/groovy/LFInfraShipLogsSpec.groovy +++ b/src/test/groovy/LFInfraShipLogsSpec.groovy @@ -24,6 +24,7 @@ public class LFInfraShipLogsSpec extends JenkinsPipelineSpecification { def setup() { lfInfraShipLogs = loadPipelineScriptForTest('vars/lfInfraShipLogs.groovy') explicitlyMockPipelineVariable('lfCommon') + explicitlyMockPipelineVariable('HOME') } def "Test lfInfraShipLogs [Should] throw exception [When] logSettingsFile is null" () { diff --git a/vars/lfInfraShipLogs.groovy b/vars/lfInfraShipLogs.groovy index f86e9d0..f9b237e 100644 --- a/vars/lfInfraShipLogs.groovy +++ b/vars/lfInfraShipLogs.groovy @@ -69,7 +69,7 @@ def call(body) { if ("$S3_BUCKET" =~ /.*logs-s3.*/) { // If S3_BUCKET is defined, we need the config file configFileProvider([configFile(fileId: "jenkins-s3-log-ship", - targetLocation: '$HOME/.aws/credentials')]) { + targetLocation: "$HOME/.aws/credentials")]) { echo 'Running shell/logs-deploy.sh' sh(script: libraryResource('shell/logs-deploy.sh')) }