buildkite-plugins / docker-buildkite-plugin

🐳📦 Run any build step in a Docker container
MIT License
112 stars 106 forks source link

Pass ECS env vars when using propagate-aws-auth-tokens #220

Closed francoiscampbell closed 2 years ago

francoiscampbell commented 2 years ago

When the agent is running in ECS, credentials are obtained by the various AWS SDKs by contacting AWS_CONTAINER_CREDENTIALS_RELATIVE_URI. This PR passes this env var from the agent to the docker container if it's defined.

Update: Also passes AWS_CONTAINER_CREDENTIALS_FULL_URI and AWS_CONTAINER_AUTHORIZATION_TOKEN

toote commented 2 years ago

That is actually a great change, but based on the corresponding AWS documentation I would suggest you add all 3 variables necessary for working in ECS. What do you think?

francoiscampbell commented 2 years ago

I've never had to pass AWS_CONTAINER_AUTHORIZATION_TOKEN when working with agents in ECS before, and AWS_CONTAINER_CREDENTIALS_FULL_URI isn't necessary if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is set:

Note: This setting is an alternative to AWS_CONTAINER_CREDENTIALS_RELATIVE_URI and will only be used if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is not set in the same profile.

but since this only takes effect when they're set in the external env, I don't mind passing all 3.