1
0
Fork 0

Use flock instead of checking for running pulls using pgrep
Some checks failed
/ build-kde (push) Failing after 2m9s
/ build-gnome (push) Failing after 2m4s

The previous solution is potentially racey, it only prevents starting a
pull if there is already one running, but there is still a tiny window
of time where both pulls could start after the checks and run at the
same time. This new solution should fill that gap, since the locking
should be atomic.
This commit is contained in:
ver4a 2024-11-18 11:05:48 +01:00
parent b1ac8a8332
commit dc28e9f75e

View file

@ -12,8 +12,7 @@ jobs:
# base
- run: mkdir cache
# Waits for all "podman pull"s to exit before starting a pull
- run: while [[ $(pgrep -f '^podman pull') ]]; do sleep 2; done
- run: podman pull quay.io/fedora-ostree-desktops/kinoite:41
- run: flock -x /tmp/CI-podman-pull-lock -c 'podman pull quay.io/fedora-ostree-desktops/kinoite:41'
- run: podman build . -f Dockerfile.kde --no-cache --pull=never -v ${PWD}/cache:/var/cache/libdnf5:Z --squash -t ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-kde:main
- run: podman push --compression-format=zstd --compression-level=${{ vars.COMPRESSION_LEVEL }} ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-kde:main ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-kde:main
# base + nvidia
@ -36,8 +35,7 @@ jobs:
# base
- run: mkdir cache
# Waits for all "podman pull"s to exit before starting a pull
- run: while [[ $(pgrep -f '^podman pull') ]]; do sleep 2; done
- run: podman pull quay.io/fedora-ostree-desktops/silverblue:41
- run: flock -x /tmp/CI-podman-pull-lock -c 'podman pull quay.io/fedora-ostree-desktops/silverblue:41'
- run: podman build . -f Dockerfile.gnome --no-cache --pull=never -v ${PWD}/cache:/var/cache/libdnf5:Z --squash -t ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-gnome:main
- run: podman push --compression-format=zstd --compression-level=${{ vars.COMPRESSION_LEVEL }} ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-gnome:main ${{ vars.REGISTRY_DOMAIN }}/ver4a/onc-gnome:main
# base + nvidia