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(web): fix tag name #101

Merged
merged 1 commit into from
Nov 22, 2024
Merged

ci(web): fix tag name #101

merged 1 commit into from
Nov 22, 2024

Conversation

int-tt
Copy link
Contributor

@int-tt int-tt commented Nov 22, 2024

What I've done

The variable name of ouput to be specified as tag was incorrect and has been corrected.

What I haven't done

How I tested

Which point I want you to review particularly

Notes

Summary by CodeRabbit

  • Chores
    • Enhanced Docker image build and tagging workflow for improved consistency.
    • Updated output variable for tagging to reflect correct format.

Copy link

coderabbitai bot commented Nov 22, 2024

Walkthrough

The changes in the pull request focus on modifying the workflow configuration in .github/workflows/web_build.yml. The info job's output variable new_tag_short has been refined to ensure it accurately reflects the Git repository's tag format. The docker job has been updated to use this new output for the TAG environment variable, affecting how Docker image tags are constructed. The overall workflow is streamlined for better consistency in tagging.

Changes

File Change Summary
.github/workflows/web_build.yml Updated new_tag_short output in info job; modified docker job to use new_tag_short for the TAG variable and Docker image tagging.

Possibly related PRs

  • ci(web): web_build workflow conditions #100: The changes in this PR also involve the new_tag_short output in the info job of the .github/workflows/web_build.yml, indicating a direct connection in how the tagging mechanism is handled.

Suggested reviewers

  • airslice
  • pyshx

Poem

In the workflow's dance, a tag takes flight,
New new_tag_short, shining bright.
Docker builds with a brand new cheer,
Consistency's tune is now so clear.
Hoppy changes, all in a row,
Let's build those images, watch them glow! 🐰✨


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

Copy link

@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 and nitpick comments (2)
.github/workflows/web_build.yml (2)

Line range hint 99-104: Critical: Invalid output reference in docker build step

The build step is trying to use steps.options.outputs.new_tag_short which doesn't exist. The options step only sets platforms, version, and tags outputs.

Apply this fix:

  with:
    context: ./web
    platforms: ${{ steps.options.outputs.platforms }}
    push: true
-   tags: ${{ steps.options.outputs.new_tag_short }}
+   tags: ${{ steps.options.outputs.tags }}
    cache-from: type=gha
    cache-to: type=gha,mode=max
🧰 Tools
🪛 actionlint (1.7.3)

79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


Line range hint 28-35: Consider adding explicit tag format validation

To prevent issues with malformed tags, consider adding explicit validation of the tag format before processing. This could help catch issues early in the workflow.

Example validation to add in the info job:

  if [[ "$BRANCH" = "release" ]]; then
    TAG=$(git tag --points-at HEAD)
    if [[ ! -z "$TAG" ]]; then
+     # Validate tag format
+     if [[ ! $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
+       echo "::error::Invalid tag format: $TAG"
+       exit 1
+     fi
      echo "::set-output name=new_tag::$TAG"
      echo "::set-output name=new_tag_short::${TAG#v}"
🧰 Tools
🪛 actionlint (1.7.3)

79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 19aa06f and 52ec298.

📒 Files selected for processing (1)
  • .github/workflows/web_build.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/web_build.yml (2)

76-76: LGTM: Tag variable now correctly references the output

The environment variable TAG now properly references new_tag_short from the info job's outputs, which aligns with the declared output variables.


Line range hint 76-93: Verify tag handling logic across different scenarios

The tag handling logic looks correct but should be verified across different scenarios:

  1. Release tags (e.g., v1.2.3)
  2. Pre-release tags (with hyphens)
  3. Non-release builds (nightly/rc)
✅ Verification successful

Tag handling logic works correctly across all scenarios

The verification confirms that the tag handling implementation is robust:

  • Release tags (v*..)
    • new_tag_short correctly strips the 'v' prefix using ${TAG#v}
    • Generates additional tags for major, minor, and latest versions
  • Pre-release tags (with hyphens)
    • Correctly handled by skipping additional tag generation
  • Non-release builds (nightly/rc)
    • Falls back to SHA-based versioning as expected
    • Only builds for amd64 platform
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify tag handling logic by checking recent tags and their formats

# Check recent tags to understand the tag format
git fetch --tags
echo "Recent tags:"
git tag --sort=-creatordate | head -n 5

# Check if there are any tags that don't follow the expected format
echo -e "\nTags not following v*.*.* format:"
git tag | grep -v "^v[0-9]\+\.[0-9]\+\.[0-9]\+"

Length of output: 617


Script:

#!/bin/bash
# Let's verify the info job's tag handling logic to see how it processes these tags

# Check the info job implementation
echo "Info job implementation:"
rg -A 10 "id: info" .github/workflows/

# Check how new_tag_short is set
echo -e "\nTag processing logic:"
rg "new_tag_short" .github/workflows/

Length of output: 2896

🧰 Tools
🪛 actionlint (1.7.3)

79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


79-79: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

@int-tt int-tt merged commit cc39982 into main Nov 22, 2024
7 checks passed
@int-tt int-tt deleted the ci/web-build-tag-name branch November 22, 2024 10:56
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