danbev commited on
Commit
fc20738
·
unverified ·
1 Parent(s): 6468892

ci: set fail-fast to false in docker.yml (#3294)

Browse files

* ci: set fail-fast to false in docker.yml

This commit modifies the GitHub Actions workflow for Docker builds to
disable the fail-fast behavior.

The motivation for this is that currently if one of the strategy jobs
fails any other job that is in progress will be cancelled. There is no
need for this as the jobs are independent.

* ci : update docker.yml to use a single build

This commit updates the docker job to only build the image once instead
of twice (only happens when pushing to the master branch). Instead this
will tag the image with the commit SHA when pushing to master.

The motivation for this change is to reduce the time it takes to run
this job and also it might help with the disk space issues we are
experiencing for this job when it runs on pushes to master.

Files changed (1) hide show
  1. .github/workflows/docker.yml +11 -11
.github/workflows/docker.yml CHANGED
@@ -15,6 +15,7 @@ jobs:
15
  env:
16
  COMMIT_SHA: ${{ github.sha }}
17
  strategy:
 
18
  matrix:
19
  config:
20
  - { tag: "main", dockerfile: ".devops/main.Dockerfile", platform: "linux/amd64" }
@@ -41,21 +42,20 @@ jobs:
41
  username: ${{ github.repository_owner }}
42
  password: ${{ secrets.GITHUB_TOKEN }}
43
 
44
- - name: Build and push Docker image (versioned)
45
- if: github.event_name == 'push'
46
- uses: docker/build-push-action@v5
47
- with:
48
- context: .
49
- push: true
50
- platforms: ${{ matrix.config.platform }}
51
- tags: "ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
52
- file: ${{ matrix.config.dockerfile }}
53
 
54
  - name: Build and push Docker image (tagged)
55
- uses: docker/build-push-action@v4
56
  with:
57
  context: .
58
  push: ${{ github.event_name == 'push' }}
59
  platforms: ${{ matrix.config.platform }}
60
- tags: "ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}"
61
  file: ${{ matrix.config.dockerfile }}
 
15
  env:
16
  COMMIT_SHA: ${{ github.sha }}
17
  strategy:
18
+ fail-fast: false
19
  matrix:
20
  config:
21
  - { tag: "main", dockerfile: ".devops/main.Dockerfile", platform: "linux/amd64" }
 
42
  username: ${{ github.repository_owner }}
43
  password: ${{ secrets.GITHUB_TOKEN }}
44
 
45
+ - name: Generate tags
46
+ id: tags
47
+ run: |
48
+ TAGS="ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}"
49
+ if [ "${{ github.event_name }}" == "push" ]; then
50
+ TAGS="$TAGS,ghcr.io/${{ github.repository }}:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
51
+ fi
52
+ echo "tags=$TAGS" >> $GITHUB_OUTPUT
 
53
 
54
  - name: Build and push Docker image (tagged)
55
+ uses: docker/build-push-action@v5
56
  with:
57
  context: .
58
  push: ${{ github.event_name == 'push' }}
59
  platforms: ${{ matrix.config.platform }}
60
+ tags: ${{ steps.tags.outputs.tags }}
61
  file: ${{ matrix.config.dockerfile }}