Skip to content

Fix: Fix of Docker Image Version Release#434

Merged
elie222 merged 22 commits intoelie222:mainfrom
gowthamkishore3799:main
May 14, 2025
Merged

Fix: Fix of Docker Image Version Release#434
elie222 merged 22 commits intoelie222:mainfrom
gowthamkishore3799:main

Conversation

@gowthamkishore3799
Copy link
Contributor

@gowthamkishore3799 gowthamkishore3799 commented May 13, 2025

Currently, the next build process takes time, requiring the build to complete before updating the tags. This delay is causing multiple image builds to fail. The issue is resolved by updating the version first and then building the image.

  • Refactor

    • Improved workflow for building and publishing Docker images to ensure the latest code and version updates are used.
    • Streamlined job dependencies and control flow for better reliability during the build and publish process.
  • Chores

    • Minor formatting update to the version file (added a newline at the end).

Summary by CodeRabbit

  • Chores
    • Improved the automation workflow to ensure the latest code is used before version updates and Docker image builds.
    • Adjusted the sequence of version updating and Docker image building for better reliability.
    • Updated the version number to v1.0.2.

@vercel
Copy link

vercel bot commented May 13, 2025

@gowthamkishore3799 is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ gowthamkishore3799
❌ github-actions


github-actions seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 13, 2025

"""

Walkthrough

The GitHub Actions workflow for building and publishing Docker images was refactored. Job set-version was renamed to fetch-version and enhanced to pull the latest main branch before reading the version. Job dependencies and execution order were updated to bump the version before building the Docker image. The version update was deferred until commit. The version string in version.txt was updated from v1.0.1 to v1.0.2.

Changes

File(s) Change Summary
.github/workflows/build_and_publish_docker.yml Renamed job set-version to fetch-version; reordered jobs and updated dependencies; added step to pull latest main before reading version; modified version bump logic to defer file update until commit; changed git push to force; moved Docker build job after version update.
version.txt Updated version string from v1.0.1 to v1.0.2.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Repo
    participant DockerHub

    GitHub Actions->>Repo: Fetch latest main branch (fetch-version)
    GitHub Actions->>Repo: Read version.txt
    GitHub Actions->>Repo: Bump version and prepare update (update_version_txt)
    GitHub Actions->>Repo: Commit and push updated version.txt
    GitHub Actions->>DockerHub: Build and push Docker image tagged with new version (build-docker)
Loading

Possibly related PRs

Poem

A workflow hops and skips anew,
With jobs renamed and steps askew.
The version’s fresh, the Docker’s built,
No more confusion, no more guilt!
With every push and every tag,
This bunny’s proud—just check the flag! 🐇
"""

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 ac59321 and feff9e2.

📒 Files selected for processing (1)
  • version.txt (1 hunks)
🔇 Additional comments (2)
version.txt (2)

2-2: Ensure POSIX compliance with trailing newline.

Adding a newline at the end of the file avoids potential POSIX warnings and follows best practices for text files.


1-1:

Details

❓ Verification inconclusive

Confirm version bump aligns with workflows and tags.

The version string was updated to v1.0.2. Please verify that all references to this version in CI/CD configurations, Docker tags, documentation, and release notes are updated and that no residual references to v1.0.1 remain.

Run this script to check for any lingering references to the old version:


🏁 Script executed:

#!/bin/bash
# Search for occurrences of the old version string in the repository
rg -n "v1\.0\.1" .

Length of output: 20


Version bump verification — no residual references found

The automated search for v1.0.1 returned no matches. However, please manually confirm that all CI/CD workflows, Docker tags, documentation, and release notes have been updated to use v1.0.2.

• Double-check any .yml, .yaml, Dockerfile, and markdown files
• Ensure release notes and changelogs reference the new version
• Confirm CI/CD pipelines (e.g., GitHub Actions, Jenkins) are tagging/releases at v1.0.2


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gowthamkishore3799
Copy link
Contributor Author

Have signed the CLA

Copy link
Contributor

@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: 0

🧹 Nitpick comments (5)
.github/workflows/build_and_publish_docker.yml (5)

30-34: Add explicit pull of latest code before version read
Fetching and pulling the main branch ensures you always operate on the up-to-date codebase. Alternatively, you could set fetch-depth: 0 and fetch-tags: true in the initial checkout to achieve a similar outcome.


