1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-26 21:05:00 +02:00
opentelemetry-go/RELEASING.md
Sam Xie 30ca54a7dc
Protect released changelog in CI (#5560)
resolve #1682

This PR adds a new action in CI to protect released sections in the
changelog from being changed. It compares the released sections in the
changelog from the base branch to the current PR. It fails if a change
happens.

Apply "Unlock Released Changelog" to bypass this check when doing a new
release.

Action result if we changed the unreleased section:
d640deb435
Action result if we changed the released section:
d672de7a54

---

Meaning of `awk '/^\<!-- Released section --\>/ {flag=1} /^\<!--
Released section ended --\>/ {flag=0} flag'`
- `/^\<!-- Released section --\>/ {flag=1}`
  - Matches lines starting with `<!-- Released section -->`.
  - Sets the flag variable to 1 (starting the printing of lines).
- `/^\<!-- Released section ended --\>/ {flag=0}`
  - Matches lines starting with `<!-- Released section ended -->`.
  - Sets the flag variable to 0.
  - So it is ok to change external reference links, like
    ```md 
    [Go 1.22]: https://go.dev/doc/go1.22
    [Go 1.21]: https://go.dev/doc/go1.21
    ```
- `flag` lines are printed only when the flag is 1.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2024-07-08 11:31:31 -07:00

6.1 KiB

Release Process

Semantic Convention Generation

New versions of the OpenTelemetry Semantic Conventions mean new versions of the semconv package need to be generated. The semconv-generate make target is used for this.

  1. Checkout a local copy of the OpenTelemetry Semantic Conventions to the desired release tag.
  2. Pull the latest otel/semconvgen image: docker pull otel/semconvgen:latest
  3. Run the make semconv-generate ... target from this repository.

For example,

export TAG="v1.21.0" # Change to the release version you are generating.
export OTEL_SEMCONV_REPO="/absolute/path/to/opentelemetry/semantic-conventions"
docker pull otel/semconvgen:latest
make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO.

This should create a new sub-package of semconv. Ensure things look correct before submitting a pull request to include the addition.

Breaking changes validation

You can run make gorelease that runs gorelease to ensure that there are no unwanted changes done in the public API.

You can check/report problems with gorelease here.

Verify changes for contrib repository

If the changes in the main repository are going to affect the contrib repository, it is important to verify that the changes are compatible with the contrib repository.

Follow the steps in the contrib repository to verify OTel changes.

Pre-Release

First, decide which module sets will be released and update their versions in versions.yaml. Commit this change to a new branch.

Update go.mod for submodules to depend on the new release which will happen in the next step.

  1. Run the prerelease make target. It creates a branch prerelease_<module set>_<new tag> that will contain all release changes.

    make prerelease MODSET=<module set>
    
  2. Verify the changes.

    git diff ...prerelease_<module set>_<new tag>
    

    This should have changed the version for all modules to be <new tag>. If these changes look correct, merge them into your pre-release branch:

    git merge prerelease_<module set>_<new tag>
    
  3. Update the Changelog.

    • Make sure all relevant changes for this release are included and are in language that non-contributors to the project can understand. To verify this, you can look directly at the commits since the <last tag>.

      git --no-pager log --pretty=oneline "<last tag>..HEAD"
      
    • Move all the Unreleased changes into a new section following the title scheme ([<new tag>] - <date of release>).

    • Make sure the new section is under the comment for released section, like <!-- Released section -->, so it is protected from being overwritten in the future.

    • Update all the appropriate links at the bottom.

  4. Push the changes to upstream and create a Pull Request on GitHub. Be sure to include the curated changes from the Changelog in the description.

Tag

Once the Pull Request with all the version changes has been approved and merged it is time to tag the merged commit.

IMPORTANT: It is critical you use the same tag that you used in the Pre-Release step! Failure to do so will leave things in a broken state. As long as you do not change versions.yaml between pre-release and this step, things should be fine.

IMPORTANT: There is currently no way to remove an incorrectly tagged version of a Go module. 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.

  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.

    make add-tags MODSET=<module set> COMMIT=<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.

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

    git push upstream <new tag>
    git push upstream <submodules-path/new tag>
    ...
    

Release

Finally create a Release for the new <new tag> on GitHub. The release body should include all the release notes from the Changelog for this release.

Verify Examples

After releasing verify that examples build outside of the repository.

./verify_examples.sh

The script copies examples into a different directory removes any replace declarations in go.mod and builds them. This ensures they build with the published release, not the local copy.

Post-Release

Contrib Repository

Once verified be sure to make a release for the contrib repository that uses this release.

Website Documentation

Update the Go instrumentation documentation in the OpenTelemetry website under content/en/docs/languages/go. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate.

Demo Repository

Bump the dependencies in the following Go services: