-
Notifications
You must be signed in to change notification settings - Fork 402
Refactor S3 upload logic - replace AWS CLI with SDK #9534
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
Conversation
--acl
parameter from S3 upload script in build.sbtThere 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 understand why we cannot just use a Java S3 client - either the AWS one or the MinIO one would do. AFAIK both support "if-none-match" semantics.
The thing about running processes is that they can fail in so many interesting ways! For example, the previous code would (always) lose output. The new code can report strange exit codes (>128) if the process exits with a signal. It separates the failure notification from the error message, because the error message goes out to the process logs. It will also break easily if aws
is not on the path, or if the wrong version of aws
is on the path. It has an unenforced dependency when used in an action - you must install an AWS CLI. And I find it hard to predict what it will do in different circumstances.
You're right, updated the solution ! |
…ogic in build.sbt
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.
Thanks! I highly recommend a fix - adding the cause - to the exceptions thrown on error. And this does not need to be re-reviewed.
Note that this also removes ACL: public-read.
clients/spark/build.sbt
Outdated
// Using AWS SDK v2, fails the build on any error. | ||
lazy val s3Upload = taskKey[Unit]("Upload JAR to S3 without override existing") | ||
val publishBucket = settingKey[String]("Target S3 bucket for publishing the JAR") | ||
val publishRegion = settingKey[String]("AWS region for publishing the JAR") |
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.
we can get it from env or other supported way by the java sdk
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.
lgtm. remove the extra import.
Closes #9512
Followup task of #9492
Changes
aws s3api
call with AWS SDK v2 (S3Client.putObject
).PutObjectRequest.ifNoneMatch("*")
(no overwrites).streams.value.log
(INFO for stdout-like messages).--acl public-read
anymore. WithBucket Owner Enforced
, ACLs are ignored and access is governed by the bucket policy.clients/spark/project/s3-upload-sdk.sbt
:software.amazon.awssdk:s3
and:regions
(v2.33.x).Testings
On the actual bucket, verified that: