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

fix(ci): use FullCommit and align version.sh logic #2646

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Aug 6, 2024

Description

The Commit variable isn't set correctly on the v19.0.0 release:

$ strings zetacored-linux-arm64 | grep constant.Version=19.0.0
build	-ldflags="-X github.com/cosmos/cosmos-sdk/version.Name=zetacore -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd -X github.com/cosmos/cosmos-sdk/version.Version=19.0.0 -X github.com/cosmos/cosmos-sdk/version.Commit= -X github.com/zeta-chain/zetacore/pkg/constant.Name=zetacored -X github.com/zeta-chain/zetacore/pkg/constant.Version=19.0.0 -X github.com/zeta-chain/zetacore/pkg/constant.CommitHash= -X github.com/zeta-chain/zetacore/pkg/constant.BuildTime=2024-08-06T16:54:11Z -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb"

Use .FullCommit instead. I'm not exactly sure why the .Env wasn't working.

Also strip the v from the version in version.sh to align with the goreleaser version logic.

Summary by CodeRabbit

  • Improvements
    • Enhanced commit identifier handling for improved traceability and versioning accuracy during builds and releases.
    • Removed 'v' prefix from version strings in output, aligning with goreleaser expectations.

These changes ensure more precise versioning and better integration with build tools.

Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The recent changes enhance the handling of commit identifiers and version string formatting in the .goreleaser.yaml configuration and version.sh script. By replacing the COMMIT variable with FullCommit, the build and release processes benefit from improved traceability and accuracy. Additionally, the version output format no longer includes a 'v' prefix, aligning with the expectations of the goreleaser tool. These modifications contribute to a more consistent and reliable versioning system.

Changes

Files Change Summary
.goreleaser.yaml Replaced COMMIT with FullCommit in various contexts to enhance commit traceability. Updated target_commitish to use FullCommit.
version.sh Removed 'v' prefix from version strings for exact matches, dirty builds, and develop builds to align with goreleaser output expectations.

Sequence Diagram(s)

Loading
sequenceDiagram
    participant Developer
    participant VersionScript as version.sh
    participant GoReleaser as .goreleaser.yaml

    Developer->>VersionScript: Request version details
    VersionScript->>Developer: Returns version without 'v' prefix
    Developer->>GoReleaser: Triggers build process
    GoReleaser->>GoReleaser: Uses FullCommit for versioning
    GoReleaser->>Developer: Outputs build artifacts with accurate version

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e7fe02f and 135b928.

Files selected for processing (2)
  • .goreleaser.yaml (3 hunks)
  • version.sh (1 hunks)
Additional context used
Path-based instructions (1)
version.sh (1)

Pattern **/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

Additional comments not posted (6)
version.sh (3)

6-8: LGTM!

The change correctly removes the 'v' prefix from the version string to match the goreleaser logic.


15-15: LGTM!

The change correctly updates the version string format for dirty builds to remove the 'v' prefix.


22-22: LGTM!

The change correctly updates the version string format for develop builds to remove the 'v' prefix.

.goreleaser.yaml (3)

56-56: LGTM!

The change correctly replaces {{ .Env.COMMIT }} with {{ .FullCommit }} to use more comprehensive commit identifiers.


59-59: LGTM!

The change correctly replaces {{ .Env.COMMIT }} with {{ .FullCommit }} to use more comprehensive commit identifiers.


102-102: LGTM!

The change correctly replaces {{ .Commit }} with {{ .FullCommit }} to use more comprehensive commit identifiers.

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.35%. Comparing base (d94047a) to head (135b928).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2646      +/-   ##
===========================================
- Coverage    70.35%   70.35%   -0.01%     
===========================================
  Files          338      338              
  Lines        18594    18593       -1     
===========================================
- Hits         13082    13081       -1     
  Misses        4920     4920              
  Partials       592      592              

see 2 files with indirect coverage changes

@gartnera gartnera added this pull request to the merge queue Aug 6, 2024
Merged via the queue into develop with commit a3d3682 Aug 6, 2024
31 checks passed
@gartnera gartnera deleted the fix-goreleaser-3 branch August 6, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Skip changelog CI check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants