Fix: Change input to allow embedded refs 17/70417/2
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 27 Jul 2022 21:27:13 +0000 (07:27 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Fri, 5 Aug 2022 02:07:08 +0000 (12:07 +1000)
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 <abelur@linuxfoundation.org>
Change-Id: I8019d0c0bc9aa3eacf8eb902e33102271de303bb
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
src/test/groovy/LFInfraShipLogsSpec.groovy
vars/lfInfraShipLogs.groovy

index 18ec81b..f1a48d9 100644 (file)
@@ -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" () {
index f86e9d0..f9b237e 100644 (file)
@@ -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'))
                 }