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

Update patch release docs #4756

Merged
merged 1 commit into from
Dec 1, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 7 additions & 69 deletions .github/workflows/patch-release-build.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,17 @@
# Releases a patch by cherrypicking commits into a release branch based on the previous
# release tag.
# Releases a new patch version from a release branch
name: Patch Release Build
on:
workflow_dispatch:
inputs:
release-branch-name:
description: The release branch to use, e.g. v1.9.x
required: true
version:
description: The version to tag the release with, e.g., 1.2.1, 1.2.2
# TODO (trask) this is redundant
description: The version of the release, e.g. 1.9.0 (without the "v" prefix)
required: true
commits:
description: List of commit shas to cherrypick. Multiple shas should be separated by spaces.
required: false

jobs:
prepare-release-branch:
runs-on: ubuntu-latest
outputs:
release-branch-name: ${{ steps.parse-release-branch.outputs.release-branch-name }}
steps:
- id: parse-release-branch
name: Parse release branch name
run: |
# Sets the release-branch-name output to the version number with the last non-period element replaced with an 'x' and preprended with v.
echo "::set-output name=release-branch-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.x/')"
# Sets the release-tag-name output to the version number with the last non-period element replace with a '0' and prepended with v
echo "::set-output name=release-tag-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.0/')"

- id: checkout-release-branch
name: Check out release branch
continue-on-error: true
uses: actions/[email protected]
with:
ref: ${{ steps.parse-release-branch.outputs.release-branch-name }}
fetch-depth: 0

- id: checkout-release-tag
name: Check out release tag
if: ${{ steps.checkout-release-branch.outcome == 'failure' }}
uses: actions/[email protected]
with:
ref: ${{ steps.parse-release-branch.outputs.release-tag-name }}
fetch-depth: 0

- name: Create release branch
if: ${{ steps.checkout-release-tag.outcome == 'success' }}
run: |
git checkout -b ${{ steps.parse-release-branch.outputs.release-branch-name }}
git push --set-upstream origin ${{ steps.parse-release-branch.outputs.release-branch-name }}

test:
runs-on: ubuntu-latest
needs: prepare-release-branch
Expand Down Expand Up @@ -92,12 +57,6 @@ jobs:
git config user.name github-actions
git config user.email [email protected]

- name: Cherrypicks
if: ${{ github.event.inputs.commits != '' }}
run: |
git fetch origin main
git cherry-pick ${{ github.event.inputs.commits }}

- name: Test
run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false

Expand Down Expand Up @@ -159,12 +118,6 @@ jobs:
git config user.name github-actions
git config user.email [email protected]

- name: Cherrypicks
if: ${{ github.event.inputs.commits != '' }}
run: |
git fetch origin main
git cherry-pick ${{ github.event.inputs.commits }}

- name: Test
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}

Expand Down Expand Up @@ -198,12 +151,6 @@ jobs:
git config user.name github-actions
git config user.email [email protected]

- name: Cherrypicks
if: ${{ github.event.inputs.commits != '' }}
run: |
git fetch origin main
git cherry-pick ${{ github.event.inputs.commits }}

- name: Local publish of artifacts
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
run: ./gradlew publishToMavenLocal -x javadoc
Expand Down Expand Up @@ -241,12 +188,6 @@ jobs:
git config user.name github-actions
git config user.email [email protected]

- name: Cherrypicks
if: ${{ github.event.inputs.commits != '' }}
run: |
git fetch origin main
git cherry-pick ${{ github.event.inputs.commits }}

- name: Build and publish artifacts
uses: burrunan/[email protected]
with:
Expand All @@ -269,17 +210,14 @@ jobs:
run: ../gradlew build publishPlugins
working-directory: gradle-plugins

