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

infra: removing workflow, updating script #734

Merged
merged 5 commits into from
May 26, 2020
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
28 changes: 0 additions & 28 deletions .github/workflows/prepare-release.yml

This file was deleted.

82 changes: 82 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Releasing OpenTelemetry Packages (for maintainers only)
This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.

Release Process:
* [Create a new branch](#create-a-new-branch)
* [Open a Pull Request](#open-a-pull-request)
* [Create a Release](#Create-a-Release)
* [Move stable tag](#Move-stable-tag)
* [Update master](#Update-master)
* [Check PyPI](#Check-PyPI)
* [Troubleshooting](#troubleshooting)


## Create a new branch
The following script does the following:
- update master locally
- creates a new release branch `release/<version>`
- updates version and changelog files
- commits the change to a new branch `release/<version>-auto`

*NOTE: This script was run by a GitHub Action but required the Action bot to be excluded from the CLA check, which it currently is not.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we fiile an issue around this work? since it is a requirement for complete automation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an issue here: open-telemetry/community#306 that tracks a migration to EasyCLA which should allow us to start using the GH actions bot again.


```bash
./scripts/prepare_release.sh 0.7b0
```

## Open a Pull Request

The PR should be opened from the `release/<version>-auto` branch created as part of running `prepare_release.sh` in the steps above.

## Create a Release

- Create the GH release from the release branch, using a new tag for this micro version, e.g. `v0.7.0`
- Copy the changelogs from all packages that changed into the release notes (and reformat to remove hard line wraps)


## Check PyPI

This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python/blob/master/.github/workflows/publish.yml).

- Check the [action logs](https://github.com/open-telemetry/opentelemetry-python/actions?query=workflow%3APublish) to make sure packages have been uploaded to PyPI
- Check the release history (e.g. https://pypi.org/project/opentelemetry-api/#history) on PyPI

If for some reason the action failed, see [Publish failed](#publish-failed) below

## Move stable tag

This will ensure the docs are pointing at the stable release.

```bash
git tag -d stable
git tag stable
git push origin stable
```

## Update master

Ensure the version and changelog updates have been applied to master.

```bash
# checkout a new branch from master
git checkout -b v0.7b0-master-update
# cherry pick the change from the release branch
git cherry-pick $(git log -n 1 origin/release/0.7b0 --format="%H")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I missed a point in previous discussions around this, but I believe cherry-picking commits will result in a completely different git hash, which means diverged git history from the get go between this branch on the master branch.

The end result is to have the same code in both places (the version updates), so I feel like this is a situation that could be handled by a git merge instead. But again, unrelated to the automation that is the focus of this PR.

# update the version number, make it a "dev" greater than release number, e.g. 0.8.dev0
perl -i -p -e 's/0.7b0/0.8.dev0/' $(git grep -l "0.7b0" | grep -vi CHANGELOG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know perl is available almost anywhere but still feels a bit strange to depend on it for a python project when a python script could probably have done this. Perhaps the whole flow described in this section could be automated with a py script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I started on a python script to replace all of this but wont have time to finish it before this week's release. I'm just documenting the current process in this doc.

# open a PR targeting master see #331
git commit -m
```

## Troubleshooting

### Publish failed

If for some reason the action failed, do it manually:

- To avoid pushing untracked changes, check out the repo in a new dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or git reset --hard?

- Switch to the release branch (important so we don't publish packages with "dev" versions)
- Build distributions with `./scripts/build.sh`
- Delete distributions we don't want to push (e.g. `testutil`)
- Push to PyPI as `twine upload --skip-existing --verbose dist/*`
- Double check PyPI!
17 changes: 12 additions & 5 deletions scripts/prepare_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
#
# This script:
# 1. parses the version number from the branch name
Expand Down Expand Up @@ -72,10 +72,17 @@ function update_changelog() {
fi
}

# create the release branch
git checkout master
git reset --hard origin/master
git checkout -b release/${VERSION}
git push origin release/${VERSION}

# create a temporary branch to create a PR for updated version and changelogs
git checkout -b release/${VERSION}-auto
update_version_file
update_changelog

git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "updating changelogs and version to ${VERSION}"
echo "::set-output name=version_updated::1"

echo "Time to create a release, here's a sample title:"
echo "[pre-release] Update changelogs, version [${VERSION}]"