-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(s3-deployment): allow ability to specify versionId for S3 bucket source #32484
base: main
Are you sure you want to change the base?
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
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 for the super-late review. Left comments for some minor adjustments👍
@@ -96,15 +113,19 @@ export class Source { | |||
* @param bucket The S3 Bucket | |||
* @param zipObjectKey The S3 object key of the zip file with contents | |||
*/ | |||
public static bucket(bucket: s3.IBucket, zipObjectKey: string): ISource { | |||
public static bucket(bucket: s3.IBucket, zipObjectKey: string, options?: BucketSourceOptions): ISource { |
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.
Can you please update the documentation above and the related @example
and @param
?
SourceVersionIds: cdk.Lazy.uncachedAny({ | ||
produce: () => { | ||
const versionIds = this.sources.map(source => source.versionId ?? ''); | ||
// in the case where no version IDs supplied, then omit the property | ||
return versionIds.some(versionId => versionId.length > 0) ? versionIds : []; | ||
}, | ||
}, { omitEmptyArray: true } ), |
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.
SourceVersionIds: cdk.Lazy.uncachedAny({ | |
produce: () => { | |
const versionIds = this.sources.map(source => source.versionId ?? ''); | |
// in the case where no version IDs supplied, then omit the property | |
return versionIds.some(versionId => versionId.length > 0) ? versionIds : []; | |
}, | |
}, { omitEmptyArray: true } ), | |
SourceVersionIds: cdk.Lazy.uncachedList({ | |
produce: () => { | |
const versionIds = this.sources.map(source => source.versionId ?? ''); | |
// in the case where no version IDs are supplied, then omit the property | |
return versionIds.some(versionId => versionId.length > 0) ? versionIds : []; | |
}, | |
}, { omitEmpty: true } ), |
Nit, uncachedList
seems more appropriate.
|
||
const myBucketDeployment = new s3deploy.BucketDeployment(this, 'DeployMeWithVersioningSupport', { | ||
sources: [s3deploy.Source.bucket(sourceBucket, 'object-key', { | ||
versionId: '3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo', |
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.
versionId: '3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo', | |
versionId: 'version-id', |
Let's use a placeholder value.
s3_source_zips = [ | ||
{ | ||
"BucketName": bucket, | ||
"ObjectKey": object_key, | ||
"VersionID": source_version_ids[i] if i < len(source_version_ids) else "" | ||
} | ||
for i, (bucket, object_key) in enumerate(zip(source_bucket_names, source_object_keys)) | ||
] |
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.
s3_source_zips = [ | |
{ | |
"BucketName": bucket, | |
"ObjectKey": object_key, | |
"VersionID": source_version_ids[i] if i < len(source_version_ids) else "" | |
} | |
for i, (bucket, object_key) in enumerate(zip(source_bucket_names, source_object_keys)) | |
] | |
if not source_version_ids: | |
source_version_ids = [""] * len(source_bucket_names) | |
s3_source_zips = zip(source_bucket_names, source_object_keys, source_version_ids) | |
... | |
for i in range(len(s3_source_zips)): | |
s3_source_bucket, s3_source_key, s3_source_version_id = s3_source_zips[i] |
Bit cleaner.
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
Comments on closed issues and PRs are hard for our team to see. |
Hi @nritholtz thank you for opening this PR! Sorry about the late response. Looks like it got close because it was deemed that it was abandoned because there was some merge conflicts. Not that if the BUILD is failing or if there are merge conflicts then the PR won't show up on our board to review. I've re-opened the PR and if you're still working on it and can fix the conflicts then we'd be happy to take a look after. Thanks again for your contribution. |
Issue # (if applicable)
Closes #32462.
Reason for this change
Allow user to specify optional versionId of the zipped file for the s3 bucket source type.
Description of changes
versionId
to S3 Bucket source properties and newBucketSourceOptions
interface.s3api get-object
instead ofaws cp
to allow support of specifying versionId when supplied.Description of how you validated changes
Added and updated appropriate unit/integration tests. Also needed to update
solutionStackName: '64bit Amazon Linux 2023 v6.2.2 running Node.js 20',
since no longer available.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license