Skip to content

feat: implement semantic versioning for devcontainer releases - #27

Merged
keito4 merged 1 commit into
mainfrom
claude/issue-25-20250530_071533
May 30, 2025
Merged

feat: implement semantic versioning for devcontainer releases#27
keito4 merged 1 commit into
mainfrom
claude/issue-25-20250530_071533

Conversation

@keito4

@keito4 keito4 commented May 30, 2025

Copy link
Copy Markdown
Owner

Summary
Implemented semantic versioning system for devcontainer releases to address issue #25 where all releases were tagged as 'latest'.

Changes

  • Added script/version.sh for creating semantic version tags
  • Created comprehensive documentation in .devcontainer/VERSIONING.md
  • Added Makefile targets for easy version management
  • Updated README with versioning instructions

Manual Action Required
The GitHub workflow .github/workflows/docker-image.yml needs manual modification as outlined in the versioning documentation.

Usage

make version-patch  # Create patch version
git push origin v1.0.1  # Trigger build

Fixes #25

Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Introduced automated semantic versioning for devcontainer image releases, including a script and Makefile targets to create patch, minor, and major version tags.
  • Documentation
    • Added detailed documentation on the new versioning workflow and usage instructions in both the README and a dedicated versioning guide.

- Add version.sh script for creating semantic version tags
- Create comprehensive versioning documentation  
- Add Makefile targets for easy version management
- Update README with versioning instructions

This addresses the issue where all devcontainer releases were tagged as 'latest' only.
Manual workflow modification required for complete implementation.

Co-authored-by: keito4 <keito4@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 30, 2025

Copy link
Copy Markdown

Walkthrough

Semantic versioning is introduced for devcontainer image releases through new documentation, a versioning script, and updated Makefile and README instructions. These changes enable automated version tagging (major, minor, patch), version tracking, and integration with GitHub Actions workflows for building and publishing versioned images.

Changes

File(s) Change Summary
.devcontainer/VERSIONING.md New documentation outlining semantic versioning strategy and workflow for devcontainer images.
script/version.sh New Bash script to automate semantic version creation (major, minor, patch, dry-run, force).
Makefile Added targets for version-patch, version-minor, version-major, and version-dry-run.
README.md Added documentation on versioning, usage instructions, and reference to VERSIONING.md.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Makefile
    participant version.sh
    participant Git
    participant GitHub Actions

    Developer->>Makefile: make version-patch / version-minor / version-major
    Makefile->>version.sh: Run with selected bump type
    version.sh->>Git: Get latest tag, create new tag
    version.sh-->>Developer: Output next steps (push tag)
    Developer->>Git: git push --tags
    Git->>GitHub Actions: Trigger workflow on tag push
    GitHub Actions->>GitHub Actions: Build & publish versioned devcontainer image
Loading

Assessment against linked issues

