Skip to content

audit: idempotency, consistency, and hardening improvements#10

Merged
atngit2 merged 7 commits intomainfrom
audit/idempotency-and-consistency
Apr 1, 2026
Merged

audit: idempotency, consistency, and hardening improvements#10
atngit2 merged 7 commits intomainfrom
audit/idempotency-and-consistency

Conversation

@atngit2
Copy link
Copy Markdown
Contributor

@atngit2 atngit2 commented Apr 1, 2026

Summary

Comprehensive audit and hardening pass covering the GitHub Actions workflow, Dockerfile, Renovate config, and README. All changes were tested by running the workflow against this branch.

Changes

Workflow (build-caddy.yml)

  • Step 3: Add inline GHCR pre-auth before docker manifest inspect to prevent race condition when image is not yet publicly accessible
  • Step 9: Clarify DockerHub floating-tag omission rationale in comment (intentional, not a limitation)
  • Step 11: Document GNU coreutils dependency for date -d 'next monday'
  • Step 12: Fix metadata commit push to target current branch (HEAD:${{ github.ref_name }}) instead of hardcoded main
  • Action SHAs: Correct actions/checkout SHA comment from v6.0.2v4.2.2; annotate all action SHAs with verified version comments
  • Action SHAs: Update docker/setup-qemu-action and docker/setup-buildx-action to correct v4 SHAs
  • Step 3: Fix cache-handler and transform-encoder branch resolution — both repos use master, not main
  • CHANGE_SUMMARY diff loop: Tighten guard against unequal fingerprint part counts

Dockerfile

  • Add IMPORTANT sync comment linking builder ARG default to FROM tag
  • Document healthcheck rationale (caddy environ vs HTTP admin API)
  • Document docker group GID-mismatch guard in RUN layer

Renovate (.github/renovate.json)

  • Switch to config:recommended base
  • Fix automerge scope to prevent automerging major version bumps
  • Add versioningTemplate to all customManagers

README

  • Add missing 2.11.2 patch-level tag row to Tag Strategy table
  • Fix semver patch tag missing from GHCR column
  • Add GHCR-specific note to Tag Strategy (major/minor floating tags only on GHCR)

