ci: fix docker-login on macOS runner (#1877)

This commit is contained in:
Malte Poll 2023-06-06 12:20:09 +02:00 committed by GitHub
parent c7b22d314a
commit 025d34a259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 10 deletions

View File

@ -54,7 +54,7 @@ runs:
- name: Log in to the Container registry - name: Log in to the Container registry
id: docker-login id: docker-login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}

View File

@ -0,0 +1,35 @@
name: Create container registry login credentials file
description: Delete previously created IAM configuration.
inputs:
registry:
description: "Container registry to use"
required: true
username:
description: "Username used for authentication."
required: true
password:
description: "Password used for authentication."
required: true
runs:
using: "composite"
steps:
- name: Use docker for logging in
if: runner.os != 'macOS'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: Manually create docker config.json
if: runner.os == 'macOS'
shell: bash
env:
REGISTRY: ${{ inputs.registry }}
USERNAME: ${{ inputs.username }}
PASSWORD: ${{ inputs.password }}
run: |
mkdir -p ~/.docker
echo "{\"auths\":{\"${REGISTRY}\":{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\"}}}" | tee ~/.docker/config.json

View File

@ -36,7 +36,7 @@ runs:
buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }} buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }}
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ${{ inputs.registry }} registry: ${{ inputs.registry }}
username: ${{ github.actor }} username: ${{ github.actor }}

View File

@ -117,7 +117,7 @@ runs:
buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }} buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }}
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ${{ inputs.registry }} registry: ${{ inputs.registry }}
username: ${{ github.actor }} username: ${{ github.actor }}
@ -192,7 +192,7 @@ runs:
id: create-prefix id: create-prefix
shell: bash shell: bash
run: | run: |
uuid=$(uuidgen) uuid=$(uuidgen | tr "[:upper:]" "[:lower:]")
uuid=${uuid%%-*} uuid=${uuid%%-*}
echo "uuid=${uuid}" | tee -a $GITHUB_OUTPUT echo "uuid=${uuid}" | tee -a $GITHUB_OUTPUT
echo "prefix=e2e-${{ github.run_id }}-${{ github.run_attempt }}-${uuid}" | tee -a $GITHUB_OUTPUT echo "prefix=e2e-${{ github.run_id }}-${{ github.run_attempt }}-${uuid}" | tee -a $GITHUB_OUTPUT

View File

@ -41,7 +41,7 @@ jobs:
- name: Log in to the Container registry - name: Log in to the Container registry
id: docker-login id: docker-login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}

View File

@ -100,7 +100,7 @@ jobs:
- name: Log in to the Container registry - name: Log in to the Container registry
id: docker-login id: docker-login
if: steps.needs-build.outputs.out == 'true' if: steps.needs-build.outputs.out == 'true'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}

View File

@ -89,7 +89,7 @@ jobs:
useCache: "false" useCache: "false"
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 uses: ./.github/actions/container_registry_login
with: with:
registry: ${{ inputs.registry }} registry: ${{ inputs.registry }}
username: ${{ github.actor }} username: ${{ github.actor }}