Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Don't tag latest when not latest version #38296

Open
wants to merge 4 commits into
base: release
Choose a base branch
from

Conversation

sharat87
Copy link
Member

@sharat87 sharat87 commented Dec 21, 2024

When we're tagging a version that's not the latest version, then don't update the latest Docker image on Docker hub. Like, if the current latest is v1.20, and we publish the hotfix tag v1.18.1 to fix a critical bug in v1.18, then we only want to publish the Docker image at the tag v1.18.1, and not update latest. We want latest to continue to point to v1.20.

Tested on a separate private repo, confirmed working.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Warning

Tests have not run on the HEAD 21b3f9f yet


Sat, 21 Dec 2024 05:33:37 UTC

Summary by CodeRabbit

  • New Features

    • Introduced a streamlined GitHub Actions workflow for Docker image tagging.
    • Added a summary log for workflow execution details.
    • Enhanced Docker tag generation with validation and error handling.
  • Bug Fixes

    • Improved validation for GitHub reference formats to prevent failures.
  • Documentation

    • Updated workflow names and outputs for clarity and ease of use.

Copy link
Contributor

coderabbitai bot commented Dec 21, 2024

Walkthrough

The pull request introduces a significant refactoring of the GitHub Actions release workflow, focusing on improving the Docker image tagging and version handling process. A new JavaScript module prelude.js replaces the previous shell-based version extraction, adding more robust tag validation and dynamic Docker tag generation. The workflow now uses a script-driven approach to determine version tags, enhancing flexibility and modularity in the release process.

Changes

File Change Summary
.github/workflows/github-release.yml - Simplified workflow name
- Replaced version extraction step with GitHub script
- Added docker_tags output
- Updated job dependencies
.github/workflows/scripts/github-release/prelude.js - New module for tag validation
- Implements version extraction logic
- Generates dynamic Docker tags
- Adds detailed logging and error handling

Sequence Diagram

sequenceDiagram
    participant GA as GitHub Actions
    participant Prelude as prelude.js
    participant Core as GitHub Core
    
    GA->>Prelude: Invoke with context
    Prelude->>Prelude: Validate tag format
    Prelude->>Core: Set tag output
    Prelude->>Prelude: Generate Docker tags
    Prelude->>Core: Set docker_tags output
    Prelude-->>GA: Return workflow outputs
Loading

Possibly Related PRs

Suggested Reviewers

  • pratapaprasanna
  • AnaghHegde

Poem

🚢 Workflow waves, tags set sail
Docker's dance, a scripted trail
Version checks with JavaScript might
Releasing code, a GitHub delight! 🌟
Automation's poetry takes flight

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

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.

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog CI labels Dec 21, 2024
@sharat87 sharat87 marked this pull request as ready for review December 21, 2024 09:11
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 (3)
.github/workflows/scripts/github-release/prelude.js (3)

1-2: Consider using execFile for better security.
Although the current approach is fine for quick commands, you can reduce potential security concerns by switching to execFile.


20-26: Check error handling on getLatestTag() calls.
If getLatestTag() fails unexpectedly, consider a short descriptive message for troubleshooting.


39-53: Ensure robust error reporting in getLatestTag.
If tagged versions are missing, consider a fallback or message for clarity instead of resolving an empty string.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79ff105 and 21b3f9f.

📒 Files selected for processing (2)
  • .github/workflows/github-release.yml (3 hunks)
  • .github/workflows/scripts/github-release/prelude.js (1 hunks)
🔇 Additional comments (9)
.github/workflows/scripts/github-release/prelude.js (6)

3-10: Module exports block looks good.
The summary entries help keep logs concise. No issues here.


11-14: Impressive validation for tag format.
This ensures an early exit for invalid tags. Great job.


16-19: Output naming is clear.
The code ensures the version is exposed via outputs for downstream tasks.


28-30: Minimal overhead for pushing 'latest' tag.
Conditionally adding the latest tag is a neat approach.


32-35: Good UI feedback via summary.
Printing docker tags helps debugging and clarity.


36-37: Immediate summary write is helpful.
Ensures logs are flushed. All set.

.github/workflows/github-release.yml (3)

Line range hint 1-21: Logical workflow structure.
Renaming the workflow to "Github Release" clarifies its purpose.


24-40: Steps readability is good.
The usage of actions/github-script@v7 to run your new JavaScript module is straightforward.


279-279: Multiple tags assignment.
Replacing the old single tag approach with your new Docker tags output is a robust solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants