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

Adding script and workflow to automate the preparation of releases #615

Merged
merged 3 commits into from
May 11, 2020

Conversation

codeboten
Copy link
Contributor

The prepare-release workflow is triggered when a new release/<version> branch is created. This workflow parses the <version> number from the branch name and updates version.py/changelog.md files accordingly. It then creates a pull request with those changes

This addresses part of #374

@codeboten codeboten added the build & infra Issues related to build & infrastructure. label Apr 27, 2020
@codeboten codeboten requested review from toumorokoshi, c24t and a team April 27, 2020 05:25
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "updating changelogs and version to ${VERSION}"
echo "::set-output name=version_updated::1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline, please 😆

@ocelotl
Copy link
Contributor

ocelotl commented Apr 27, 2020

Just a general question, is the Python interpreter available to run scripts too?

@lzchen
Copy link
Contributor

lzchen commented Apr 27, 2020

This is awesome! The script can be tested locally but how do we test the github action?

scripts/prepare_release.sh Outdated Show resolved Hide resolved
# 4. sets the output variable 'version_updated' to determine whether
# the github action to create a pull request should run. this allows
# maintainers to merge changes back into the release branch without
# trigerring unnecessary pull requests

Choose a reason for hiding this comment

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

Suggested change
# trigerring unnecessary pull requests
# triggering unnecessary pull requests

@codeboten
Copy link
Contributor Author

This is awesome! The script can be tested locally but how do we test the github action?

@lzchen I ended up testing this in my fork of the repo. Here's the resulting PR:
codeboten#5

Here's the output from the action the first time it runs:
https://github.com/codeboten/opentelemetry-python/runs/621232300?check_suite_focus=true

Then the out from the action running after I merged the change:
https://github.com/codeboten/opentelemetry-python/runs/621234335?check_suite_focus=true

@codeboten
Copy link
Contributor Author

Just a general question, is the Python interpreter available to run scripts too?

I didn't spend any time investigating running jobs with a python interpreter. The job is just running inside ubuntu so it's likely to be available.

@c24t c24t added this to the Automated Releases milestone Apr 30, 2020
@c24t c24t added the release label Apr 30, 2020
Copy link
Member

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

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

Nice work! really excited to see this work in practice.

@@ -0,0 +1,27 @@
name: prepare-release
on:
push:
Copy link
Member

Choose a reason for hiding this comment

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

wonder if this should be done on tag creation? I guess not much of a different, but typically a release is tied to a specific tag, while a branch is tied to a strand of changes (e.g. 1.x, 1.1.x, etc).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this could definitely be done on tag creation, I was following the current release process which is to create a branch

echo "Using version ${VERSION}"

# check the version matches expected versioning e.g
# 0.6, 0.6b, 0.6b0, 0.6.0
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't the version set be much more strict than this anyway? I guess not a huge deal, but formatting our tags to be stricter (possible always ensure an integer after a alpha/beta marker) might be a good way to ensure consistency in the tag names.

@@ -0,0 +1,80 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

We already have this, and it looks great! So we should keep it. But in the future how about writing pipeline tooling in Python as well?

I feel like it's a bit easier to read a python file than a combination of bash and perl.

echo "Updating ${f}"
done
if [ ${errors} != 0 ]; then
echo "::set-output name=version_updated::0"
Copy link
Member

Choose a reason for hiding this comment

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

just out of curiosity, does the version_updated variable even need to be created? I guess I'm wondering if we run into an issue that is not handled appropriately, then this statement won't be echoed, thus not setting the output.

It's more robust to just check for lack of existence in these scenarios.

git add ${f};
echo "Updating ${f}"
done
if [ ${errors} != 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Co-authored-by: Mauricio Vásquez <[email protected]>
@c24t c24t merged commit fc2d073 into open-telemetry:master May 11, 2020
owais pushed a commit to owais/opentelemetry-python that referenced this pull request May 22, 2020
…pen-telemetry#615)

The prepare-release workflow is triggered when a new release/<version> branch
is created. This workflow parses the <version> number from the branch name and
updates version.py/changelog.md files accordingly. It then creates a pull
request with those changes.

This addresses part of open-telemetry#374.

Co-authored-by: Mauricio Vásquez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build & infra Issues related to build & infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants