summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorIvan Gabaldon <igabaldon@inetol.net>2025-08-07 10:46:26 +0200
committerGitHub <noreply@github.com>2025-08-07 10:46:26 +0200
commit3de7a6da2dba72057a75d54b4b9fd864dee230e9 (patch)
tree9a3d6c5d42fb8f566be790da2b0597916c10aae0 /.github
parent94256e3383211944d76b52779a950d3365d05647 (diff)
[enh] container: tidy builds (#5086)
Building the container currently does not work properly. When rebuilding several times with `make container`, `version_frozen.py` is recreated, which wouldn't be an issue if the file’s timestamp was constant. Now, when creating `version_frozen.py`, it will have the same timestamp as the commit when it was created. (`version_frozen.py` is moved to a dedicated layer). Reusing "builder" cache when building "dist" could be slow (CD reports 2 seconds, but locally I've seen it take up to 10 seconds), so the Dockerfile is now split and we save a couple steps by importing the "builder" image directly. The last changes made it possible to remove the layer cache in "builder", since the overhead is now greater than building the layers from scratch. Until now, all "dist" layers were squashed into a single layer, which in most cases is a good idea (except for storage/delivery pricing/overhead), but in our case, since we manage the entire pipeline, we can ignore this and share layers between builds. This means (for example) that if we change files unrelated to the container in several consecutive commits (documentation changes), we don't have to push the entire image to registry, but only the different layers (`version_frozen.py` in this example). The same applies when pulling, as only the layers that have changed compared to the local layers will be downloaded (that's the theory, we'll see if this works as expected or if we need to tweak something else).
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/cleanup.yml2
-rw-r--r--.github/workflows/container.yml10
2 files changed, 5 insertions, 7 deletions
diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml
index cb1da86e4..32b34bd96 100644
--- a/.github/workflows/cleanup.yml
+++ b/.github/workflows/cleanup.yml
@@ -34,4 +34,4 @@ jobs:
image-names: "cache"
image-tags: "!searxng*"
cut-off: "1d"
- keep-n-most-recent: "100"
+ keep-n-most-recent: "30"
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
index f1e25aaa8..496130edc 100644
--- a/.github/workflows/container.yml
+++ b/.github/workflows/container.yml
@@ -104,6 +104,8 @@ jobs:
needs: build-base
strategy:
fail-fast: false
+ # Faster runners first to cache arch independent wheels
+ max-parallel: 1
matrix:
include:
- arch: amd64
@@ -121,11 +123,8 @@ jobs:
packages: write
outputs:
- version_string: ${{ steps.build.outputs.version_string }}
- version_tag: ${{ steps.build.outputs.version_tag }}
docker_tag: ${{ steps.build.outputs.docker_tag }}
git_url: ${{ steps.build.outputs.git_url }}
- git_branch: ${{ steps.build.outputs.git_branch }}
steps:
- name: Setup Python
@@ -148,9 +147,8 @@ jobs:
- name: Setup cache container mounts
uses: actions/cache@v4
with:
- # yamllint disable-line rule:line-length
- key: "container-mounts-${{ matrix.arch }}-${{ hashFiles('./container/Dockerfile') }}"
- restore-keys: "container-mounts-${{ matrix.arch }}-"
+ key: "container-mounts-${{ hashFiles('./container/*.dockerfile') }}"
+ restore-keys: "container-mounts-"
path: |
/var/tmp/buildah-cache/
/var/tmp/buildah-cache-*/