Skip to content

chore(ci): allow Docker build from specified branch with default staging#842

Merged
nevil-mathew merged 2 commits into
masterfrom
update-github-work
Oct 15, 2025
Merged

chore(ci): allow Docker build from specified branch with default staging#842
nevil-mathew merged 2 commits into
masterfrom
update-github-work

Conversation

@nevil-mathew

@nevil-mathew nevil-mathew commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Chores
    • Streamlined Docker image build workflow with clearer, more reliable steps.
    • Added manual branch selection with a default of “staging” for on-demand runs and ensured checkout uses the selected target branch.
    • Safer, single-source version retrieval and secure publishing of the resolved version.
    • Enforced explicit version input for tagging; workflow fails if missing.
    • Added a pre-check to prevent publishing when the Docker tag already exists.
    • Removed post-push image digest output.

@coderabbitai

coderabbitai Bot commented Oct 15, 2025

Copy link
Copy Markdown

Walkthrough

The Docker image GitHub Actions workflow now accepts a branch input (default "staging"), checks out that ref, derives the Docker tag solely from the workflow input, fails if the tag is missing or already exists, and builds/pushes the image without emitting image digest logging.

Changes

Cohort / File(s) Summary of Changes
Workflow: dispatch, checkout, and tag handling
.github/workflows/docker-image.yml
Added workflow_dispatch branch input (default: staging); checkout uses the input ref; simplified VERSION derivation to use only the input; fail explicitly if tag missing; write VERSION to GITHUB_OUTPUT securely.
Tag existence check and push flow
.github/workflows/docker-image.yml
Reworked step to check if Docker tag exists and fail when it does; removed alternate success message for non-existent tag and removed image digest step after push; adjusted subsequent steps to use the new VERSION flow.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions
  participant Reg as Registry

  Dev->>GH: Trigger workflow (branch=input, tag=input)
  GH->>GH: Checkout repository at ref = branch
  GH->>GH: Resolve VERSION from workflow input
  alt VERSION missing
    GH-->>Dev: Fail: tag input required
  else VERSION present
    GH->>Reg: Check if tag VERSION exists
    alt Tag exists
      GH-->>Dev: Fail: tag already exists
    else Tag absent
      GH->>GH: Build Docker image :VERSION
      GH->>Reg: Push image :VERSION
      GH-->>Dev: Success
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I nibble branches, staging bright,
A single tag clutched firm and tight.
If it exists, I halt my bite;
If not, I build and push by night.
No digest told — just hop and flight. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately reflects the main change in the pull request by describing the CI workflow update that enables Docker builds from a user-specified branch with a default of staging, matching the modifications to the workflow_dispatch inputs and checkout steps.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-github-work

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35df28e and b8f4948.

📒 Files selected for processing (1)
  • .github/workflows/docker-image.yml (2 hunks)

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.

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 020da8d and 35df28e.

📒 Files selected for processing (1)
  • .github/workflows/docker-image.yml (2 hunks)

Comment thread .github/workflows/docker-image.yml Outdated
@nevil-mathew
nevil-mathew merged commit f7d7bf3 into master Oct 15, 2025
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 5, 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