Skip to content

Commit

Permalink
CI: put authentication in a script
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidalgo3 committed Apr 1, 2024
1 parent 995f686 commit ca835c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
18 changes: 18 additions & 0 deletions scripts/ciauthenticate
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit ca835c6

Please sign in to comment.