Manual action still required

  • Set repo About description, website (https://hub.docker.com/r/atnplex/caddy), and topics (caddy, docker, reverse-proxy, cloudflare, homelab, xcaddy, github-actions) via the GitHub UI gear icon on the repo homepage.

Summary by CodeRabbit

  • Chores
    • Updated automated dependency management configuration to improve release update handling and version management.
    • Updated build workflow GitHub Actions versions and adjusted branch handling for consistency across development workflows.

atngit2 and others added 7 commits April 1, 2026 09:41
caddyserver/cache-handler and caddyserver/transform-encoder both use
`master` as their default branch, not `main`. The ls-remote awk filter
was matching nothing, causing CACHE_HANDLER_REF and TRANSFORM_ENCODER_REF
to resolve to empty strings and aborting the workflow at the validation step.
….2.2; annotate all action SHAs with verified version comments
Copilot AI review requested due to automatic review settings April 1, 2026 17:37
@atngit2 atngit2 merged commit 2a0115e into main Apr 1, 2026
1 of 2 checks passed
@atngit2 atngit2 deleted the audit/idempotency-and-consistency branch April 1, 2026 17:37
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5e03954-4f61-4d2c-aa07-2526c35956be

📥 Commits

Reviewing files that changed from the base of the PR and between 6259bcb and ff2062e.

📒 Files selected for processing (2)
  • .github/renovate.json
  • .github/workflows/build-caddy.yml

📝 Walkthrough

Walkthrough

Updated Renovate configuration from config:base to config:recommended preset, disabled global automerge with selective rules for specific packages, and modified GitHub Actions workflow to pin action versions and change branch resolution from main to master for component repository queries.

Changes

Cohort / File(s) Summary
Renovate Configuration
.github/renovate.json
Switched base preset to config:recommended, disabled global automerge while enabling it for github-releases minor/patch updates. Updated custom managers for sigstore/cosign and docker/scout-cli to track only versions (not SHAs) using versioningTemplate: "semver" instead of extractVersionTemplate.
GitHub Actions Workflow
.github/workflows/build-caddy.yml
Pinned workflow actions to specific commit SHAs (downgraded some versions: actions/checkout, actions/cache, docker/login-action, docker/build-push-action). Changed component commit resolution from main to master branch for cache-handler and transform-encoder repositories. Updated metadata commit/push logic to target the triggering branch (${{ github.ref_name }}) instead of hardcoded main.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through Renovate flows,
Where branches bend and automerge goes,
From main to master, the workflow takes flight,
Actions pinned down, configurations just right! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch audit/idempotency-and-consistency

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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Renovate configuration by switching to the recommended preset and disabling top-level automerge. It introduces a new package rule to automerge minor and patch updates for GitHub releases and simplifies the regex managers for 'cosign' and 'docker-scout' to track only version strings. Feedback was provided regarding the risk of enabling automerge for GitHub releases, as the simplified regex managers now require manual SHA256 updates which would be bypassed by automation, potentially leading to broken workflows.

{
"matchDatasources": ["github-releases"],
"matchUpdateTypes": ["minor", "patch"],
"automerge": true,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Enabling automerge for github-releases is risky given the changes to the cosign and docker-scout custom managers (lines 53-74). Since those managers have been updated to only track the version string and explicitly require manual SHA256 updates, any automated version bump will result in a checksum mismatch in the workflow. If automerge is set to true, Renovate will attempt to merge these broken updates automatically if CI passes (or if the checksum check is not part of the CI gate). It is safer to set this to false to ensure a human verifies and updates the corresponding SHA256 before merging.

Suggested change
"automerge": true,
"automerge": false,

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR focuses on hardening and making the automation more deterministic by tightening the GitHub Actions workflow’s behavior and refining Renovate’s update/automerge rules.

Changes:

  • Update/pin several GitHub Actions to specific SHAs with corrected version annotations, and fix default-branch resolution for upstream dependencies.
  • Improve metadata push behavior by targeting the triggering ref name (instead of hardcoding main).
  • Adjust Renovate baseline and rules (recommended preset, restrict major automerge) and refine custom managers for workflow-managed versions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/build-caddy.yml Updates action pins/annotations, fixes upstream default-branch resolution, and adjusts metadata rebase/push targeting.
.github/renovate.json Switches to config:recommended, tightens automerge policy, and updates custom managers/versioning templates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +710 to 714
git pull --rebase origin "${{ github.ref_name }}" || {
echo "ERROR: git rebase failed — likely a merge conflict with concurrent branch changes." >&2
git rebase --abort 2>/dev/null || true
exit 1
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

github.ref_name can be a tag name when the workflow is run via workflow_dispatch on a tag. In that case git pull --rebase origin "${{ github.ref_name }}" will fail (no remote branch), and the subsequent push may create/overwrite an unintended branch named after the tag. Consider guarding this step to only run on branch refs (e.g., if: github.ref_type == 'branch' or startsWith(github.ref, 'refs/heads/')), and skip the commit/push on tag runs.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +62
"description": "Update cosign version in workflow (version field only; SHA256 must be updated manually or via a separate manager)",
"fileMatch": ["^\\.github/workflows/build-caddy\\.yml$"],
"matchStrings": [
"COSIGN_VERSION: (?<currentValue>v[^\\n]+)(?:\\n\\s+#[^\\n]*)*\\n\\s+COSIGN_SHA256: \"(?<currentDigest>[a-f0-9]+)\""
"COSIGN_VERSION: (?<currentValue>v[^\\n]+)"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "sigstore/cosign",
"extractVersionTemplate": "^(?<version>.*)$"
"versioningTemplate": "semver"
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This customManager now updates only COSIGN_VERSION, but the workflow enforces a pinned COSIGN_SHA256 for the downloaded binary. A Renovate PR that bumps the version without updating the SHA will reliably break CI at the SHA verification step. Consider managing the SHA alongside the version again (single regex manager capturing both), or disabling Renovate updates/automerge for these fields until both values can be updated together.

Copilot uses AI. Check for mistakes.
Comment on lines 65 to +73
"customType": "regex",
"description": "Update docker-scout version and SHA in workflow",
"description": "Update docker-scout version in workflow (version field only; SHA256 must be updated manually or via a separate manager)",
"fileMatch": ["^\\.github/workflows/build-caddy\\.yml$"],
"matchStrings": [
"SCOUT_VERSION: (?<currentValue>v[^\\n]+)(?:\\n\\s+#[^\\n]*)*\\n\\s+SCOUT_SHA256: \"(?<currentDigest>[a-f0-9]+)\""
"SCOUT_VERSION: (?<currentValue>v[^\\n]+)"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "docker/scout-cli",
"extractVersionTemplate": "^(?<version>.*)$"
"versioningTemplate": "semver"
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Same issue as cosign: this manager updates only SCOUT_VERSION, but the workflow verifies the downloaded tarball against SCOUT_SHA256. Renovate version-only bumps will fail CI unless the SHA is updated in the same PR. Consider updating both fields together (or preventing Renovate from proposing these updates until SHA automation is added).

Copilot uses AI. Check for mistakes.
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.

3 participants