Skip to content

Commit a670f13

Browse files
committed
fix(mirror): Handle auth for each project
1 parent 0209334 commit a670f13

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/mirror.yaml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ on:
2323
required: true
2424
# TODO (@NickLarsenNZ): Combine this with the source image above
2525
# So that we don't have to remember which project for which mirrored image
26+
# Note that each project has a different credential
2627
destination-project:
2728
description: |
28-
Destination project in Harbor (eg: sdp, stackable)
29-
type: string
30-
default: sdp
29+
Destination project in Harbor
30+
type: choice
31+
options:
32+
- sdp
33+
- stackable
3134

3235
permissions: {}
3336

@@ -67,13 +70,25 @@ jobs:
6770
run: |
6871
echo "IMAGE_REPOSITORY=$(.scripts/get_repo_name.sh)" | tee -a "$GITHUB_ENV"
6972
70-
- name: Publish Container Image on oci.stackable.tech
73+
- name: Publish Container Image on oci.stackable.tech/sdp
74+
if: inputs.destination-project == 'sdp'
7175
uses: stackabletech/actions/publish-image@8a8085be0a8cec3d24ad3970e602d65be487da6a # v0.14.1
7276
with:
7377
image-registry-uri: oci.stackable.tech
7478
image-registry-username: robot$sdp+github-action-build
7579
image-registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
76-
image-repository: ${{ format('{0}/{1}', inputs.destination-project, env.IMAGE_REPOSITORY) }}
80+
image-repository: ${{ format('sdp/{0}', env.IMAGE_REPOSITORY) }}
81+
image-manifest-tag: ${{ format('{0}-{1}', inputs.image-index-manifest-tag, matrix.arch) }}
82+
source-image-uri: ${{ format('{0}:{1}', inputs.image-repository-uri, inputs.image-index-manifest-tag) }}
83+
84+
- name: Publish Container Image on oci.stackable.tech/stackable
85+
if: inputs.destination-project == 'stackable'
86+
uses: stackabletech/actions/publish-image@8a8085be0a8cec3d24ad3970e602d65be487da6a # v0.14.1
87+
with:
88+
image-registry-uri: oci.stackable.tech
89+
image-registry-username: robot$stackable+github-action-build
90+
image-registry-password: ${{ secrets.HARBOR_ROBOT_STACKABLE_GITHUB_ACTION_BUILD_SECRET }}
91+
image-repository: ${{ format('stackable/{0}', env.IMAGE_REPOSITORY) }}
7792
image-manifest-tag: ${{ format('{0}-{1}', inputs.image-index-manifest-tag, matrix.arch) }}
7893
source-image-uri: ${{ format('{0}:{1}', inputs.image-repository-uri, inputs.image-index-manifest-tag) }}
7994

@@ -95,13 +110,24 @@ jobs:
95110
run: |
96111
echo "IMAGE_REPOSITORY=$(.scripts/get_repo_name.sh)" | tee -a "$GITHUB_ENV"
97112
98-
- name: Publish and Sign Image Index Manifest to oci.stackable.tech
113+
- name: Publish and Sign Image Index Manifest to oci.stackable.tech/sdp
114+
if: inputs.destination-project == 'sdp'
99115
uses: stackabletech/actions/publish-image-index-manifest@8a8085be0a8cec3d24ad3970e602d65be487da6a # v0.14.1
100116
with:
101117
image-registry-uri: oci.stackable.tech
102118
image-registry-username: robot$sdp+github-action-build
103119
image-registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
104-
image-repository: ${{ format('{0}/{1}', inputs.destination-project, env.IMAGE_REPOSITORY) }}
120+
image-repository: ${{ format('sdp/{0}', env.IMAGE_REPOSITORY) }}
121+
image-index-manifest-tag: ${{ inputs.image-index-manifest-tag }}
122+
123+
- name: Publish and Sign Image Index Manifest to oci.stackable.tech/stackable
124+
if: inputs.destination-project == 'stackable'
125+
uses: stackabletech/actions/publish-image-index-manifest@8a8085be0a8cec3d24ad3970e602d65be487da6a # v0.14.1
126+
with:
127+
image-registry-uri: oci.stackable.tech
128+
image-registry-username: robot$stackable+github-action-build
129+
image-registry-password: ${{ secrets.HARBOR_ROBOT_STACKABLE_GITHUB_ACTION_BUILD_SECRET }}
130+
image-repository: ${{ format('stackable/{0}', env.IMAGE_REPOSITORY) }}
105131
image-index-manifest-tag: ${{ inputs.image-index-manifest-tag }}
106132

107133
# NOTE (@Techassi) It is currently not possible to use our own action here, because the inputs

0 commit comments

Comments
 (0)