-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(scripts): migrate AWS-SDK from v2 to v3 #15267
Conversation
closes RDEVOPS-96
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small things to change but thanks for doign this!
const stagingBucket = `staging.${projectDomain}` | ||
const productionBucket = projectDomain | ||
console.log(`Promoting ${projectDomain} from staging to production\n`) | ||
await getDeployMetadata(s3Client, stagingBucket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like getDeployMetadata
used to be here to get something called current
that was then logged, and not really any other purpose. This PR moves the log above getDeployMetadata
and removes the use of its return, so maybe we should just get rid of getDeployMetadata
|
||
console.log('Promotion to production done\n') | ||
|
||
getCreateInvalidation(productionCredentials, cloudfrontArn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be await
-ed i think
getCreateInvalidation(productionCredentials, cloudfrontArn) | ||
|
||
console.log('Cache invalidation initiated for production\n') | ||
process.exit(0).catch(err => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this catch
, if it's the equivalent of the catch
on the old line 100 then that functionality is covered by the function-wide try/catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops yes this is not needed there. thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us try and fix the invalidations.
|
||
const parseArgs = require('./lib/parseArgs') | ||
const syncBuckets = require('./lib/syncBuckets') | ||
const { getDeployMetadata } = require('./lib/deploy-metadata') | ||
const { getAssumeRole } = require('./assume-role') | ||
const { getCreateInvalidation } = require('./create-invalidation') | ||
const { checkCurrentAWSProfile } = require('./check-current-profile') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot comment on the not edited collapsed lines but all the arns for all CloudFront distributions in this file and in the promote-staging.js are incorrect. This is why we have had to do them manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh, thanks Josh. i thought we haven't had to do them manually since i added the cloud invalidations to these scripts. But did the cloudfront arns change when we added the new administrator role arn last year?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry PD CloudFront ARNs are correct. I think LL, static, docs may be off but are not relevant to this PR.
No they are still in old account we think.
|
||
const parseArgs = require('./lib/parseArgs') | ||
const syncBuckets = require('./lib/syncBuckets') | ||
const { getDeployMetadata } = require('./lib/deploy-metadata') | ||
const { getAssumeRole } = require('./assume-role') | ||
const { getCreateInvalidation } = require('./create-invalidation') | ||
const { checkCurrentAWSProfile } = require('./check-current-profile') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry PD CloudFront ARNs are correct. I think LL, static, docs may be off but are not relevant to this PR.
No they are still in old account we think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I think. There is that one weird Promise.resolve()
that I don't think needs to be there but good otherwise
@@ -17,7 +23,13 @@ function getCreateInvalidation(productionCredentials, cloudfrontArn) { | |||
}, | |||
}, | |||
} | |||
return cloudfront.createInvalidation(cloudFrontParams).promise() | |||
|
|||
if (dryrun) return Promise.resolve() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just return
here since it's async function
not function(...): Promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooh ya good point thank you!
closes RDEVOPS-96
Overview
this PR migrates from using AWS-SDK v2 to v3 and updates all our web deployment scripts (
promote-to-staging
,promote-to-production
,rollback
) and the utils usedNOTE: v3 does support typescript and i tried to update the scripts to using typescript but ran into a bunch of TS compiler issues 🫠. Seemed much easier to just stick with JS. Additionally, v2 is supposed to be deprecated as early as September 8th this year so figured it was better to update to v3 and still use JS than update to v3 and use TS (for now).
Test Plan
Only someone with the proper aws creds can test this. But should be tested for docs, PD, and LL with promote to staging, promote to production, and rollback dry runs.
for promote to staging:
node ./scripts/deploy/promote-to-staging project tag
(PD tag is[email protected]
)for promote to prod:
node ./scripts/deploy/promote-to-production project
rollback:
node ./scripts/deploy/rollback project environment
Changelog
Review requests
see test plan
Risk assessment
medium - we have no more releases that will use these anytime soon. The dry runs all seem to work!