Skip to content

ci: Retry the buildroot fetch and share the retry loop - #91

Draft
cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41757414985
Draft

cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41757414985

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

Part of #87

The RPM and metalink flakes in the package, test-container-export, test-baseconfigs and test-integration jobs come from podman builds that fetch over the network without the retry loop build-fetch already has. This moves that loop out of build-fetch into hack/ci-retry so more than one recipe can use it. It also adds just package-fetch, which runs the buildroot stage (install-buildroot and cargo fetch, both before the --network=none cutoff) with retries and the same base_buildargs as just package, so the package build and its reproducibility check get a cache hit.

Without the workflow change below, nothing in CI calls package-fetch yet. This run cannot change files under .github/, so the diff below needs to be applied by hand. It adds a retried fetch before check-buildsys in the package job and a build-fetch step before the build in test-container-export and test-baseconfigs. In test-integration, it re-runs build-fetch after podman builder prune -af, because the prune removes the fetch layer that the TMT step's just build then needs again. It also sets BOOTC_SKIP_PACKAGE=1 on the TMT step. Without that, the step rebuilt the RPMs from source and ran the buildroot fetch again with no retry. TMT now tests the RPM artifacts from the package job, the same ones the earlier steps in that job use.

A package that is really missing is still retried until BOOTC_CI_RETRIES runs out, as build-fetch already does. With CI's 10 x 60s, that also means a deterministic buildroot or cargo fetch failure in the package job takes about 9 minutes longer to report. dnf's and podman's output is still shown on every attempt.

Verified with just --dry-run on package-fetch and build-fetch, shellcheck on hack/ci-retry, a local run of the script against a failing and a passing command, and a YAML parse of the edited workflow. actionlint is not installed and no podman build was run, so the cache hits were worked out from the build args, not observed.

Review: one pass, no blockers. Follow-ups it noted: just validate and the tools stage of tmt/tests/Dockerfile.upgrade also fetch without retry; package could use _local-deps-args so its args cannot drift from package-fetch's; the test-integration re-fetch also rebuilds the unused upgrade-source fetch stage.

Caller settings

Repository cgwalters-forge/bootc, file .github/workflows/ci.yml:

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 84006f0..685a47e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -270,6 +270,9 @@ jobs:
           printf 'BOOTC_base=%s\n' "$BASE" >> "$GITHUB_ENV"
           printf 'BOOTC_buildroot_base=%s\n' "$BUILDROOT_BASE" >> "$GITHUB_ENV"
 
+      - name: Fetch package buildroot (with retry)
+        run: just package-fetch
+
       - name: Build packages (and verify build system)
         run: just check-buildsys
 
@@ -402,7 +405,13 @@ jobs:
       - name: Reclaim disk space before TMT
         run: podman builder prune -af
 
+      # The prune above dropped the fetch layer; the TMT step rebuilds the image.
+      - name: Re-fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Run TMT integration tests
+        env:
+          BOOTC_SKIP_PACKAGE: "1"
         run: |
           if [[ "${{ matrix.variant }}" = composefs ]]; then
             just test-composefs "${{ matrix.bootloader }}"  "${{ matrix.filesystem }}" "${{ matrix.boot_type }}" "${{ matrix.seal_state }}"
@@ -541,6 +550,9 @@ jobs:
           name: packages-${{ matrix.test_os }}
           path: target/packages/
 
+      - name: Fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Build container with baseconfig
         run: BOOTC_SKIP_PACKAGE=1 just build
 
@@ -644,6 +656,9 @@ jobs:
           name: packages-centos-10
           path: target/packages/
 
+      - name: Fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Build and run container export test
         run: |
           BOOTC_SKIP_PACKAGE=1 just test-container-export

Generated by dispatch · ◷

Part of bootc-dev#87

The RPM and metalink flakes in the package, test-container-export, test-baseconfigs and test-integration jobs come from podman builds that fetch over the network without the retry loop `build-fetch` already has. This moves that loop out of `build-fetch` into `hack/ci-retry` so more than one recipe can use it. It also adds `just package-fetch`, which runs the `buildroot` stage (install-buildroot and `cargo fetch`, both before the `--network=none` cutoff) with retries and the same `base_buildargs` as `just package`, so the package build and its reproducibility check get a cache hit.

Without the workflow change below, nothing in CI calls `package-fetch` yet. This run cannot change files under `.github/`, so the diff below needs to be applied by hand. It adds a retried fetch before `check-buildsys` in the package job and a `build-fetch` step before the build in test-container-export and test-baseconfigs. In test-integration, it re-runs `build-fetch` after `podman builder prune -af`, because the prune removes the fetch layer that the TMT step's `just build` then needs again. It also sets `BOOTC_SKIP_PACKAGE=1` on the TMT step. Without that, the step rebuilt the RPMs from source and ran the buildroot fetch again with no retry. TMT now tests the RPM artifacts from the package job, the same ones the earlier steps in that job use.

A package that is really missing is still retried until `BOOTC_CI_RETRIES` runs out, as `build-fetch` already does. With CI's 10 x 60s, that also means a deterministic buildroot or `cargo fetch` failure in the package job takes about 9 minutes longer to report. dnf's and podman's output is still shown on every attempt.

Verified with `just --dry-run` on `package-fetch` and `build-fetch`, shellcheck on `hack/ci-retry`, a local run of the script against a failing and a passing command, and a YAML parse of the edited workflow. actionlint is not installed and no podman build was run, so the cache hits were worked out from the build args, not observed.

Review: one pass, no blockers. Follow-ups it noted: `just validate` and the `tools` stage of `tmt/tests/Dockerfile.upgrade` also fetch without retry; `package` could use `_local-deps-args` so its args cannot drift from `package-fetch`'s; the test-integration re-fetch also rebuilds the unused upgrade-source fetch stage.

## Caller settings

Repository cgwalters-forge/bootc, file `.github/workflows/ci.yml`:

```diff
    diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 84006f0..685a47e 100644
    --- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
    @@ -270,6 +270,9 @@ jobs:
           printf 'BOOTC_base=%s\n' "$BASE" >> "$GITHUB_ENV"
           printf 'BOOTC_buildroot_base=%s\n' "$BUILDROOT_BASE" >> "$GITHUB_ENV"

+      - name: Fetch package buildroot (with retry)
+        run: just package-fetch
+
       - name: Build packages (and verify build system)
         run: just check-buildsys

    @@ -402,7 +405,13 @@ jobs:
       - name: Reclaim disk space before TMT
         run: podman builder prune -af

+      # The prune above dropped the fetch layer; the TMT step rebuilds the image.
+      - name: Re-fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Run TMT integration tests
+        env:
+          BOOTC_SKIP_PACKAGE: "1"
         run: |
           if [[ "${{ matrix.variant }}" = composefs ]]; then
             just test-composefs "${{ matrix.bootloader }}"  "${{ matrix.filesystem }}" "${{ matrix.boot_type }}" "${{ matrix.seal_state }}"
    @@ -541,6 +550,9 @@ jobs:
           name: packages-${{ matrix.test_os }}
           path: target/packages/

+      - name: Fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Build container with baseconfig
         run: BOOTC_SKIP_PACKAGE=1 just build

    @@ -644,6 +656,9 @@ jobs:
           name: packages-centos-10
           path: target/packages/

+      - name: Fetch external dependencies (with retry)
+        run: BOOTC_SKIP_PACKAGE=1 just build-fetch
+
       - name: Build and run container export test
         run: |
           BOOTC_SKIP_PACKAGE=1 just test-container-export
```

Generated-by: https://github.com/cgwalters/#llms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:quick High-confidence bot draft: skim and approve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant