Skip to content

Commit d8fe15b

Browse files
committed
wip: adds support for ECR login
1 parent d26da79 commit d8fe15b

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

blueprint.cue

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
version: "1.0"
22
ci: {
3+
registries: [
4+
ci.providers.aws.registry,
5+
]
36
providers: {
47
aws: {
5-
region: "eu-central-1"
6-
role: "arn:aws:iam::332405224602:role/ci"
8+
region: "eu-central-1"
9+
registry: "332405224602.dkr.ecr.eu-central-1.amazonaws.com"
10+
role: "arn:aws:iam::332405224602:role/ci"
711
}
812
docker: {
913
credentials: {

blueprint/schema/_embed/schema.cue

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ package schema
1616
// +optional
1717
providers?: #Providers @go(Providers)
1818

19-
// Registry contains the registry to push images to.
19+
// Registries contains the container registries to push images to.
2020
// +optional
21-
registry?: null | string @go(Registry,*string)
21+
registries?: [...string] @go(Registries,[]string)
2222

2323
// Secrets contains the configuration for the secrets being used by the CI system.
2424
// +optional
@@ -55,6 +55,10 @@ package schema
5555

5656
// Region contains the region to use.
5757
region?: null | string @go(Region,*string)
58+
59+
// Registry contains the ECR registry to use.
60+
// +optional
61+
registry?: null | string @go(Registry,*string)
5862
}
5963

6064
// ProviderDocker contains the configuration for the DockerHub provider.

blueprint/schema/schema.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ type CI struct {
2626
// +optional
2727
Providers Providers `json:"providers"`
2828

29-
// Registry contains the registry to push images to.
29+
// Registries contains the container registries to push images to.
3030
// +optional
31-
Registry *string `json:"registry"`
31+
Registries []string `json:"registries"`
3232

3333
// Secrets contains the configuration for the secrets being used by the CI system.
3434
// +optional
@@ -61,6 +61,10 @@ type ProviderAWS struct {
6161

6262
// Region contains the region to use.
6363
Region *string `json:"region"`
64+
65+
// Registry contains the ECR registry to use.
66+
// +optional
67+
Registry *string `json:"registry"`
6468
}
6569

6670
// ProviderDocker contains the configuration for the DockerHub provider.

blueprint/schema/schema_go_gen.cue

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ package schema
2020
// +optional
2121
providers?: #Providers @go(Providers)
2222

23-
// Registry contains the registry to push images to.
23+
// Registries contains the container registries to push images to.
2424
// +optional
25-
registry?: null | string @go(Registry,*string)
25+
registries?: [...string] @go(Registries,[]string)
2626

2727
// Secrets contains the configuration for the secrets being used by the CI system.
2828
// +optional
@@ -55,6 +55,10 @@ package schema
5555

5656
// Region contains the region to use.
5757
region?: null | string @go(Region,*string)
58+
59+
// Registry contains the ECR registry to use.
60+
// +optional
61+
registry?: null | string @go(Registry,*string)
5862
}
5963

6064
// ProviderDocker contains the configuration for the DockerHub provider.

forge/actions/setup/action.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,24 @@ runs:
4242
AWS=$(echo "$BP" | jq -r .ci.providers.aws)
4343
if [[ "$AWS" != "null" ]]; then
4444
REGION=$(echo "$BP" | jq -r .ci.providers.aws.region)
45+
REGISTRY=$(echo "$BP" | jq -r .ci.providers.aws.registry)
4546
ROLE=$(echo "$BP" | jq -r .ci.providers.aws.role)
4647
fi
4748
4849
echo "region=$REGION" >> $GITHUB_OUTPUT
50+
echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
4951
echo "role=$ROLE" >> $GITHUB_OUTPUT
50-
- name: Configure AWS
52+
- name: Login to AWS
5153
uses: aws-actions/configure-aws-credentials@v4
5254
if: steps.aws.outputs.region != '' && steps.aws.outputs.role != ''
5355
with:
5456
aws-region: ${{ steps.aws.outputs.region }}
5557
role-to-assume: ${{ steps.aws.outputs.role }}
58+
- name: Login to ECR
59+
uses: docker/login-action@v3
60+
if: steps.aws.outputs.registry != ''
61+
with:
62+
registry: ${{ steps.aws.outputs.registry }}
5663

5764
# Docker Provider
5865
- name: Get Docker provider configuration

0 commit comments

Comments
 (0)