Skip to content

Commit 7c8295f

Browse files
chore: Update documentation for the new option
1 parent 80a280e commit 7c8295f

2 files changed

Lines changed: 8 additions & 24 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ Whether or not to automatically propagate all pipeline environment variables int
7878

7979
**Important**: only pipeline environment variables will be propagated (what you see in the BuildKite UI, those listed in `$BUILDKITE_ENV_FILE`). This does not include variables exported in preceeding `environment` hooks. If you wish for those to be propagated you will need to list them specifically or use `env-propagation-list`.
8080

81+
### `propagate-aws-auth-tokens` (run only, boolean)
82+
83+
Whether or not to automatically propagate aws authentication environment variables into the docker container. Avoiding the need to be specified with `environment`. This is useful for example if you are using an assume role plugin or you want to pass the role of an agent running in ECS or EKS to the docker container.
84+
85+
Will propagate `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_REGION`, `AWS_DEFAULT_REGION`, `AWS_STS_REGIONAL_ENDPOINTS`, `AWS_WEB_IDENTITY_TOKEN_FILE`, `AWS_ROLE_ARN`, `AWS_CONTAINER_CREDENTIALS_FULL_URI`, `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`, and `AWS_CONTAINER_AUTHORIZATION_TOKEN`, only if they are set already.
86+
87+
When the `AWS_WEB_IDENTITY_TOKEN_FILE` is specified, it will also mount it automatically for you and make it usable within the container.
88+
8189
#### `command` (run only, array)
8290

8391
Sets the command for the Docker image, and defaults the `shell` option to `false`. Useful if the Docker image has an entrypoint, or doesn't contain a shell.

commands/run.sh

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,67 +116,43 @@ fi
116116
if [[ "$(plugin_read_config PROPAGATE_AWS_AUTH_TOKENS "false")" =~ ^(true|on|1)$ ]] ; then
117117
if [[ -n "${AWS_ACCESS_KEY_ID:-}" ]] ; then
118118
run_params+=( --env "AWS_ACCESS_KEY_ID" )
119-
else
120-
echo "🚨 AWS_ACCESS_KEY_ID is not set, not propagating"
121119
fi
122120
if [[ -n "${AWS_SECRET_ACCESS_KEY:-}" ]] ; then
123121
run_params+=( --env "AWS_SECRET_ACCESS_KEY" )
124-
else
125-
echo "🚨 AWS_SECRET_ACCESS_KEY is not set, not propagating"
126122
fi
127123
if [[ -n "${AWS_SESSION_TOKEN:-}" ]] ; then
128124
run_params+=( --env "AWS_SESSION_TOKEN" )
129-
else
130-
echo "🚨 AWS_SESSION_TOKEN is not set, not propagating"
131125
fi
132126
if [[ -n "${AWS_REGION:-}" ]] ; then
133127
run_params+=( --env "AWS_REGION" )
134-
else
135-
echo "🚨 AWS_REGION is not set, not propagating"
136128
fi
137129
if [[ -n "${AWS_DEFAULT_REGION:-}" ]] ; then
138130
run_params+=( --env "AWS_DEFAULT_REGION" )
139-
else
140-
echo "🚨 AWS_DEFAULT_REGION is not set, not propagating"
141131
fi
142132
if [[ -n "${AWS_ROLE_ARN:-}" ]] ; then
143133
run_params+=( --env "AWS_ROLE_ARN" )
144-
else
145-
echo "🚨 AWS_ROLE_ARN is not set, not propagating"
146134
fi
147135
if [[ -n "${AWS_STS_REGIONAL_ENDPOINTS:-}" ]] ; then
148136
run_params+=( --env "AWS_STS_REGIONAL_ENDPOINTS" )
149-
else
150-
echo "🚨 AWS_STS_REGIONAL_ENDPOINTS is not set, not propagating"
151137
fi
152138
# Pass ECS variables when the agent is running in ECS
153139
# https://docs.aws.amazon.com/sdkref/latest/guide/feature-container-credentials.html
154140
if [[ -n "${AWS_CONTAINER_CREDENTIALS_FULL_URI:-}" ]] ; then
155141
run_params+=( --env "AWS_CONTAINER_CREDENTIALS_FULL_URI" )
156-
else
157-
echo "🚨 AWS_CONTAINER_CREDENTIALS_FULL_URI is not set, not propagating"
158142
fi
159143
if [[ -n "${AWS_CONTAINER_CREDENTIALS_RELATIVE_URI:-}" ]] ; then
160144
run_params+=( --env "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" )
161-
else
162-
echo "🚨 AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is not set, not propagating"
163145
fi
164146
if [[ -n "${AWS_CONTAINER_AUTHORIZATION_TOKEN:-}" ]] ; then
165147
run_params+=( --env "AWS_CONTAINER_AUTHORIZATION_TOKEN" )
166-
else
167-
echo "🚨 AWS_CONTAINER_AUTHORIZATION_TOKEN is not set, not propagating"
168148
fi
169149
# Pass EKS variables when the agent is running in EKS
170150
# https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-minimum-sdk.html
171151
if [[ -n "${AWS_WEB_IDENTITY_TOKEN_FILE:-}" ]] ; then
172152
run_params+=( --env "AWS_WEB_IDENTITY_TOKEN_FILE" )
173153
# Add the token file as a volume
174154
run_params+=( --volume "${AWS_WEB_IDENTITY_TOKEN_FILE}:${AWS_WEB_IDENTITY_TOKEN_FILE}" )
175-
else
176-
echo "🚨 AWS_WEB_IDENTITY_TOKEN_FILE is not set, not propagating"
177155
fi
178-
else
179-
echo "🚨 Not propagating AWS credentials to container as PROPAGATE_AWS_AUTH_TOKENS is not set to true"
180156
fi
181157

182158
# If requested, propagate a set of env vars as listed in a given env var to the

0 commit comments

Comments
 (0)