Skip to content

Test caching docker images#311

Closed
Sheikah45 wants to merge 1 commit intodevelopfrom
cache-images
Closed

Test caching docker images#311
Sheikah45 wants to merge 1 commit intodevelopfrom
cache-images

Conversation

@Sheikah45
Copy link
Copy Markdown
Member

@Sheikah45 Sheikah45 commented May 7, 2026

Summary by CodeRabbit

  • Chores
    • Improved Docker image caching in CI/CD pipeline for faster build and deployment times.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

📝 Walkthrough

Walkthrough

The PR adds a Docker image caching step to the CI workflow using the ScribeMD/docker-cache action, positioned between Helm output caching and test execution, with cache keys based on the branch name.

Changes

CI Docker Cache

Layer / File(s) Summary
Workflow Configuration
.github/workflows/checks.yml
A new "Cache Docker Images" step using ScribeMD/docker-cache@0.5.0 is inserted after Helm output caching and before tilt ci execution, with cache key set to github.ref_name.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • FAForever/gitops-stack#310: Modifies the same workflow file; this PR's Docker cache step is explicitly positioned after that PR's Helm output cache step.

Poem

🐰 A caching spell, so swift and neat,
Docker images tucked, complete!
Branch by branch, the cache does grow,
CI speeds faster than a hare's paw flow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding Docker image caching to the GitHub Actions workflow.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cache-images

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In @.github/workflows/checks.yml:
- Line 35: Replace the mutable action reference "uses:
ScribeMD/docker-cache@0.5.0" with an immutable commit SHA by pinning to the
action's exact commit (e.g., "uses: ScribeMD/docker-cache@<commit-sha>"); update
the line where the action is referenced so the workflow uses the full commit
hash instead of the version tag to prevent supply-chain drift and optionally run
the workflow to verify the SHA is correct.
- Line 37: The Docker cache key currently uses only the Git ref (key: ${{
github.ref_name }}) which can cause stale images across branches; update the
cache key generation to include the repository Tiltfile (and any other
image-defining config files) in its hash instead of the broad
`.github/workflows/checks.yml` or the unnecessary `**/Dockerfile*`
pattern—locate where `key: ${{ github.ref_name }}` is defined in the workflow
and append a hash of the Tiltfile (and any specific image config files) to the
key so the cache invalidates when those files change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 310e39a1-8b35-4519-ab4e-da7fe88ed2be

📥 Commits

Reviewing files that changed from the base of the PR and between 435b5a7 and 3114be1.

📒 Files selected for processing (1)
  • .github/workflows/checks.yml

${{ github.base_ref }}

- name: Cache Docker Images
uses: ScribeMD/docker-cache@0.5.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the full commit SHA currently referenced by the GitHub Action tag ScribeMD/docker-cache@0.5.0?

💡 Result:

The GitHub Action tag ScribeMD/docker-cache@0.5.0 currently points to commit SHA fb28c93772363301b8d0a6072ce850224b73f74e [1][2]. This SHA is shown on GitHub’s tag listing for 0.5.0 (short form fb28c93) [1] and as the full 40-character commit in a workflow that uses uses: ScribeMD/docker-cache@0.5.0 [2].

Citations:


Pin ScribeMD/docker-cache to the immutable commit SHA.

Using @0.5.0 (a tag) is mutable and introduces supply-chain drift risk; CI behavior can change without code changes. Pin to the commit SHA instead.

Suggested patch
-      - name: Cache Docker Images
-        uses: ScribeMD/docker-cache@0.5.0
+      - name: Cache Docker Images
+        # v0.5.0
+        uses: ScribeMD/docker-cache@fb28c93772363301b8d0a6072ce850224b73f74e
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: ScribeMD/docker-cache@0.5.0
- name: Cache Docker Images
# v0.5.0
uses: ScribeMD/docker-cache@fb28c93772363301b8d0a6072ce850224b73f74e
🤖 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 @.github/workflows/checks.yml at line 35, Replace the mutable action
reference "uses: ScribeMD/docker-cache@0.5.0" with an immutable commit SHA by
pinning to the action's exact commit (e.g., "uses:
ScribeMD/docker-cache@<commit-sha>"); update the line where the action is
referenced so the workflow uses the full commit hash instead of the version tag
to prevent supply-chain drift and optionally run the workflow to verify the SHA
is correct.

