From ca835c6b15cb60abc8914da840cde3d108e3cc32 Mon Sep 17 00:00:00 2001 From: Gustavo Hidalgo Date: Mon, 1 Apr 2024 17:02:20 -0400 Subject: [PATCH] CI: put authentication in a script --- .github/workflows/cicd.yml | 5 +---- scripts/ciauthenticate | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 scripts/ciauthenticate diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 2f1eb0dc..475f402e 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -32,10 +32,7 @@ jobs: env: CLIENT_ID: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientId }} CLIENT_SECRET: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientSecret }} - run: - sudo curl -sL https://aka.ms/InstallAzureCLIDeb | bash && \ - az acr login --name pcccr --username ${CLIENT_ID} --password ${CLIENT_SECRET} && \ - docker login pcccr.azurecr.io --username ${CLIENT_ID} --password ${CLIENT_SECRET} + run: ./scripts/ciauthenticate - name: Publish images run: ./scripts/cipublish --acr pcccr --tag ${{steps.get_image_tag.outputs.tag}} diff --git a/scripts/ciauthenticate b/scripts/ciauthenticate new file mode 100755 index 00000000..85658888 --- /dev/null +++ b/scripts/ciauthenticate @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +if [[ "${CI}" ]]; then + set -x +fi + +function usage() { + echo -n \ + "Usage: $(basename "$0") +CI authentication for this project. +" +} + +sudo curl -sL https://aka.ms/InstallAzureCLIDeb | bash +az acr login --name pcccr --username ${CLIENT_ID} --password ${CLIENT_SECRET} +docker login pcccr.azurecr.io --username ${CLIENT_ID} --password ${CLIENT_SECRET} \ No newline at end of file