Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
chore: Fix container image workflow concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
cdata committed Mar 9, 2023
1 parent e3e3145 commit d74e0c0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/container_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
name: 'Determine image tags'
outputs:
tags: ${{ steps.determine-image-tags.outputs.tags }}
concurrency: ${{ steps.determine-image-tags.outputs.concurrency }}
runs-on: ubuntu-latest
steps:
- id: determine-image-tags
Expand All @@ -24,14 +25,18 @@ jobs:
PR_NUMBER: ${{ github.event.number }}
CUSTOM_TAG: ${{ inputs.image-tag }}
run: |
concurrency="docker-build"
tags=()
if [[ "$EVENT_NAME" == "pull_request" ]]; then
tags+=("pr-$PR_NUMBER")
concurrency="$concurrency-pr-$PR_NUMBER"
fi
if [[ "$IMAGE_TAG" != "" ]]; then
tags+=("$IMAGE_TAG")
concurrency="$concurrency-$IMAGE_TAG"
fi
tags_out=""
Expand All @@ -45,22 +50,24 @@ jobs:
done
echo "TAGS: $tags_out"
echo "CONCURRENCY: $concurrency"
echo -n "tags=[$tags_out]" >> $GITHUB_OUTPUT
echo "tags=[$tags_out]" >> $GITHUB_OUTPUT
echo "concurrency=\"$concurrency\"" >> $GITHUB_OUTPUT
build-and-push:
name: 'Build and push'
runs-on: ubuntu-latest
needs: ['determine-image-tags']
concurrency: 'docker-build'
concurrency: ${{ needs.determine-image-tags.outputs.concurrency }}
permissions:
contents: 'read'
id-token: 'write'
strategy:
matrix:
image:
- name: 'orb'
file: 'images/orb/Dockerfile'
file: 'images/orb/Dockerfile'
- name: 'orb-ns'
file: 'images/orb-ns/Dockerfile'
tag: ${{ fromJSON(needs.determine-image-tags.outputs.tags) }}
Expand Down

0 comments on commit d74e0c0

Please sign in to comment.