Skip to content

Add dnf retry loop to Dockerfile-base.el9 to reduce CI flakiness#539

Open
mason-sharp wants to merge 1 commit into
mainfrom
task/SPOC/docker-dnf
Open

Add dnf retry loop to Dockerfile-base.el9 to reduce CI flakiness#539
mason-sharp wants to merge 1 commit into
mainfrom
task/SPOC/docker-dnf

Conversation

@mason-sharp

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1236e157-ca8b-4a7a-b5ce-3917af0bf4f3

📥 Commits

Reviewing files that changed from the base of the PR and between 6138699 and 4b34a1f.

📒 Files selected for processing (1)
  • tests/docker/Dockerfile-base.el9
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/docker/Dockerfile-base.el9

📝 Walkthrough

Walkthrough

Changes

DNF installation reliability

Layer / File(s) Summary
System tools retry loop
tests/docker/Dockerfile-base.el9
System upgrade and development tools installation retry up to five times, clearing metadata and waiting five seconds between attempts.
Dependency retry loop
tests/docker/Dockerfile-base.el9
The main dependency installation retries up to five times, clearing metadata between attempts and exiting after repeated failures.

Poem

I’m a rabbit with packages to brew,
Five tries hop through when builds turn blue.
DNF waits, then starts anew,
Tools and dependencies make it through,
With carrots of patience in every queue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so relatedness to the changeset cannot be assessed. Add a brief description of the Dockerfile retry change and the CI flakiness it addresses.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the dnf retry loop added to the Dockerfile to reduce CI flakiness.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/SPOC/docker-dnf

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/docker/Dockerfile-base.el9 (1)

68-77: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Clear DNF metadata cache on failure to improve retry resilience.

Transient DNF failures in CI are frequently caused by corrupted or partially downloaded repository metadata, meaning subsequent retries may fail repeatedly if they reuse the same broken cache. Clearing the metadata ensures a fresh fetch from the mirror on the next attempt.

  • tests/docker/Dockerfile-base.el9#L68-L77: Add dnf clean metadata || true; \ before the sleep 5 command to ensure the next loop iteration fetches fresh metadata.
  • tests/docker/Dockerfile-base.el9#L96-L143: Add the same metadata cleanup step before the sleep command in this dependency installation loop.
♻️ Proposed fixes

For tests/docker/Dockerfile-base.el9#L68-L77:

-        if [ "$i" -eq 5 ]; then echo "dnf failed after 5 attempts" >&2; exit 1; fi; \
-        echo "dnf attempt $i failed; retrying in 5s..." >&2; \
+        if [ "$i" -eq 5 ]; then echo "dnf failed after 5 attempts" >&2; exit 1; fi; \
+        echo "dnf attempt $i failed; clearing metadata and retrying in 5s..." >&2; \
+        dnf clean metadata || true; \
         sleep 5; \

For tests/docker/Dockerfile-base.el9#L96-L143:

-        if [ "$i" -eq 5 ]; then echo "dnf failed after 5 attempts" >&2; exit 1; fi; \
-        echo "dnf attempt $i failed; retrying in 5s..." >&2; \
+        if [ "$i" -eq 5 ]; then echo "dnf failed after 5 attempts" >&2; exit 1; fi; \
+        echo "dnf attempt $i failed; clearing metadata and retrying in 5s..." >&2; \
+        dnf clean metadata || true; \
         sleep 5; \
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/docker/Dockerfile-base.el9` around lines 68 - 77, Update both retry
loops in tests/docker/Dockerfile-base.el9 at lines 68-77 and 96-143: before each
existing sleep 5 command, run dnf clean metadata || true so cleanup failures do
not abort the build and the next attempt fetches fresh metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/docker/Dockerfile-base.el9`:
- Around line 68-77: Update both retry loops in tests/docker/Dockerfile-base.el9
at lines 68-77 and 96-143: before each existing sleep 5 command, run dnf clean
metadata || true so cleanup failures do not abort the build and the next attempt
fetches fresh metadata.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e0b0e87-3f3d-46e0-9f75-129ef270184d

📥 Commits

Reviewing files that changed from the base of the PR and between db380dd and 6138699.

📒 Files selected for processing (1)
  • tests/docker/Dockerfile-base.el9

@mason-sharp
mason-sharp force-pushed the task/SPOC/docker-dnf branch from 6138699 to 4b34a1f Compare July 16, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant