Add aws_profile option to docker-push ecr_login
An aws_profile option is added to the AWS ECR login credentials configuration to allow using shared AWS credentials stored in a non-default profile. Signed-off-by: Aaron Browne <aaron0browne@gmail.com>
This commit is contained in:
parent
8585e0ebf5
commit
8df643c343
|
@ -19,6 +19,7 @@ type AwsAccessConfig struct {
|
||||||
AccessKey string `mapstructure:"aws_access_key"`
|
AccessKey string `mapstructure:"aws_access_key"`
|
||||||
SecretKey string `mapstructure:"aws_secret_key"`
|
SecretKey string `mapstructure:"aws_secret_key"`
|
||||||
Token string `mapstructure:"aws_token"`
|
Token string `mapstructure:"aws_token"`
|
||||||
|
Profile string `mapstructure:"aws_profile"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config returns a valid aws.Config object for access to AWS services, or
|
// Config returns a valid aws.Config object for access to AWS services, or
|
||||||
|
@ -38,7 +39,10 @@ func (c *AwsAccessConfig) config(region string) (*aws.Config, error) {
|
||||||
SessionToken: c.Token,
|
SessionToken: c.Token,
|
||||||
}},
|
}},
|
||||||
&credentials.EnvProvider{},
|
&credentials.EnvProvider{},
|
||||||
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
|
&credentials.SharedCredentialsProvider{
|
||||||
|
Filename: "",
|
||||||
|
Profile: c.Profile,
|
||||||
|
},
|
||||||
&ec2rolecreds.EC2RoleProvider{
|
&ec2rolecreds.EC2RoleProvider{
|
||||||
Client: ec2metadata.New(session),
|
Client: ec2metadata.New(session),
|
||||||
},
|
},
|
||||||
|
|
|
@ -162,6 +162,9 @@ You must specify (only) one of `commit`, `discard`, or `export_path`.
|
||||||
probably don't need it. This will also be read from the `AWS_SESSION_TOKEN`
|
probably don't need it. This will also be read from the `AWS_SESSION_TOKEN`
|
||||||
environmental variable.
|
environmental variable.
|
||||||
|
|
||||||
|
- `aws_profile` (string) - The AWS shared credentials profile used to communicate with AWS.
|
||||||
|
[Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials)
|
||||||
|
|
||||||
- `changes` (array of strings) - Dockerfile instructions to add to the commit.
|
- `changes` (array of strings) - Dockerfile instructions to add to the commit.
|
||||||
Example of instructions are `CMD`, `ENTRYPOINT`, `ENV`, and `EXPOSE`. Example:
|
Example of instructions are `CMD`, `ENTRYPOINT`, `ENV`, and `EXPOSE`. Example:
|
||||||
`[ "USER ubuntu", "WORKDIR /app", "EXPOSE 8080" ]`
|
`[ "USER ubuntu", "WORKDIR /app", "EXPOSE 8080" ]`
|
||||||
|
|
|
@ -30,6 +30,9 @@ This post-processor has only optional configuration:
|
||||||
probably don't need it. This will also be read from the `AWS_SESSION_TOKEN`
|
probably don't need it. This will also be read from the `AWS_SESSION_TOKEN`
|
||||||
environmental variable.
|
environmental variable.
|
||||||
|
|
||||||
|
- `aws_profile` (string) - The AWS shared credentials profile used to communicate with AWS.
|
||||||
|
[Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials)
|
||||||
|
|
||||||
- `ecr_login` (boolean) - Defaults to false. If true, the post-processor
|
- `ecr_login` (boolean) - Defaults to false. If true, the post-processor
|
||||||
will login in order to push the image to
|
will login in order to push the image to
|
||||||
[Amazon EC2 Container Registry (ECR)](https://aws.amazon.com/ecr/).
|
[Amazon EC2 Container Registry (ECR)](https://aws.amazon.com/ecr/).
|
||||||
|
|
Loading…
Reference in New Issue