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

Adds a new release GitHub Actions workflow #394

Merged
merged 4 commits into from
Jun 14, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
shell: bash

- name: Install Python client
run: .github/workflows/scripts/install_python_client.sh

- name: Before Script
run: |
.github/workflows/scripts/before_script.sh
Expand Down
1 change: 1 addition & 0 deletions CHANGES/7868.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made the release workflow idempotent.
6 changes: 6 additions & 0 deletions CHANGES/8119.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Automated the pre-release steps for the release workflow

The release workflow for plugins now expects a release branch to exist with the correct
.dev version and correct pulpcore requirements. The release workflow needs to be run
against the release branch being released. It takes one parameter: release tag (a.k.a
version string).
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ The following settings are stored in `template_config.yml`.
This is used during commit validation to make sure the commit is attached to
an issue in the correct project.

release_user The GitHub user that is associated with the RELEASE_TOKEN secret on GitHub.
The username and token are used to push the Changelog and version bump commits
created by the release workflow. The default is 'pulpbot'.

test_bindings Include a job that runs a script to test generated client
library.

Expand Down
9 changes: 8 additions & 1 deletion plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ DEFAULT_SETTINGS = {
'pydocstyle': True,
'pypi_username': None,
'redmine_project': None,
'release_user': 'pulpbot',
'test_bindings': True,
'test_cli': False,
'test_performance': False,
Expand All @@ -63,7 +64,13 @@ DEFAULT_SETTINGS = {
DEPRECATED_FILES = {
"github": [
".ci/scripts/cherrypick.py",
".ci/scripts/docs-builder.py",
".ci/scripts/publish_docs.sh",
".ci/scripts/publish_client_gem.sh",
".ci/scripts/publish_client_pypi.sh",
".ci/scripts/publish_plugin_pypi.sh",
".ci/scripts/release_requirements.txt",
".ci/scripts/release.py",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for remembering to deprecate files.

".github/workflows/fips.yml",
".travis",
".travis.yml",
Expand Down Expand Up @@ -280,7 +287,7 @@ def write_template_to_file(template, plugin_root_dir, relative_path, config):
destination_path = os.path.normpath(os.path.join(plugin_root_dir, relative_path))
os.rename(tempfile_path, destination_path)

if destination_path.endswith('.sh'):
if destination_path.endswith('.sh') or destination_path.endswith('.py'):
mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | \
stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH
else:
Expand Down
24 changes: 0 additions & 24 deletions templates/github/.ci/scripts/publish_plugin_pypi.sh.j2

This file was deleted.

5 changes: 5 additions & 0 deletions templates/github/.ci/scripts/redmine.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ from redminelib import Redmine

REDMINE_API_KEY = os.environ["REDMINE_API_KEY"]
REDMINE_QUERY_URL = sys.argv[1]
MILESTONE_URL = sys.argv[2]
RELEASE = sys.argv[3]
CLOSED_CURRENTRELEASE = 11

redmine = Redmine(REDMINE_QUERY_URL.split("issues")[0], key=REDMINE_API_KEY)
query_issues = REDMINE_QUERY_URL.split("=")[-1].split(",")
milestone_name = redmine.version.get(MILESTONE_URL.split("/")[-1].split(".")[0]).name
if milestone_name != RELEASE:
raise RuntimeError(f"Milestone name, '{milestone_name}', does not match version, '{RELEASE}'.")

to_update = []
for issue in query_issues:
Expand Down
226 changes: 0 additions & 226 deletions templates/github/.ci/scripts/release.py.j2

This file was deleted.

11 changes: 2 additions & 9 deletions templates/github/.ci/scripts/update_redmine.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ echo "Releasing $RELEASE"
echo "Milestone URL: $MILESTONE_URL"
echo "Query: $REDMINE_QUERY_URL"

MILESTONE=$(http $MILESTONE_URL | jq -r .version.name)
echo "Milestone: $MILESTONE"
pip install python-redmine httpie

if [[ "$MILESTONE" != "${RELEASE%.post*}" ]]; then
echo "Milestone $MILESTONE is not equal to Release $RELEASE"
exit 1
fi

pip install python-redmine
python3 .ci/scripts/redmine.py $REDMINE_QUERY_URL
python3 .ci/scripts/redmine.py $REDMINE_QUERY_URL $MILESTONE_URL $RELEASE
10 changes: 10 additions & 0 deletions templates/github/.github/workflows/ci.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
shell: bash

- name: Install Python client
run: .github/workflows/scripts/install_python_client.sh

- name: Install Ruby client
if: {{ "${{ env.TEST == 'bindings' }}" }}
run: .github/workflows/scripts/install_ruby_client.sh

- name: Before Script
run: |
.github/workflows/scripts/before_script.sh
Expand Down Expand Up @@ -203,6 +210,9 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
shell: bash

- name: Install Python client
run: .github/workflows/scripts/install_python_client.sh

- name: Before Script
run: .github/workflows/scripts/before_script.sh

Expand Down