Skip to content

Commit

Permalink
Move CFNID to secrets
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jun 10, 2024
1 parent 3d9292d commit bfa5d00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions jenkins/promotion/release-promotion.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/jenkins/TestOpenSearchReleasePromotionTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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})'
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bfa5d00

Please sign in to comment.