- name: Cache Docker Images
uses: ScribeMD/docker-cache@0.5.0
with:
key: ${{ github.ref_name }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/checks.yml

Repository: FAForever/gitops-stack

Length of output: 1183


🏁 Script executed:

find . -name "Tiltfile" -o -name "Dockerfile*" | head -20

Repository: FAForever/gitops-stack

Length of output: 77


🏁 Script executed:

# Check what Docker image definitions exist
fd -t f -e Dockerfile -o -name "Tiltfile" | head -20

Repository: FAForever/gitops-stack

Length of output: 297


🏁 Script executed:

# Get repository structure overview
git ls-files | grep -E "(Tiltfile|Dockerfile)" | head -20

Repository: FAForever/gitops-stack

Length of output: 75


🏁 Script executed:

git ls-files | grep -i dockerfile

Repository: FAForever/gitops-stack

Length of output: 48


🏁 Script executed:

# Also check if there are any Dockerfile variants
find . -type f \( -iname "dockerfile*" \) 2>/dev/null

Repository: FAForever/gitops-stack

Length of output: 48


🌐 Web query:

ScribeMD/docker-cache action hashFiles support parameters

💡 Result:

ScribeMD/docker-cache does not have any special “hashFiles support” parameter. What it does support is using GitHub Actions expression functions (like hashFiles) yourself when you set the action’s required input key. 1) Supported inputs - key (required): “The cache key to ferry to the official GitHub cache action” [1][2]. This is where you put something like docker-${{ runner.os }}-${{ hashFiles('docker-compose.yaml') }} (shown in the action docs as an example key strategy) [3][4]. - read-only (optional, default: false): If true, disables saving the cache upon cache miss [1][4]. 2) Using hashFiles with this action Example from the action docs: - name: Cache Docker images uses: ScribeMD/docker-cache@0.5.0 with: key: docker-${{ runner.os }}-${{ hashFiles(paths) }} [3][4] The docs also recommend changing the key to a “fast function of your Docker image versions”, giving hashFiles('docker-compose.yaml') as the idea [3][4]. 3) What is NOT supported - restore-keys is not supported by this action [1][4]. The README/action.yaml explicitly says partial cache restoration via restore-keys is not supported due to a “snowball” effect [1][4]. 4) Related behavior notes (for context) - This action caches images (pulled/built) but “does not perform Docker layer caching” [4][3]. If you paste your current workflow snippet (the uses: step and your with: block), I can suggest an exact key expression that matches the files that define which images/tags you pull or build.

Citations:


🏁 Script executed:

cat -n Tiltfile | head -100

Repository: FAForever/gitops-stack

Length of output: 5443


🏁 Script executed:

cat Tiltfile | grep -i "docker\|image" | head -30

Repository: FAForever/gitops-stack

Length of output: 433


🏁 Script executed:

# Check the full Tiltfile size and content
wc -l Tiltfile

Repository: FAForever/gitops-stack

Length of output: 79


🏁 Script executed:

cat Tiltfile | grep -E "docker_build|image:|load\(|local_resource" | head -20

Repository: FAForever/gitops-stack

Length of output: 754


🏁 Script executed:

# Check if there are any Docker image references or build definitions
rg "image:" Tiltfile -A 2 -B 2 | head -40

Repository: FAForever/gitops-stack

Length of output: 48


🏁 Script executed:

# Search for docker_build or any image building directives
rg "docker_build|load\(" Tiltfile

Repository: FAForever/gitops-stack

Length of output: 48


🏁 Script executed:

# Check the .github/workflows/checks.yml workflow more carefully for what gets cached
cat -n .github/workflows/checks.yml | tail -20

Repository: FAForever/gitops-stack

Length of output: 674


🏁 Script executed:

# Look for any Helm chart references that might define docker images
find . -name "values*.yaml" -o -name "Chart.yaml" | head -10

Repository: FAForever/gitops-stack

Length of output: 359


🏁 Script executed:

# Check what the tilt ci command does - look for references in Tiltfile
rg "ci\|CI" Tiltfile | head -10

Repository: FAForever/gitops-stack

Length of output: 48


🏁 Script executed:

# Look at Helm values to see what images are being pulled
head -50 ./apps/faf-api/values.yaml

Repository: FAForever/gitops-stack

Length of output: 100


🏁 Script executed:

# Check if Tiltfile has any references to pulling/loading docker images
rg "pull|load|docker" Tiltfile -i | head -20

Repository: FAForever/gitops-stack

Length of output: 2775


🏁 Script executed:

# Get a broader view of what Helm charts are used
find ./apps -name "values*.yaml" -type f | wc -l

Repository: FAForever/gitops-stack

Length of output: 69


🏁 Script executed:

# Check if Helm values or Chart files change between branches might require cache invalidation
ls -la ./apps/*/values*.yaml | head -5

Repository: FAForever/gitops-stack

Length of output: 458


🏁 Script executed:

# Verify the scope of Helm chart usage
rg "helm_with_build_cache\|k8s_yaml" Tiltfile | wc -l

Repository: FAForever/gitops-stack

Length of output: 68


Include configuration files in Docker cache key to prevent stale images across branches.

The Docker cache key currently depends only on github.ref_name, allowing images cached on one branch to be reused on another even when Tilt or Kubernetes configurations change. Include the Tiltfile in the cache hash. The pattern **/Dockerfile* is unnecessary (no Dockerfiles exist in this repository). Including .github/workflows/checks.yml in the key is overly broad; focus on files that define which images are deployed.

Suggested patch
-          key: ${{ github.ref_name }}
+          key: docker-${{ github.ref_name }}-${{ hashFiles('Tiltfile') }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
key: ${{ github.ref_name }}
key: docker-${{ github.ref_name }}-${{ hashFiles('Tiltfile') }}
🤖 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 @.github/workflows/checks.yml at line 37, The Docker cache key currently uses
only the Git ref (key: ${{ github.ref_name }}) which can cause stale images
across branches; update the cache key generation to include the repository
Tiltfile (and any other image-defining config files) in its hash instead of the
broad `.github/workflows/checks.yml` or the unnecessary `**/Dockerfile*`
pattern—locate where `key: ${{ github.ref_name }}` is defined in the workflow
and append a hash of the Tiltfile (and any specific image config files) to the
key so the cache invalidates when those files change.

@Sheikah45 Sheikah45 closed this May 7, 2026
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