diff --git a/README.md b/README.md index 1781a36..aae565a 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,10 @@ Retries login after a delay N times. Defaults to 0. Assume an AWS IAM role before ECR login. Supports `role-arn` and `duration-seconds` (optional) per the [associated AWS CLI command.](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sts/assume-role.html) +### `profile` (optional) + +Use a different AWS profile from the default during ECR login. + ## License MIT (see [LICENSE](LICENSE)) diff --git a/hooks/environment b/hooks/environment index 4639c99..44ef04c 100755 --- a/hooks/environment +++ b/hooks/environment @@ -117,6 +117,10 @@ function login_using_aws_ecr_get_login() { login_args+=("--region" "${BUILDKITE_PLUGIN_ECR_REGION}") fi + if [[ -n "${BUILDKITE_PLUGIN_ECR_PROFILE:-}" ]] ; then + login_args+=("--profile" "${BUILDKITE_PLUGIN_ECR_PROFILE}") + fi + if [[ ${#registry_ids[@]} -gt 0 ]] ; then # amend the ~~~ log heading with ^^^ to add the AWS account IDs echo "^^^ Authenticating with AWS ECR for ${registry_ids[*]} :ecr: :docker:" diff --git a/plugin.yml b/plugin.yml index 95d59d8..4b68247 100644 --- a/plugin.yml +++ b/plugin.yml @@ -26,5 +26,7 @@ configuration: duration-seconds: type: number default: 3600 + profile: + type: string required: - login