-
Notifications
You must be signed in to change notification settings - Fork 444
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
[LANGPLAT-87] Implement automated release tagging for dd-trace-go v2 #3159
base: v2-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tmp | ||
autoreleasetagger | ||
main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.PHONY: fmt | ||
fmt: | ||
go run mvdan.cc/gofumpt@latest -l -w . | ||
|
||
.PHONY: vet | ||
vet: | ||
GOWORK=off go vet ./... | ||
|
||
.PHONY: fix | ||
fix: build | ||
GOWORK=off golangci-lint run --fix --enable-all --no-config ./... | ||
|
||
.PHONY: lint | ||
lint: | ||
GOWORK=off golangci-lint run --enable-all --no-config ./... | ||
|
||
.PHONY: test | ||
test: deps | ||
GOWORK=off go test -v ./... | ||
|
||
deps: | ||
go mod tidy | ||
|
||
.PHONY: build | ||
build: deps | ||
go build -o autoreleasetagger ./main.go | ||
|
||
tmp/help.txt: build | ||
./autoreleasetagger -h > tmp/help.txt 2>&1 | ||
|
||
.PHONY: README.md | ||
README.md: tmp/help.txt | ||
go run github.com/campoy/embedmd@latest -w README.md |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,91 @@ | ||||||
# Auto Release Tagger | ||||||
|
||||||
This tool ensures that all modules in a monorepo are tagged correctly, respecting dependency order—tagging dependencies first before their dependents. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found this sentence hard to read, maybe you mean this instead?
Suggested change
? |
||||||
|
||||||
- **Automatic Versioning**: Determines the next version based on existing tags. | ||||||
- **Nested Module Support**: Tags all modules in a repository. | ||||||
- **Dependency Awareness**: Ensures dependencies are tagged before their dependents. | ||||||
|
||||||
## 📌 Prerequisites | ||||||
|
||||||
Before running the tool, ensure you have updated the version according to the [Release Checklist](https://datadoghq.atlassian.net/wiki/spaces/DL/pages/2477949158/Template+v+MAJOR+.+MINOR+.+PATCH+Release+Checklist#Release-branch). | ||||||
|
||||||
## 🛠️ Usage | ||||||
|
||||||
Run the following command to tag the release: | ||||||
|
||||||
```sh | ||||||
go run ./tools/autoreleasetagger -root ../.. | ||||||
``` | ||||||
|
||||||
Dry run: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to see a quick statement about when/why you would do a Dry Run instead of a regular run, so that a reader can decide the correct use case for this command. |
||||||
|
||||||
```sh | ||||||
go run ./tools/autoreleasetagger -dry-run -root ../.. | ||||||
``` | ||||||
|
||||||
Run without pushing tags: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as Dry Run. Admittedly, commenting that because I at first had to think critically about why you might want to do those operations. |
||||||
|
||||||
```sh | ||||||
go run ./tools/autoreleasetagger -disable-push -root ../.. | ||||||
``` | ||||||
|
||||||
## 📖 Help | ||||||
|
||||||
[embedmd]:# (tmp/help.txt) | ||||||
```txt | ||||||
Usage of ./autoreleasetagger: | ||||||
-disable-push | ||||||
Disable pushing tags to remote | ||||||
-dry-run | ||||||
Enable dry run mode (skip actual operations) | ||||||
-exclude-dirs string | ||||||
Comma-separated list of directories to exclude. Paths are relative to the root directory | ||||||
-exclude-modules string | ||||||
Comma-separated list of modules to exclude | ||||||
-loglevel string | ||||||
Log level (debug, info, warn, error) (default "info") | ||||||
-remote string | ||||||
Git remote name (default "origin") | ||||||
-root string | ||||||
Path to the root directory (required) | ||||||
``` | ||||||
|
||||||
|
||||||
## 🚀 Development | ||||||
|
||||||
### Helpful Commands for Cleaning Up | ||||||
|
||||||
```sh | ||||||
export GIT_REMOTE=${GIT_REMOTE:-origin} | ||||||
|
||||||
# List local-only tags | ||||||
git tag -l | grep -v "$(git ls-remote --tags $GIT_REMOTE | sed 's/.*refs\/tags\///g')" | ||||||
|
||||||
# Remove local-only tags | ||||||
git tag -l | grep -v "$(git ls-remote --tags $GIT_REMOTE | sed 's/.*refs\/tags\///g')" | xargs git tag -d | ||||||
``` | ||||||
|
||||||
#### Git Alias Setup | ||||||
|
||||||
```sh | ||||||
export GIT_REMOTE=${GIT_REMOTE:-origin} | ||||||
|
||||||
# List tags that exist only locally | ||||||
git config --global alias.list-local-tags "!git tag -l | grep -v \"$(git ls-remote --tags $GIT_REMOTE | sed 's/.*refs\/tags\///g')\"" | ||||||
|
||||||
# Remove tags that exist only locally | ||||||
git config --global alias.remove-local-tags "!git tag -l | grep -v \"$(git ls-remote --tags $GIT_REMOTE | sed 's/.*refs\/tags\///g')\" | xargs git tag -d" | ||||||
``` | ||||||
|
||||||
**Usage** | ||||||
|
||||||
```sh | ||||||
export GIT_REMOTE=${GIT_REMOTE:-origin} | ||||||
|
||||||
# List local-only tags | ||||||
git list-local-tags | ||||||
|
||||||
# Remove local-only tags | ||||||
git remove-local-tags | ||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/DataDog/dd-trace-go/v2/tools/autoreleasetagger | ||
|
||
go 1.22.0 | ||
|
||
require github.com/DataDog/dd-trace-go/v2 v2.0.0-rc.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/DataDog/dd-trace-go/v2 v2.0.0-rc.2 h1:V9IEiUjs5+ye8xTReLo2KS/P4j0HvwS+YJXhRnmmDDY= | ||
github.com/DataDog/dd-trace-go/v2 v2.0.0-rc.2/go.mod h1:5heIdFEknx0pqz3WykyjDo/aMaxjkd8bMySlHPDj6jA= |
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.
Up top can we also specify when you would use this tool? It's during the release process? And what is this new tool affording us that we did not have previously (with the old release process)?