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

Proper version names #347

Merged
merged 3 commits into from
Dec 23, 2024
Merged

Proper version names #347

merged 3 commits into from
Dec 23, 2024

Conversation

mkysel
Copy link
Collaborator

@mkysel mkysel commented Dec 20, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced commit identifier generation in Docker image builds with a "dev-" prefix.
    • Updated format of the GIT_COMMIT argument to include tag or branch names.
  • Bug Fixes

    • Improved the format of the commit identifier passed to the Go application.
  • Chores

    • Renamed workflow jobs for clarity without changing functionality.

Copy link

coderabbitai bot commented Dec 20, 2024

Walkthrough

The pull request introduces changes across multiple files to modify how commit identifiers are generated and utilized. Key modifications include renaming a job in a workflow and adjusting the format of commit hashes to include a "dev-" prefix while retaining the full hashes. These changes affect GitHub workflow configurations for building Docker images and development run scripts, ensuring a consistent approach to versioning and commit identification throughout the project.

Changes

File Change Summary
.github/workflows/build-pre-baked-images.yml Renamed job from "Push Docker Image to GitHub Packages" to "Build pre-baked anvil-xmtpd"
.github/workflows/build-xmtpd.yml Modified GIT_COMMIT to use dev- prefix with the commit SHA for Docker image build arguments
.github/workflows/release-from-tag.yml Updated GIT_COMMIT build argument to concatenate github.ref_name with the existing logic
dev/run Changed commit identifier generation to use "dev-" prefix with the full commit hash
dev/run-2 Modified commit hash generation to use "dev-" prefix with the full commit hash

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Workflow as GitHub Workflow
    participant Docker as Docker Build
    
    Dev->>Workflow: Trigger build
    Workflow->>Workflow: Generate commit identifier with dev- prefix
    Workflow->>Docker: Build image with dev-{commitID}
    Docker-->>Workflow: Image built
    Workflow-->>Dev: Build complete
Loading

The sequence diagram illustrates the workflow for generating and using commit identifiers, emphasizing the new "dev-" prefix across different build processes.


📜 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 7d15f60 and 564bdc9.

📒 Files selected for processing (2)
  • dev/run (1 hunks)
  • dev/run-2 (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • dev/run
  • dev/run-2

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.

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

🧹 Nitpick comments (1)
.github/workflows/release-from-tag.yml (1)

58-58: LGTM! Appropriate version naming for releases.

The format <tag/ref>-<commit_sha> is appropriate for release builds, correctly differentiating them from development builds that use the dev- prefix.

Add a newline at the end of the file to fix the YAML formatting issue.

   build-args: "GIT_COMMIT=${{ github.ref_name }}-${{ github.event_name != 'pull_request' && github.sha || github.event.pull_request.head.sha }}"
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f223c36 and 647f7fc.

📒 Files selected for processing (5)
  • .github/workflows/build-pre-baked-images.yml (1 hunks)
  • .github/workflows/build-xmtpd.yml (2 hunks)
  • .github/workflows/release-from-tag.yml (1 hunks)
  • dev/run (1 hunks)
  • dev/run-2 (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/build-pre-baked-images.yml
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/release-from-tag.yml

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
dev/run-2 (1)

15-15: LGTM! Consistent with dev/run implementation.

The version naming pattern matches the standardization implemented in dev/run.

.github/workflows/build-xmtpd.yml (2)

56-57: LGTM! Good practice using a pinned version.

The addition of the short-sha action is well-structured and uses a specific version for stability.


67-67: Verify the impact of the new version format.

The standardization of commit identifiers with the "dev-" prefix and short SHA is good. However, let's verify that this change is consistent with other components that might consume this build argument.

✅ Verification successful

Based on the search results, I can generate the final response since I have enough information to verify the impact of the version format change:

The "dev-" prefix format is safe to use and consistent with the codebase

The version format change to use "dev-" prefix with short SHA is safe because:

  • The GIT_COMMIT build arg is only used in two places:
    • dev/docker/Dockerfile: Used with -ldflags to embed commit info into xmtpd binary
    • dev/docker/Dockerfile-cli: Used with -ldflags to embed commit info into xmtpd-cli binary
  • The commit value is only used for version reporting through the -v/--version flags in the CLI, as seen in cmd/cli/main.go
  • There are no version parsing or validation logic in the codebase that depends on the specific format of this commit identifier
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of GIT_COMMIT usage to ensure compatibility

# Search for GIT_COMMIT references in Dockerfiles and scripts
echo "Checking Dockerfiles and scripts for GIT_COMMIT usage:"
rg -A 3 "GIT_COMMIT" dev/docker/

# Search for version/commit parsing in the codebase
echo "Checking for version/commit parsing logic:"
rg -A 3 "dev-[a-f0-9]|version|commit" --type go

Length of output: 38545

dev/run Outdated
go run -ldflags="-X main.Commit=dev-$(git rev-parse --short HEAD)" cmd/replication/main.go "$@"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistent version naming patterns found in development scripts

The codebase shows inconsistent version naming patterns:

  • dev/run and dev/run-2 use dev-$(git rev-parse --short HEAD)
  • dev/cli uses full commit hash without prefix: $(git rev-parse HEAD)
  • Docker-related files use GIT_COMMIT with full hash

Locations needing attention:

  • dev/cli: Update to use short hash with dev- prefix
  • dev/docker/build: Consider using short hash
  • dev/docker/Dockerfile and dev/docker/Dockerfile-cli: Consider standardizing version format
🔗 Analysis chain

LGTM! Verify consistent version naming across the codebase.

The change to use dev-$(git rev-parse --short HEAD) aligns with the standardization of version names.

Let's verify the consistency of version naming across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other potential version/commit identifier patterns
rg -g '!*.md' -g '!*.json' -g '!*.lock' '(?:main\.Commit=|-X main\.Commit|\bGIT_COMMIT\b)'

Length of output: 826

@mkysel mkysel marked this pull request as ready for review December 20, 2024 16:31
@mkysel mkysel requested a review from a team as a code owner December 20, 2024 16:31
@mkysel mkysel requested a review from fbac December 20, 2024 18:06
@mkysel mkysel merged commit 38ecd2a into main Dec 23, 2024
8 checks passed
@mkysel mkysel deleted the mkysel/SHAs branch December 23, 2024 12:57
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