Skip to content
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

Optionally download tags when getting object #142

Merged
merged 3 commits into from
Jun 30, 2020

Conversation

mdelillo
Copy link
Contributor

This adds a new param to in requests called download_tags. It will write the S3 object tags as key:value pairs to tags.json. It is disabled by default.

The SetTags function on s3client is currently only used for testing, but it could be used to allow tags to be written in out (#119).

* Writes the tags to a file called `tags.json`

Signed-off-by: Mark DeLillo <[email protected]>
Signed-off-by: Mark DeLillo <[email protected]>
@xtremerui
Copy link
Contributor

Hi @mdelillo , it seems there is test failure on both alpine and ubuntu build.

• Failure in Spec Setup (BeforeEach) [0.573 seconds]
in
/go/src/github.com/concourse/s3-resource/integration/in_test.go:21
  when download_tags is true
  /go/src/github.com/concourse/s3-resource/integration/in_test.go:442
    writes the tags to tags.json [BeforeEach]
    /go/src/github.com/concourse/s3-resource/integration/in_test.go:494

    Expected error:
        <s3.requestFailure>: {
            RequestFailure: {
                awsError: {
                    code: "AccessDenied",
                    message: "Access Denied",
                    errs: nil,
                },
                statusCode: 403,
                requestID: "8C772CDF23216B9B",
            },
            hostID: "ftWDFFDn+uvPyhLC4DjQTX2DmU0ErgjfA5MpKqPduWwx+YYjUrUlOINGcHd7UdYtGfyLr7rl9ik=",
        }
        AccessDenied: Access Denied
        	status code: 403, request id: 8C772CDF23216B9B, host id: ftWDFFDn+uvPyhLC4DjQTX2DmU0ErgjfA5MpKqPduWwx+YYjUrUlOINGcHd7UdYtGfyLr7rl9ik=
    not to have occurred

    /go/src/github.com/concourse/s3-resource/integration/in_test.go:486

@mdelillo
Copy link
Contributor Author

From the error it seems like the S3 token doesn't have permission to write object tags. I actually ended up solving my original problem in a different way, so if this isn't easily mergeable then I'll probably close it out.

@xtremerui
Copy link
Contributor

I have config the IAM to have right permissions for the tests it looks good now. Will try to move this PR forward.

@xtremerui
Copy link
Contributor

@mdelillo all looks good. The only concern is the IAM change that needed for using download_tags. Could you update the readme either at https://github.com/concourse/s3-resource/blob/7b1ba3b876112353df0f78eef8b67ea7e3912fb4/README.md#required-iam-permissions or where you added download_tags to make the usecase clear? Thx!

@mdelillo
Copy link
Contributor Author

That makes sense, I added it to Required IAM Permissions. I also added a section in the integration tests since the s3:PutObjectTagging is only needed during testing.

@xtremerui xtremerui merged commit 1c60008 into concourse:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants