Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tagging of image #1240

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 7 additions & 38 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,28 +151,7 @@ jobs:

- name: Wait for 2 minutes while the network rule to take effect
run: |
sleep 120

- name: Wait for Specific IP in ACR Network Rules
run: |
MAX_ATTEMPTS=10
ATTEMPT=0
TARGET_IP="${{ steps.github_public_ip.outputs.ipv4 }}"
echo "Waiting for IP $TARGET_IP to be allowed in ACR network rules..."
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
NETWORK_RULES=$(az acr network-rule list --name ${{matrix.target.acr-name}} --subscription ${{ matrix.target.subscription-id }} --query "ipRules[]|[?contains(ipAddressOrRange, '$TARGET_IP')]" --output tsv)
if [ -n "$NETWORK_RULES" ]; then
echo "IP $TARGET_IP is allowed."
break
fi
echo "Attempt $((ATTEMPT+1)) of $MAX_ATTEMPTS. Retrying in 10 seconds..."
ATTEMPT=$((ATTEMPT+1))
sleep 10
done
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
echo "IP $TARGET_IP was not allowed after $MAX_ATTEMPTS attempts. Exiting."
exit 1
fi
sleep 30

- name: Build image tags
id: metadata
Expand All @@ -183,23 +162,13 @@ jobs:
- name: ACR Login
run: az acr login --name ${{ matrix.target.acr-name }}

- name: Pull Operator
run: docker pull ${{ needs.build-operator.outputs.fullname }}

- name: Pull Pipelinerunner
run: docker pull ${{ needs.build-pipelinerunner.outputs.fullname }}

- name: Re-Tag Operator
run: docker tag ${{ needs.build-operator.outputs.fullname }} ${{ steps.metadata.outputs.operator }}

- name: Re-Tag PipelineRunner
run: docker tag ${{ needs.build-pipelinerunner.outputs.fullname }} ${{ steps.metadata.outputs.pipeline }}

- name: Push Operator to Target Registry
run: docker push ${{ steps.metadata.outputs.operator }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push Pipeline Runner to Target Registry
run: docker push ${{ steps.metadata.outputs.pipeline }}
- name: Copy image
run: docker buildx imagetools create -t ${{ steps.metadata.outputs.operator }} ${{ needs.build-operator.outputs.fullname }}
- name: Copy image
run: docker buildx imagetools create -t ${{ steps.metadata.outputs.pipeline }} ${{ needs.build-pipelinerunner.outputs.fullname }}

- name: Revoke GitHub IP on ACR
if: ${{ steps.update_firewall.outcome == 'success' && !cancelled()}} # Always run this step even if previous step failed
Expand Down
Loading