Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ The AWS Account ID and Region is primarily used to construct the ECR domain `[AC
aws:
accountId: 123456789
region: ap-southeast-2
prefix: /cache
```

#### ECR Options
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type AWS struct {
AccountID string `yaml:"accountId"`
Region string `yaml:"region"`
Role string `yaml:"role"`
Prefix string `yaml:"prefix"`
ECROptions ECROptions `yaml:"ecrOptions"`
}

Expand Down Expand Up @@ -107,7 +108,7 @@ func (a *AWS) EcrDomain() string {
if strings.HasPrefix(a.Region, "cn-") {
domain = "amazonaws.com.cn"
}
return fmt.Sprintf("%s.dkr.ecr.%s.%s", a.AccountID, a.Region, domain)
return fmt.Sprintf("%s.dkr.ecr.%s.%s%s", a.AccountID, a.Region, domain, a.Prefix)
}

func (g *GCP) GarDomain() string {
Expand Down
14 changes: 14 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ func TestEcrDomain(t *testing.T) {
},
domain: "123456789.dkr.ecr.cn-north-1.amazonaws.com.cn",
},
{
name: "aws with prefix",
cfg: Config{
Target: Registry{
Type: "aws",
AWS: AWS{
AccountID: "123456789",
Region: "ap-southeast-2",
Prefix: "/prefix",
},
},
},
domain: "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/prefix",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down
Loading