-
Notifications
You must be signed in to change notification settings - Fork 56
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 version if work in fort #427
Conversation
WalkthroughThe changes introduce a conditional block in the Changes
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
scripts/common-envs.mk (1)
12-16
: Clever workaround, but consider potential improvementsThis change addresses the issue of missing version information when working in a fork, which is great. However, there are a few considerations:
- Modifying the git configuration might not be ideal in all environments.
- The solution assumes the upstream repository always has tags and is accessible.
- Fetching tags could slow down the build process on slow networks.
- The hardcoded URL might pose a security risk if repository ownership changes.
Consider the following improvements:
- Make the upstream URL configurable via an environment variable.
- Add error handling for network issues or missing tags.
- Implement a caching mechanism to avoid frequent remote fetches.
- Add a comment explaining this workaround for future maintainers.
Here's a suggested improvement:
+# Fallback URL for upstream repository (can be overridden by environment variable) +UPSTREAM_URL ?= https://github.com/aenix-io/cozystack.git ifeq ($(VERSION),) - $(shell git remote add upstream https://github.com/aenix-io/cozystack.git || true) - $(shell git fetch upstream --tags) - VERSION = $(patsubst v%,%,$(shell git describe --tags --abbrev=0)) + # Fallback mechanism to fetch version from upstream when working in a fork + $(shell git remote add upstream $(UPSTREAM_URL) 2>/dev/null || git remote set-url upstream $(UPSTREAM_URL) 2>/dev/null) + $(shell git fetch upstream --tags --quiet) + VERSION = $(patsubst v%,%,$(shell git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")) endifThis change allows for a configurable upstream URL, handles potential errors more gracefully, and provides a default version if no tags are found.
if i work in fork, i see error:
so as not to cause unnecessary difficulties when trying to find the problem, I suggest this crutch
Summary by CodeRabbit
New Features
Bug Fixes
VERSION
variable to ensure it is populated correctly.