Skip to content

Commit

Permalink
ci workflow updated to cancel old jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielFlemstrom committed Sep 6, 2024
1 parent 80637bd commit c9c7f02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main # Trigger on push to the main branch

concurrency:
group: build-and-publish-${{ github.ref }} # Ensure jobs from the same ref (branch) cancel previous ones
cancel-in-progress: true # Cancel any in-progress jobs when a new one starts

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -27,9 +31,10 @@ jobs:
echo "$DOCKER_PASSWORD" | docker login harbor.main.rise-ck8s.com -u "$DOCKER_USER" --password-stdin
- name: Build and push Docker image
id: build_and_push
run: |
docker build -t harbor.main.rise-ck8s.com/des-public/tutorials:latest ./tutorials
docker push harbor.main.rise-ck8s.com/des-public/tutorials:latest
- name: Image digest
run: echo ${{ steps.docker_meta.outputs.digest }}
run: echo "Image digest: ${{ steps.build_and_push.outputs.digest }}"
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
types:
- completed # Trigger only when the build is completed

concurrency:
group: test-notebooks-${{ github.ref }} # Ensure test jobs for the same ref are not duplicated
cancel-in-progress: true # Cancel old tests when a new push is made

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -15,9 +19,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker registry
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
Expand Down

0 comments on commit c9c7f02

Please sign in to comment.