Skip to content

Commit

Permalink
Ensure that az-login has been run before docker login and push (#4025)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthchr authored May 21, 2024
1 parent c61dfd3 commit 9071bdd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/create-release-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,10 @@ jobs:
`mcr.microsoft.com/k8s/azureserviceoperator:experimental`, which is always being updated. Test what you want to test and then uninstall the operator.
Running the operator for long periods of time on the `experimental` tag is not supported and will likely cause problems eventually.
- name: Docker login
run: |
container_id=${{env.container_id}}
docker exec -e DOCKER_REGISTRY "$container_id" task VERSION=${{ env.ARTIFACT_VERSION }} LATEST_VERSION_TAG=${{ env.ARTIFACT_VERSION }} docker-login
env:
DOCKER_REGISTRY: ${{ secrets.REGISTRY_LOGIN }}

- name: Build, tag and push docker image
run: |
container_id=${{env.container_id}}
docker exec -e DOCKER_PUSH_TARGET "$container_id" task VERSION=${{ env.ARTIFACT_VERSION }} LATEST_VERSION_TAG=${{ env.ARTIFACT_VERSION }} controller:docker-push-multiarch
docker exec -e GITHUB_ACTIONS -e DOCKER_REGISTRY -e DOCKER_PUSH_TARGET "$container_id" task VERSION=${{ env.ARTIFACT_VERSION }} LATEST_VERSION_TAG=${{ env.ARTIFACT_VERSION }} controller:docker-push-multiarch
env:
DOCKER_PUSH_TARGET: ${{ secrets.REGISTRY_PUBLIC }}
DOCKER_REGISTRY: ${{ secrets.REGISTRY_LOGIN }}
10 changes: 2 additions & 8 deletions .github/workflows/create-release-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,13 @@ jobs:
file: "v2/out/release/*"
file_glob: true

- name: Docker login
run: |
container_id=${{env.container_id}}
docker exec -e DOCKER_REGISTRY "$container_id" task docker-login
env:
DOCKER_REGISTRY: ${{ secrets.REGISTRY_LOGIN }}

- name: Build, tag and push docker image
run: |
container_id=${{env.container_id}}
docker exec -e DOCKER_PUSH_TARGET "$container_id" task controller:docker-push-multiarch
docker exec -e GITHUB_ACTIONS -e DOCKER_REGISTRY -e DOCKER_PUSH_TARGET "$container_id" task controller:docker-push-multiarch
env:
DOCKER_PUSH_TARGET: ${{ secrets.REGISTRY_PUBLIC }}
DOCKER_REGISTRY: ${{ secrets.REGISTRY_LOGIN }}

- name: Protect image
run: |
Expand Down
3 changes: 3 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ tasks:
desc: Builds, tags and pushes the multi architecture controller container image to repository
deps:
- controller:bundle-crds
- docker-login
dir: "{{.CONTROLLER_ROOT}}"
run: always
cmds:
Expand Down Expand Up @@ -1157,6 +1158,8 @@ tasks:

docker-login:
desc: Docker login
deps:
- az-login
cmds:
- 'if [ -z "{{.DOCKER_REGISTRY}}" ]; then echo "Error: DOCKER_REGISTRY must be set"; exit 1; fi'
- az acr login --name {{.DOCKER_REGISTRY}}
Expand Down

0 comments on commit 9071bdd

Please sign in to comment.