54-66: Validate base version format before bump
While the patch-increment logic correctly reads and bumps the version segments, consider adding a sanity check to ensure BASE_VERSION matches a semantic version pattern (e.g., ^v?\d+\.\d+\.\d+$) to avoid script failures on malformed input.


84-84: Reconsider force: true push behavior
Using a force push can overwrite remote changes unexpectedly. For safer operation, prefer force_with_lease: true to ensure you don’t clobber concurrent commits.


108-110: Update docker/setup-buildx-action to latest major version
docker/setup-buildx-action@v2 may lack recent features or compatibility fixes. Consider upgrading to the latest major release (for example, @v3).

- uses: docker/setup-buildx-action@v2
+ uses: docker/setup-buildx-action@v3
🧰 Tools
🪛 actionlint (1.7.4)

109-109: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


111-112: Update docker/build-push-action to latest major version
To leverage the newest improvements and ensure compatibility, bump to the latest release (e.g., @v5).

- uses: docker/build-push-action@v4
+ uses: docker/build-push-action@v5
🧰 Tools
🪛 actionlint (1.7.4)

112-112: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a02f85 and 153dcbc.

📒 Files selected for processing (2)
  • .github/workflows/build_and_publish_docker.yml (3 hunks)
  • version.txt (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_and_publish_docker.yml

109-109: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


112-112: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (5)
version.txt (1)

1-2: Ensure newline at end of file
Adding a trailing newline prevents potential parsing issues when reading the version string in CI.

.github/workflows/build_and_publish_docker.yml (4)

19-25: Rename set-version job to fetch-version with proper outputs
The new job name accurately reflects its purpose of fetching the version, and the output mapping from steps.set_version.outputs.version is correctly configured.


43-45: Simplify dependencies for version update
The update_version_txt job now only depends on fetch-version, reducing unnecessary coupling with the Docker build. This streamlines the workflow.


71-77: Review Git tag placement and version strategy
The workflow tags the previous version (needs.fetch-version.outputs.version) before committing the bump. Please verify that this aligns with your release strategy. If you intend to tag the newly bumped version instead, adjust the tag command to use steps.update_version.outputs.new_version.


87-94: Confirm build context and checkout revision
The build-docker job depends on the version update, but the checkout step defaults to the commit that triggered the workflow, not the bumped version commit. If you need the bumped version.txt in the build context, specify:

with:
  ref: main
  fetch-depth: 0

in the checkout action.

@elie222
Copy link
Owner

elie222 commented May 13, 2025

Thanks for this! I made an adjustment earlier to improve security so there's a merge conflict.

This was the PR I added: #435

Copy link
Contributor

@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: 1

🔭 Outside diff range comments (1)
.github/workflows/build_and_publish_docker.yml (1)

71-79: ⚠️ Potential issue

Fix broken job output reference
The VERSION environment variable is still referencing needs.set-version.outputs.version (old job name), which no longer exists. This will break the commit and tag steps.

Please update to reference the fetch-version job:

-          VERSION: ${{ needs.set-version.outputs.version }}
+          VERSION: ${{ needs.fetch-version.outputs.version }}

Additionally, ensure the git tag command uses this updated VERSION.

🧰 Tools
🪛 actionlint (1.7.4)

71-71: property "set-version" is not defined in object type {fetch-version: {outputs: {version: string}; result: string}}

(expression)

🧹 Nitpick comments (2)
.github/workflows/build_and_publish_docker.yml (2)

114-115: Bump build-push-action to latest
Consider upgrading docker/build-push-action@v4 to @v5 (or the latest release) to leverage new features and ensure long-term support.

🧰 Tools
🪛 actionlint (1.7.4)

114-114: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


123-125: Validate tagging logic
You're tagging the image with ${{ needs.fetch-version.outputs.version }} (the pre-bump version) and latest. Confirm that you intend to publish the previous version (pre-bump) rather than the newly bumped version. If you want to release the new version, switch this to use needs.update_version.outputs.new_version.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 153dcbc and a43b9b6.

📒 Files selected for processing (1)
  • .github/workflows/build_and_publish_docker.yml (5 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_and_publish_docker.yml

111-111: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


114-114: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (5)
.github/workflows/build_and_publish_docker.yml (5)

30-34: Ensure latest code is fetched before version reading
The new Force Pull Latest Code step correctly ensures that the main branch is up-to-date before reading version.txt. This addresses timing issues where outdated code could lead to incorrect version tags.


44-45: Simplify job dependency
Updating update_version_txt to depend only on fetch-version (instead of the old build-docker) streamlines the control flow and ensures the version bump runs immediately after fetching the latest version.


59-66: Consistent job output reference
You’re correctly using needs.fetch-version.outputs.version to seed the bump logic. This replaces the old set-version job reference and aligns the variable naming.


86-87: Confirm forced push semantics
Switching from force_with_lease to force: true may overwrite concurrent changes unexpectedly. Consider whether a safer force_with_lease: true better fits your branch protection rules.


111-112: Update outdated Buildx action version
The docker/setup-buildx-action@v2 might be superseded by @v3. Please verify the latest stable version and update accordingly to avoid compatibility issues.

🧰 Tools
🪛 actionlint (1.7.4)

111-111: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Copy link
Contributor

@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: 0

🔭 Outside diff range comments (1)
.github/workflows/build_and_publish_docker.yml (1)

74-78: ⚠️ Potential issue

Critical: Tagging old version instead of the new one.
You're currently tagging the bumped commit with the previous $VERSION. To correctly mark the release, update the tag command to use NEW_VERSION:

-          git tag -a "$VERSION" -m "Release version $VERSION"
+          git tag -a "$NEW_VERSION" -m "Release version $NEW_VERSION"

This ensures your Git tag reflects the file content after the bump.

♻️ Duplicate comments (1)
.github/workflows/build_and_publish_docker.yml (1)

98-102: Ensure build-docker checks out the bumped main.
By default, actions/checkout in this job will pull the workflow-triggering commit (pre-bump). You need to fetch the branch head after the bump:

-      - name: Checkout code
-        uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          ref: main
+          fetch-depth: 0

This matches the earlier recommendation.

🧹 Nitpick comments (2)
.github/workflows/build_and_publish_docker.yml (2)

30-34: Replace manual git fetch/pull with actions/checkout for clarity and efficiency.
Instead of fetching and pulling via shell, directly check out the latest main with full history:

-      - name: Force Pull Latest Code
-        run: |
-          git fetch origin main
-          git pull origin main
+      - name: Checkout latest main branch
+        uses: actions/checkout@v4
+        with:
+          ref: main
+          fetch-depth: 0

This reduces complexity and avoids merge conflicts.


86-86: Use force_with_lease instead of force for safer pushes.
force_with_lease: true prevents you from overwriting upstream changes unintentionally:

-          force: true
+          force_with_lease: true
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a43b9b6 and ac59321.

📒 Files selected for processing (1)
  • .github/workflows/build_and_publish_docker.yml (4 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_and_publish_docker.yml

111-111: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


114-114: the runner of "docker/build-push-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/build_and_publish_docker.yml (2)

44-44: Updated dependency order looks good.
Changing update_version_txt to depend only on fetch-version ensures the version bump runs before the Docker build, matching the PR objective.


59-59: Version bump logic is solid.
The script correctly parses version.txt, defaults missing components, and increments the patch number.

@elie222 elie222 merged commit af97019 into elie222:main May 14, 2025
5 of 7 checks passed
@elie222
Copy link
Owner

elie222 commented May 16, 2025

Still seems to be failing :( not sure if this is because something got lost in the merges? Did you check it was working beforehand?

@gowthamkishore3799
Copy link
Contributor Author

Hi @elie222,

We are currently facing a race condition issue, and I need your input to debug further. When merging PRs, do you typically merge them almost simultaneously (within a minute of each other) or go through them one by one?

If they are merged almost simultaneously, we may need to avoid concurrent Docker image builds to prevent conflicts.

Your insights would help us narrow down the cause.

@gowthamkishore3799
Copy link
Contributor Author

Coz of which the version.txt didnt get updated

@elie222
Copy link
Owner

elie222 commented May 18, 2025

Hi @elie222,

We are currently facing a race condition issue, and I need your input to debug further. When merging PRs, do you typically merge them almost simultaneously (within a minute of each other) or go through them one by one?

If they are merged almost simultaneously, we may need to avoid concurrent Docker image builds to prevent conflicts.

Your insights would help us narrow down the cause.

Hey, usually we don't have multiple merged at one time. Sometimes I push to main though if that impacts things.

@gowthamkishore3799
Copy link
Contributor Author

gowthamkishore3799 commented May 20, 2025

ack, pushing to main shouldnt affect it, let me check that unless a race condition is faced , ill check in deep

@coderabbitai coderabbitai bot mentioned this pull request Jun 4, 2025
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