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

Use multimod for releases #59

Merged
merged 5 commits into from Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 29 additions & 1 deletion Makefile
Expand Up @@ -71,11 +71,14 @@ $(TOOLS)/%: | $(TOOLS)
cd $(TOOLS_MOD_DIR) && \
$(GO) build -o $@ $(PACKAGE)

MULTIMOD = $(TOOLS)/multimod
$(TOOLS)/multimod: PACKAGE=go.opentelemetry.io/build-tools/multimod

DBOTCONF = $(TOOLS)/dbotconf
$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf

.PHONY: tools
tools: $(DBOTCONF)
tools: $(DBOTCONF) $(MULTIMOD)

.PHONY: protobuf
protobuf: protobuf-source gen-otlp-protobuf copy-otlp-protobuf
Expand Down Expand Up @@ -138,3 +141,28 @@ dependabot-check: | $(DBOTCONF)
.PHONY: dependabot-generate
dependabot-generate: | $(DBOTCONF)
@$(DBOTCONF) generate > $(DEPENDABOT_CONFIG)

# Releasing

.PHONY: submodule-version
submodule-version:
@[ "$(VERSION)" ] || ( echo "VERSION unset: set to target opentelemetry-proto release tag"; exit 1 )
@echo "upgrading opentelemetry-proto submodule to $(VERSION)"
@cd opentelemetry-proto \
&& git fetch \
&& git checkout $(VERSION) \
&& cd .. \
&& git config -f .gitmodules submodule.opentelemetry-proto.branch $(VERSION)

.PHONY: sync
sync: submodule-version clean protobuf

.PHONY: verify-versions
verify-versions: | $(MULTIMOD)
$(MULTIMOD) verify

COMMIT ?= "HEAD"
.PHONY: add-tags
add-tags: | $(MULTIMOD)
@[ "${MODSET}" ] || ( echo "MODSET unset: set to taget module set from versions.yaml"; exit 1 )
$(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT}
83 changes: 43 additions & 40 deletions RELEASING.md
Expand Up @@ -8,62 +8,61 @@ have been updated and the generated code needs to be updated.

## Create a Release Pull Request

Update the submodule and regenerate the code.
1. Update the [`opentelemetry-proto`] submodule and regenerate the code.

```sh
export VERSION=<new-version>
git config -f .gitmodules submodule.opentelemetry-proto.branch $VERSION
cd opentelemetry-proto
git checkout $VERSION
cd ..
make clean protobuf
```
```sh
make sync VERSION=<new-version>
```

Verify the changes.
2. Update [`versions.yaml`]. Ensure the correct modules versions are updated
and the [`versions.yaml`] syntax is correct.

```sh
git diff main
```
```sh
make verify
```

If everything looks good, push the changes to GitHub and open a pull request.
3. Verify the changes.

- Title: `Release {{VERSION}}`
- Body:
```sh
git diff main
```

```markdown
Release of the [{{VERSION}}][otlp] version of the OTLP.
4. If everything looks good, push the changes to GitHub and open a pull request.

[otlp]: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/{{VERSION}}
```
- Title: `Release {{VERSION}}`
- Body:

```markdown
Release of the [{{VERSION}}][otlp] version of the OTLP.

[otlp]: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/{{VERSION}}
```

## Tag Release

Once the pull request with all the generated code changes has been approved
and merged tag the merged commit.

***IMPORTANT***: It is critical you use the same tag as the
opentelemetry-proto submodule. Failure to do so will leave things in a broken
state.
and merged use the [`multimod`] utility to tag all modules according to
[`versions.yaml`].

***IMPORTANT***: [There is currently no way to remove an incorrectly tagged
version of a Go module](https://github.com/golang/go/issues/34189). It is
critical you make sure the version you push upstream is correct. [Failure to
do so will lead to minor emergencies and tough to work
around](https://github.com/open-telemetry/opentelemetry-go/issues/331).
1. For each module set that will be released, run the `add-tags` make target
using the `<commit-hash>` of the commit on the main branch for the merged
Pull Request.

Run the tag.sh script using the `<commit-hash>` of the commit on the main
branch for the merged Pull Request.
```sh
make add-tags MODSET=<module set> COMMIT=<commit hash>
```

```sh
./tag.sh $VERSION <commit-hash>
```
It should only be necessary to provide an explicit `COMMIT` value if the
current `HEAD` of your working directory is not the correct commit.

Push all generated tags to the upstream remote (not your fork!).
2. Push tags to the upstream remote (not your fork:
`github.com/open-telemetry/opentelemetry-go-contrib.git`). Make sure you
push all sub-modules as well.

```sh
git push upstream $VERSION
git push upstream otlp/$VERSION
```
```sh
export VERSION="<version>"
for t in $( git tag -l | grep "$VERSION" ); do git push upstream "$t"; done
```

## Release

Expand All @@ -77,3 +76,7 @@ Create a GitHub release for the new `<new tag>` on GitHub.

[otlp]: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/{{VERSION}}
```

[`versions.yaml`]: ./versions.yaml
[`multimod`]: https://pkg.go.dev/go.opentelemetry.io/build-tools/multimod
[`opentelemetry-proto`]: https://github.com/open-telemetry/opentelemetry-proto
5 changes: 4 additions & 1 deletion internal/tools/go.mod
Expand Up @@ -2,4 +2,7 @@ module go.opentelemetry.io/proto/internal/tools

go 1.16

require go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220327151007-0b1d24fa04f4
require (
go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220327151007-0b1d24fa04f4
go.opentelemetry.io/build-tools/multimod v0.0.0-20220327151007-0b1d24fa04f4
)