Objective Addressed Explanation
Introduce semantic versioning for devcontainer image releases (#25)
Automate version tag creation and workflow integration (#25)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Possibly related PRs

Suggested labels

codex

Poem

The devcontainer now has a tale to tell,
With tags and versions, it’s easy to sell!
Patch, minor, or major, just run the right script,
And rollbacks or upgrades are smoothly equipped.
🐇✨
Cheers to a future that’s semantically bright—
No more “latest” confusion in sight!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (7)
script/version.sh (1)

6-7: Consider adding set -o pipefail for robustness.

Since the script uses pipelines (e.g., git tag -l ... | head -n1), you may miss failures in earlier commands if set -e alone is used. Adding set -o pipefail ensures the script exits on any step failure in a pipeline.

README.md (2)

45-52: Ensure versioning prerequisites are clear.

It’d be helpful to note that script/version.sh must be executable (e.g., chmod +x script/version.sh) before running make version-* targets, otherwise Make will error. A single line reminder could save confusion:

> Note: Ensure `script/version.sh` is executable (`chmod +x script/version.sh`).

63-69: Link directly to GitHub Actions update instructions.

You reference .devcontainer/VERSIONING.md for details, which is great. Consider also adding a one-line pointer in this section reminding users to manually update .github/workflows/docker-image.yml as outlined in the versioning guide:

> Remember to update your workflow at `.github/workflows/docker-image.yml` to trigger on `v*` tags (see link above).
Makefile (2)

19-22: Verify script path and permissions in Make targets.

The version-patch target calls ./script/version.sh, but if script/version.sh isn’t executable or the working directory differs, it will fail silently. You could guard with:

version-patch:
    @test -x script/version.sh || chmod +x script/version.sh
    ./script/version.sh --type patch && \
      echo "Created patch version tag. Push with: git push origin $$(git describe --tags --abbrev=0)"

This ensures the script is runnable before invoking it.


19-22: Use consistent quoting for echoed push commands.

Currently you echo:

git push origin \$$(git describe --tags --abbrev=0)

Users might find it clearer to wrap the command in backticks or use $(...) without the extra escape:

-   echo "Created patch version tag. Push with: git push origin \$$(git describe --tags --abbrev=0)"
+   echo "Created patch version tag. Push with: git push origin $(git describe --tags --abbrev=0)"

This will print the actual tag name instead of the literal $(git describe…) when Make runs.

Also applies to: 23-28

.devcontainer/VERSIONING.md (2)

49-56: Use standard code fences for consistency.

The document uses four backticks (````) for fences. For consistency with the rest of the repo (and Markdown standards), switch to three backticks:

-````
+```
 # Bump patch version (1.0.0 -> 1.0.1)
 ./script/version.sh --type patch
+```

47-56: Clarify dry-run output behavior.

In the script the --dry-run mode explains the commands, but here the example doesn’t show what users will see. Consider adding an example output snippet to set expectations:

```bash
$ ./script/version.sh --dry-run
DRY RUN: Would create tag v1.0.2
To create this tag, run:
  git tag v1.0.2
  git push origin v1.0.2

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

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


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between a18bd574bc887dfc6ba28863e408cbd3a4cf6677 and ed3057d3bf3b41167691b53dda356645040e6210.

</details>

<details>
<summary>📒 Files selected for processing (4)</summary>

* `.devcontainer/VERSIONING.md` (1 hunks)
* `Makefile` (2 hunks)
* `README.md` (1 hunks)
* `script/version.sh` (1 hunks)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread script/version.sh
Comment on lines +109 to +116
if git tag -l "$NEW_VERSION" | grep -q "$NEW_VERSION"; then
if [[ "$FORCE" == false ]]; then
echo -e "${RED}Tag $NEW_VERSION already exists. Use --force to overwrite.${NC}" >&2
exit 1
else
echo -e "${YELLOW}Tag $NEW_VERSION already exists but will be overwritten.${NC}"
fi
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Support force-overwrite when creating existing tags.

You check --force and warn about overwrites, but the git tag command at line 128 doesn’t actually use -f. As a result, the tag creation still fails on existing tags even if --force is passed.

A minimal patch:

-if [[ "$DRY_RUN" == true ]]; then
+if [[ "$DRY_RUN" == true ]]; then
     echo -e "${YELLOW}DRY RUN: Would create tag $NEW_VERSION${NC}"
     …
     exit 0
 fi

 echo -e "${GREEN}Creating tag $NEW_VERSION...${NC}"
-git tag "$NEW_VERSION"
+if [[ "$FORCE" == true ]]; then
+    git tag -f "$NEW_VERSION"
+else
+    git tag "$NEW_VERSION"
+fi

 echo -e "${GREEN}Tag created successfully!${NC}"

Also applies to: 126-129

🤖 Prompt for AI Agents
In script/version.sh around lines 109 to 116 and 126 to 129, the script checks
for the --force flag and warns about overwriting existing tags, but the actual
git tag creation command does not use the -f option to force overwrite. To fix
this, modify the git tag command to include the -f flag when the FORCE variable
is true, ensuring that existing tags are overwritten as intended when --force is
passed.

Comment thread script/version.sh
Comment on lines +34 to +58
while [[ $# -gt 0 ]]; do
case $1 in
-t|--type)
BUMP_TYPE="$2"
shift 2
;;
-d|--dry-run)
DRY_RUN=true
shift
;;
-f|--force)
FORCE=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}" >&2
usage
exit 1
;;
esac
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Handle missing argument for bump type to avoid silent failures.

The -t|--type case blindly assigns "$2" without verifying that a second argument exists or isn’t another flag. If the user runs ./script/version.sh -t without specifying a type, BUMP_TYPE becomes empty, leading to an “Invalid bump type” error down the line.

Consider adding a check:

 case $1 in
     -t|--type)
-        BUMP_TYPE="$2"
-        shift 2
+        if [[ -z "$2" || "$2" == -* ]]; then
+            echo -e "${RED}Error: Missing bump type after $1${NC}" >&2
+            usage
+            exit 1
+        fi
+        BUMP_TYPE="$2"
+        shift 2
         ;;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
while [[ $# -gt 0 ]]; do
case $1 in
-t|--type)
BUMP_TYPE="$2"
shift 2
;;
-d|--dry-run)
DRY_RUN=true
shift
;;
-f|--force)
FORCE=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}" >&2
usage
exit 1
;;
esac
done
while [[ $# -gt 0 ]]; do
case $1 in
-t|--type)
if [[ -z "$2" || "$2" == -* ]]; then
echo -e "${RED}Error: Missing bump type after $1${NC}" >&2
usage
exit 1
fi
BUMP_TYPE="$2"
shift 2
;;
-d|--dry-run)
DRY_RUN=true
shift
;;
-f|--force)
FORCE=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}" >&2
usage
exit 1
;;
esac
done
🤖 Prompt for AI Agents
In script/version.sh around lines 34 to 58, the case handling for the -t|--type
option assigns the next argument to BUMP_TYPE without checking if it exists or
is not another flag, which can cause silent failures. Add a check after
detecting -t|--type to verify that the next argument is present and does not
start with a dash; if the check fails, print an error message about the missing
bump type argument, show usage, and exit with an error code. This prevents empty
or invalid BUMP_TYPE values and improves script robustness.

@keito4
keito4 merged commit 2701c6e into main May 30, 2025
@keito4
keito4 deleted the claude/issue-25-20250530_071533 branch January 4, 2026 08:08
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.

devcontainerのリリースがすべてlatestでリリースされてしまっている。

1 participant