Skip to content

Commit

Permalink
chore: update aws sdk (#28712)
Browse files Browse the repository at this point in the history
* chore: update the awk-sdk to version 3 and awspublish to use version 3 (version 8) [run ci]

chore: add region to aws s3 bucket [run ci]

* run ci for aws_updates
  • Loading branch information
AtofStryker committed Jan 16, 2024
1 parent 8a02c2d commit 7df6df4
Show file tree
Hide file tree
Showing 5 changed files with 1,135 additions and 163 deletions.
10 changes: 5 additions & 5 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mainBuildFilters: &mainBuildFilters
- develop
- /^release\/\d+\.\d+\.\d+$/
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'feature/experimental-retries'
- 'chore/update_aws_sdk'
- 'publish-binary'
- 'em/circle2'

Expand All @@ -42,7 +42,7 @@ macWorkflowFilters: &darwin-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_aws_sdk', << pipeline.git.branch >> ]
- equal: [ 'ryanm/fix/service-worker-capture', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand All @@ -54,7 +54,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_aws_sdk', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'em/circle2', << pipeline.git.branch >> ]
- matches:
Expand All @@ -79,7 +79,7 @@ windowsWorkflowFilters: &windows-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'feature/experimental-retries', << pipeline.git.branch >> ]
- equal: [ 'chore/update_aws_sdk', << pipeline.git.branch >> ]
- equal: [ 'chore/update_windows_signing', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- equal: [ 'mschile/mochaEvents_win_sep', << pipeline.git.branch >> ]
Expand Down Expand Up @@ -152,7 +152,7 @@ commands:
name: Set environment variable to determine whether or not to persist artifacts
command: |
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_windows_signing" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_aws_sdk" ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"prepare": "husky install"
},
"devDependencies": {
"@aws-sdk/client-s3": "3.485.0",
"@aws-sdk/credential-providers": "3.53.0",
"@cypress/questions-remain": "1.0.1",
"@cypress/request": "^3.0.0",
Expand Down Expand Up @@ -126,7 +127,6 @@
"@urql/introspection": "^0.3.0",
"ascii-table": "0.0.9",
"autobarrel": "^1.1.0",
"aws-sdk": "2.814.0",
"babel-eslint": "10.1.0",
"bluebird": "3.5.3",
"bluebird-retry": "0.11.0",
Expand Down Expand Up @@ -165,7 +165,7 @@
"graphql": "^15.5.1",
"graphql-executor": "0.0.23",
"gulp": "4.0.2",
"gulp-awspublish": "4.0.0",
"gulp-awspublish": "8.0.0",
"gulp-debug": "4.0.0",
"gulp-rename": "1.4.0",
"hasha": "5.0.0",
Expand Down
25 changes: 14 additions & 11 deletions scripts/binary/s3-api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require('debug')('cypress:binary')
import la from 'lazy-ass'
import is from 'check-more-types'
import S3 from 'aws-sdk/clients/s3'
import { CopyObjectCommandInput, CopyObjectCommandOutput, ObjectCannedACL, S3 } from '@aws-sdk/client-s3'

export const hasOnlyStringValues = (o) => {
return Object.values(o).every((v) => is.unemptyString(v))
Expand All @@ -22,9 +22,12 @@ export const s3helpers = {
}

return new S3({
accessKeyId: aws.accessKeyId,
secretAccessKey: aws.secretAccessKey,
sessionToken: aws.sessionToken,
credentials: {
accessKeyId: aws.accessKeyId,
secretAccessKey: aws.secretAccessKey,
sessionToken: aws.sessionToken,
},
region: 'us-east-1',
})
},

Expand Down Expand Up @@ -83,12 +86,12 @@ export const s3helpers = {
* and ACL 'public-read'
*/
copyS3 (sourceKey: string, destinationKey: string, bucket: string,
contentType: S3.ContentType, acl: S3.ObjectCannedACL,
s3: S3): Promise<S3.CopyObjectOutput> {
contentType: string, acl: ObjectCannedACL,
s3: S3): Promise<CopyObjectCommandOutput> {
return new Promise((resolve, reject) => {
debug('copying %s in bucket %s to %s', sourceKey, bucket, destinationKey)

const params: S3.CopyObjectRequest = {
const params: CopyObjectCommandInput = {
Bucket: bucket,
CopySource: `${bucket}/${sourceKey}`,
Key: destinationKey,
Expand Down Expand Up @@ -116,7 +119,7 @@ export const s3helpers = {
* but the returned object has these prefixes stripped. Thus if we set
* a single "x-amz-meta-user: gleb", the resolved object will be simply {user: "gleb"}
*/
getUserMetadata (bucket: string, key: string, s3: S3): Promise<S3.Metadata> {
getUserMetadata (bucket: string, key: string, s3: S3): Promise<Record<string, string>> {
return new Promise((resole, reject) => {
debug('getting user metadata from %s %s', bucket, key)

Expand All @@ -139,15 +142,15 @@ export const s3helpers = {
* Setting user metadata can be accomplished with copying the object back onto itself
* with replaced metadata object.
*/
setUserMetadata (bucket: string, key: string, metadata: S3.Metadata,
contentType: S3.ContentType, acl: S3.ObjectCannedACL, s3: S3): Promise<S3.CopyObjectOutput> {
setUserMetadata (bucket: string, key: string, metadata: Record<string, string>,
contentType: string, acl: ObjectCannedACL, s3: S3): Promise<CopyObjectCommandOutput> {
la(hasOnlyStringValues(metadata),
'metadata object can only have string values', metadata)

return new Promise((resolve, reject) => {
debug('setting metadata to %o for %s %s', metadata, bucket, key)

const params: S3.CopyObjectRequest = {
const params: CopyObjectCommandInput = {
Bucket: bucket,
CopySource: `${bucket}/${key}`,
Key: key,
Expand Down
9 changes: 6 additions & 3 deletions scripts/binary/util/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ const getPublisher = async function () {
params: {
Bucket: S3Configuration.bucket,
},
accessKeyId: aws.accessKeyId,
secretAccessKey: aws.secretAccessKey,
sessionToken: aws.sessionToken,
credentials: {
accessKeyId: aws.accessKeyId,
secretAccessKey: aws.secretAccessKey,
sessionToken: aws.sessionToken,
},
region: 'us-east-1',
})
}

Expand Down

5 comments on commit 7df6df4

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7df6df4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.3/linux-x64/develop-7df6df45faf9a6a2c1f7561b16ed94ed13b51b13/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7df6df4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.3/linux-arm64/develop-7df6df45faf9a6a2c1f7561b16ed94ed13b51b13/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7df6df4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.3/darwin-x64/develop-7df6df45faf9a6a2c1f7561b16ed94ed13b51b13/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7df6df4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.3/darwin-arm64/develop-7df6df45faf9a6a2c1f7561b16ed94ed13b51b13/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7df6df4 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.3/win32-x64/develop-7df6df45faf9a6a2c1f7561b16ed94ed13b51b13/cypress.tgz

Please sign in to comment.