diff --git a/jenkins/promotion/release-promotion.jenkinsfile b/jenkins/promotion/release-promotion.jenkinsfile index ce802df015..768ced86ea 100644 --- a/jenkins/promotion/release-promotion.jenkinsfile +++ b/jenkins/promotion/release-promotion.jenkinsfile @@ -443,9 +443,11 @@ pipeline { script { echo 'Invalidating cloudfront' def majorVersion=params.RELEASE_VERSION.find(/\d/) - withCredentials([string(credentialsId: 'jenkins-aws-account-public', variable: 'AWS_ACCOUNT_PUBLIC')]) { + withCredentials([ + string(credentialsId: 'jenkins-aws-account-public', variable: 'AWS_ACCOUNT_PUBLIC'), + string(credentialsId: 'cloudfront-distribution-id', variable: 'CLOUDFRONT_DISTRIBUTION_ID')]) { withAWS(role: 'opensearch-bundle', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') { - cfInvalidate(distribution: "${env.CLOUDFRONT_DISTRIBUTION_ID}", paths: ["/releases/bundle/opensearch/${majorVersion}.x/*", "/releases/bundle/opensearch-dashboards/${majorVersion}.x/*"], waitForCompletion: true) + cfInvalidate(distribution: "${CLOUDFRONT_DISTRIBUTION_ID}", paths: ["/releases/bundle/opensearch/${majorVersion}.x/*", "/releases/bundle/opensearch-dashboards/${majorVersion}.x/*"], waitForCompletion: true) } } } diff --git a/tests/jenkins/TestOpenSearchReleasePromotionTest.groovy b/tests/jenkins/TestOpenSearchReleasePromotionTest.groovy index 31c1bf785b..25947b6f23 100644 --- a/tests/jenkins/TestOpenSearchReleasePromotionTest.groovy +++ b/tests/jenkins/TestOpenSearchReleasePromotionTest.groovy @@ -204,7 +204,7 @@ class TestOpenSearchReleasePromotionTest extends BuildPipelineTest { runScript('jenkins/promotion/release-promotion.jenkinsfile') def callStack = helper.getCallStack() assertCallStack().contains( - 'release-promotion.cfInvalidate({distribution=null, paths=[/releases/bundle/opensearch/1.x/*, /releases/bundle/opensearch-dashboards/1.x/*], waitForCompletion=true})' + 'release-promotion.cfInvalidate({distribution=CLOUDFRONT_DISTRIBUTION_ID, paths=[/releases/bundle/opensearch/1.x/*, /releases/bundle/opensearch-dashboards/1.x/*], waitForCompletion=true})' ) } } \ No newline at end of file diff --git a/tests/jenkins/jenkinsjob-regression-files/promotion/release-promotion.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/promotion/release-promotion.jenkinsfile.txt index b9f8fbf60b..d0beeda496 100644 --- a/tests/jenkins/jenkinsjob-regression-files/promotion/release-promotion.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/promotion/release-promotion.jenkinsfile.txt @@ -201,9 +201,10 @@ release-promotion.script(groovy.lang.Closure) release-promotion.echo(Invalidating cloudfront) release-promotion.string({credentialsId=jenkins-aws-account-public, variable=AWS_ACCOUNT_PUBLIC}) - release-promotion.withCredentials([AWS_ACCOUNT_PUBLIC], groovy.lang.Closure) + release-promotion.string({credentialsId=cloudfront-distribution-id, variable=CLOUDFRONT_DISTRIBUTION_ID}) + release-promotion.withCredentials([AWS_ACCOUNT_PUBLIC, CLOUDFRONT_DISTRIBUTION_ID], groovy.lang.Closure) release-promotion.withAWS({role=opensearch-bundle, roleAccount=AWS_ACCOUNT_PUBLIC, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) - release-promotion.cfInvalidate({distribution=null, paths=[/releases/bundle/opensearch/1.x/*, /releases/bundle/opensearch-dashboards/1.x/*], waitForCompletion=true}) + release-promotion.cfInvalidate({distribution=CLOUDFRONT_DISTRIBUTION_ID, paths=[/releases/bundle/opensearch/1.x/*, /releases/bundle/opensearch-dashboards/1.x/*], waitForCompletion=true}) release-promotion.stage(Promote Docker, groovy.lang.Closure) release-promotion.echo(Executing on agent [docker:[alwaysPull:true, args:, containerPerStageRoot:false, label:Jenkins-Agent-AL2023-X64-C54xlarge-Docker-Host, image:docker/library/alpine:3, reuseNode:false, registryUrl:https://public.ecr.aws/, stages:[:]]]) release-promotion.echo(Triggering docker promotion)