diff --git a/.github/actions/build_micro_service/action.yml b/.github/actions/build_micro_service/action.yml index f5a56a2dd..1ae3d8196 100644 --- a/.github/actions/build_micro_service/action.yml +++ b/.github/actions/build_micro_service/action.yml @@ -54,7 +54,7 @@ runs: - name: Log in to the Container registry id: docker-login - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.github/actions/container_registry_login/action.yml b/.github/actions/container_registry_login/action.yml new file mode 100644 index 000000000..de414e5d0 --- /dev/null +++ b/.github/actions/container_registry_login/action.yml @@ -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 diff --git a/.github/actions/e2e_mini/action.yml b/.github/actions/e2e_mini/action.yml index 5b8b7f45f..652217282 100644 --- a/.github/actions/e2e_mini/action.yml +++ b/.github/actions/e2e_mini/action.yml @@ -36,7 +36,7 @@ runs: buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }} - name: Log in to the Container registry - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ${{ inputs.registry }} username: ${{ github.actor }} diff --git a/.github/actions/e2e_test/action.yml b/.github/actions/e2e_test/action.yml index d3fe7342e..51cabcef1 100644 --- a/.github/actions/e2e_test/action.yml +++ b/.github/actions/e2e_test/action.yml @@ -117,7 +117,7 @@ runs: buildBuddyApiKey: ${{ inputs.buildBuddyApiKey }} - name: Log in to the Container registry - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ${{ inputs.registry }} username: ${{ github.actor }} @@ -192,7 +192,7 @@ runs: id: create-prefix shell: bash run: | - uuid=$(uuidgen) + uuid=$(uuidgen | tr "[:upper:]" "[:lower:]") uuid=${uuid%%-*} echo "uuid=${uuid}" | tee -a $GITHUB_OUTPUT echo "prefix=e2e-${{ github.run_id }}-${{ github.run_attempt }}-${uuid}" | tee -a $GITHUB_OUTPUT diff --git a/.github/workflows/build-ccm-gcp.yml b/.github/workflows/build-ccm-gcp.yml index 6c40e6cf4..82461b357 100644 --- a/.github/workflows/build-ccm-gcp.yml +++ b/.github/workflows/build-ccm-gcp.yml @@ -41,7 +41,7 @@ jobs: - name: Log in to the Container registry id: docker-login - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} diff --git a/.github/workflows/build-gcp-guest-agent.yml b/.github/workflows/build-gcp-guest-agent.yml index 9bc5097a4..4cfb23cac 100644 --- a/.github/workflows/build-gcp-guest-agent.yml +++ b/.github/workflows/build-gcp-guest-agent.yml @@ -100,7 +100,7 @@ jobs: - name: Log in to the Container registry id: docker-login if: steps.needs-build.outputs.out == 'true' - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} diff --git a/.github/workflows/e2e-test-manual.yml b/.github/workflows/e2e-test-manual.yml index d8f14e3ca..3c88f559d 100644 --- a/.github/workflows/e2e-test-manual.yml +++ b/.github/workflows/e2e-test-manual.yml @@ -241,7 +241,7 @@ jobs: machineType: ${{ inputs.machineType }} gcpProject: ${{ secrets.GCP_E2E_PROJECT }} gcpClusterCreateServiceAccount: "constellation-e2e-cluster@constellation-331613.iam.gserviceaccount.com" - gcpIAMCreateServiceAccount: " constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" + gcpIAMCreateServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" gcpInClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} test: ${{ inputs.test }} kubernetesVersion: ${{ inputs.kubernetesVersion }} diff --git a/.github/workflows/e2e-test-release.yml b/.github/workflows/e2e-test-release.yml index 3e9ae1e6e..dc038b7fd 100644 --- a/.github/workflows/e2e-test-release.yml +++ b/.github/workflows/e2e-test-release.yml @@ -197,7 +197,7 @@ jobs: awsOpenSearchPwd: ${{ secrets.AWS_OPENSEARCH_PWD }} gcpProject: ${{ secrets.GCP_E2E_PROJECT }} gcpClusterCreateServiceAccount: "constellation-e2e-cluster@constellation-331613.iam.gserviceaccount.com" - gcpIAMCreateServiceAccount: " constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" + gcpIAMCreateServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" gcpInClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} test: ${{ matrix.test }} buildBuddyApiKey: ${{ secrets.BUILDBUDDY_ORG_API_KEY }} diff --git a/.github/workflows/e2e-test-weekly.yml b/.github/workflows/e2e-test-weekly.yml index 6fabf3cf4..901137d55 100644 --- a/.github/workflows/e2e-test-weekly.yml +++ b/.github/workflows/e2e-test-weekly.yml @@ -199,7 +199,7 @@ jobs: awsOpenSearchPwd: ${{ secrets.AWS_OPENSEARCH_PWD }} gcpProject: ${{ secrets.GCP_E2E_PROJECT }} gcpClusterCreateServiceAccount: "constellation-e2e-cluster@constellation-331613.iam.gserviceaccount.com" - gcpIAMCreateServiceAccount: " constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" + gcpIAMCreateServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com" gcpInClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} test: ${{ matrix.test }} buildBuddyApiKey: ${{ secrets.BUILDBUDDY_ORG_API_KEY }} diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 673658e4a..807fd29cd 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -89,7 +89,7 @@ jobs: useCache: "false" - name: Log in to the Container registry - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0 + uses: ./.github/actions/container_registry_login with: registry: ${{ inputs.registry }} username: ${{ github.actor }}