|
190 | 190 |
|
191 | 191 | Note that it is only necessary to pass an auth-token if OIDC-authentication is not |
192 | 192 | possible. OIDC-Authentication should be preferred over using a static token. |
| 193 | + dockerhub-auth-token: |
| 194 | + required: false |
| 195 | + description: | |
| 196 | + An optional authtoken that is harcdcoded to be used for authentication against dockerhub. |
| 197 | + This is often needed in order to avoid running into rate-limits. |
| 198 | +
|
| 199 | + For convenience, if this workflows is called inheriting all secrets, this is read from |
| 200 | + hardcoded secret `DOCKERHUB_RO_AUTH`. If passing secrets explicitly, and auth against |
| 201 | + dockerhub is required, this input must be provided. |
| 202 | +
|
| 203 | + It is passed as-as, and should be the result of base64-encoding `user:secret` |
193 | 204 |
|
194 | 205 | outputs: |
195 | 206 | ocm-resource: |
@@ -345,20 +356,26 @@ jobs: |
345 | 356 | run: | |
346 | 357 | set -euo pipefail |
347 | 358 | # cannot check in if-clause above, as `secrets` ctx is not accessible there |
348 | | - if [ -n '${{ secrets.DOCKERHUB_RO_AUTH }}' ]; then |
| 359 | + if [ -n '${{ secrets.dockerhub-auth-token }}' ]; then |
| 360 | + dockerhub_token='${{ secrets.dockerhub-auth-token }}' |
| 361 | + elif [ -n '${{ secrets.DOCKERHUB_RO_AUTH }}' ]; then |
| 362 | + dockerhub_token='${{ secrets.DOCKERHUB_RO_AUTH }}' |
| 363 | + fi |
| 364 | +
|
| 365 | + if [ -n '${dockerhub_token:-}' ]; then |
349 | 366 | cat <<EOF >> /tmp/config.json |
350 | 367 | { |
351 | 368 | "registry-1.docker.io": { |
352 | | - "auth": "${{ secrets.DOCKERHUB_RO_AUTH }}" |
| 369 | + "auth": "${dockerhub_token}" |
353 | 370 | }, |
354 | 371 | "docker.io": { |
355 | | - "auth": "${{ secrets.DOCKERHUB_RO_AUTH }}" |
| 372 | + "auth": "${dockerhub_token}" |
356 | 373 | }, |
357 | 374 | "index.docker.io": { |
358 | | - "auth": "${{ secrets.DOCKERHUB_RO_AUTH }}" |
| 375 | + "auth": "${dockerhub_token}" |
359 | 376 | }, |
360 | 377 | "https://index.docker.io/v1/": { |
361 | | - "auth": "${{ secrets.DOCKERHUB_RO_AUTH }}" |
| 378 | + "auth": "${dockerhub_token}" |
362 | 379 | } |
363 | 380 | } |
364 | 381 | EOF |
|
0 commit comments