Open BadAsstronaut opened 2 years ago
Hi @BadAsstronaut thanks for opening this. We're updating the Artifact upload docs at the moment, and will look into it.
hey @BadAsstronaut! are your artifacts stored in a private s3 bucket in your AWS account, or are you using buildkite's managed artifact storage?
also, would you be able to post some log output from a build that fails in this way? there are a couple of moving parts to artifacts which are tricky to diagnose without error messages
@moskyb We are using the elastic stack on AWS and we have a private S3 artifacts bucket configured.
I don't want to share the logs because they include bucket names and such. I ended up using the --debug
flag on the buildkite-agent artifact
command and found that it retrieved the artifact via a presigned link. This is, imho, "desired" behavior. When the same was done with the artifact_paths
config in the pipeline.yml
file, the agent found the artifact but then failed with a Failed to download artifact: Could not s3:ListObjects in your AWS S3 bucket
error.
This makes sense given that the step does not have a role enabling read access on the artifacts S3 bucket. But if the artifact is accessible via a presigned link, it doesn't need IAM access.
@BadAsstronaut i'm gonna move this issue to the agent repo, as it's more of an agent issue than it is a docs issue. Even if it's a docs issue, it's an agent docs issue.
Further to that though, lemme look into this a bit deeper.
I discovered an interesting undocumented feature.
The following configuration works.
This configuration does not work.
Debugging the agent showed me that when using
artifact_paths
, the artifact is retrieved via the S3 client. If the step has a cross-account role without access to the artifact bucket, the step cannot access the artifact.When creating an artifact use
buildkite-agent artifact upload
, the s3 uploader creates a presigned link which is accessible from thepublish
step using an assumed role.This concerns me because the functionality is not documented and therefore subject to change.