- name: Push cherry-picked changes to the release branch
run: git push

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
commitish: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
commitish: ${{ github.event.inputs.release-branch-name }}
release_name: Release v${{ github.event.inputs.version }}
draft: true
prerelease: false
Expand Down
79 changes: 19 additions & 60 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@ Before making the release:
git checkout -b v1.9.x upstream/main
git push upstream v1.9.x
```
* Push a new commit to the release branch updating the version (remove `-SNAPSHOT`) in these files:
* Merge a PR to the release branch updating the version (remove `-SNAPSHOT`) in these files:
* version.gradle.kts
* examples/distro/build.gradle
* examples/extension/build.gradle

Open the release build workflow in your browser [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release-build.yml).

You will see a button that says "Run workflow". Press the button, enter the release branch
(e.g. `v1.9.x`) in the input field that pops up, and then press "Run workflow".
You will see a button that says "Run workflow". Press the button, then enter the release branch
to use (e.g. `v1.9.x`) and the version of the release (e.g. `1.9.0`). Yes there is redundancy
between these two inputs that we plan to address.

You will see a button that says "Run workflow". Press the button, enter the release branch to use
and the version of the release.

This triggers the release process, which builds the artifacts, publishes the artifacts, and creates
and pushes a git tag with the version number.
Expand Down Expand Up @@ -56,63 +60,18 @@ In general, patch releases are only made for bug-fixes for the following types o
* Memory leaks
* Deadlocks

To make a patch release, open the patch release build workflow in your browser
[here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/patch-release-build.yml).

You will see a button that says "Run workflow". Press the button, enter the version number you want
to release in the input field for version that pops up and the commits you want to cherrypick.
If you are entering multiple commits, they should be separated by spaces. Then, press "Run workflow".

The automated branch creation will fail if any of the yaml files differ between the release branch
and `main`:

```
Switched to a new branch 'v1.6.x'
To https://github.com/open-telemetry/opentelemetry-java-instrumentation
! [remote rejected] v1.6.x -> v1.6.x (refusing to allow a GitHub App to create or update workflow `.github/workflows/pr-smoke-test-fake-backend-images.yml` without `workflows` permission)
```

and you will need to manually create it before proceeding, e.g.

```
git checkout -b v1.6.x v1.6.0
git push upstream v1.6.x
```

If the commits cannot be cleanly applied to the release branch, for example because it has diverged
too much from main, then the workflow will fail before building. In this case, you will need to
prepare the release branch manually.

This example will assume patching into release branch `v1.6.x` from a git repository with remotes
named `origin` and `upstream`.

```
$ git remote -v
origin [email protected]:username/opentelemetry-java.git (fetch)
origin [email protected]:username/opentelemetry-java.git (push)
upstream [email protected]:open-telemetry/opentelemetry-java.git (fetch)
upstream [email protected]:open-telemetry/opentelemetry-java.git (push)
```

First, checkout the release branch

```
git fetch upstream v1.6.x
git checkout upstream/v1.6.x
```

Apply cherrypicks manually and commit. It is ok to apply multiple cherrypicks in a single commit.
Use a commit message such as "Manual cherrypick for commits commithash1, commithash2".

After committing the change, push to your fork's branch.
Before making the release:

```
git push origin v1.6.x
```
* Merge PR(s) containing the desired patches to the release branch
* Merge a PR to the release branch updating the `CHANGELOG.md`
* Merge a PR to the release branch updating the version in these files:
* version.gradle.kts
* examples/distro/build.gradle
* examples/extension/build.gradle

Create a PR to have code review and merge this into upstream's release branch. As this was not
applied automatically, we need to do code review to make sure the manual cherrypick is correct.
To make a patch release, open the patch release build workflow in your browser
[here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/patch-release-build.yml).

After it is merged, Run the patch release workflow again, but leave the commits input field blank.
The release will be made with the current state of the release branch, which is what you prepared
above.
You will see a button that says "Run workflow". Press the button, then enter the release branch
to use (e.g. `v1.9.x`) and the version of the release (e.g. `1.9.1`). Yes there is redundancy
between these two inputs that we plan to address.