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 template files and disable pulp ci. #2163

Merged
merged 7 commits into from
Jun 11, 2024
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
24 changes: 8 additions & 16 deletions .ci/ansible/start_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,14 @@
command: "docker logs pulp"
failed_when: true

- block:
- name: "Check version of component being tested"
assert:
that:
- (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver)
fail_msg: |
Component {{ component_name }} was expected to be installed in version {{ component_version }}.
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}.
rescue:
- name: "Check version of component being tested (legacy)"
assert:
that:
- (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] | canonical_semver == (component_version | canonical_semver)
fail_msg: |
Component {{ legacy_component_name }} was expected to be installed in version {{ component_version }}.
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] }}.
- name: "Check version of component being tested"
assert:
that:
- (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver)
fail_msg: |
Component {{ item.app_label }} was expected to be installed in version {{ component_version }}.
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}.
loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}"

- name: "Set pulp password in .netrc"
copy:
Expand Down
28 changes: 17 additions & 11 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():
if branch != DEFAULT_BRANCH:
# Check if a Z release is needed
changes = repo.git.ls_tree("-r", "--name-only", f"origin/{branch}", "CHANGES/")
z_release = False
z_changelog = False
for change in changes.split("\n"):
# Check each changelog file to make sure everything checks out
_, ext = os.path.splitext(change)
Expand All @@ -75,18 +75,24 @@ def main():
f"{branch} release branch!"
)
elif ext in Z_CHANGELOG_EXTS:
z_release = True
if z_release:
# Blobless clone does not have file contents for Z branches,
# check commit message for last Z bump
git_branch = f"origin/{branch}"
next_version = repo.git.log(
"--oneline", "--grep=Bump to", "-n 1", git_branch, "--", ".bumpversion.cfg"
).split("to")[-1]
next_version = Version(next_version)
z_changelog = True

last_tag = repo.git.describe("--tags", "--abbrev=0", f"origin/{branch}")
req_txt_diff = repo.git.diff(
f"{last_tag}", f"origin/{branch}", "--name-only", "--", "requirements.txt"
)
if z_changelog or req_txt_diff:
curr_version = Version(last_tag)
assert curr_version.base_version.startswith(
branch
), "Current-version has to belong to the current branch!"
next_version = Version(f"{branch}.{curr_version.micro + 1}")
reason = "CHANGES" if z_changelog else "requirements.txt"
print(
f"A Z-release is needed for {branch}, "
f"New Version: {next_version.base_version}"
f"Prev: {last_tag}, "
f"Next: {next_version.base_version}, "
f"Reason: {reason}"
)
releases.append(next_version)
else:
Expand Down
17 changes: 12 additions & 5 deletions .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/env python3
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
Expand All @@ -8,13 +9,14 @@
import itertools
import os
import re
import tomllib

import toml
from git import GitCommandError, Repo
from pkg_resources import parse_version
from packaging.version import parse as parse_version

# Read Towncrier settings
tc_settings = toml.load("pyproject.toml")["tool"]["towncrier"]
with open("pyproject.toml", "rb") as fp:
tc_settings = tomllib.load(fp)["tool"]["towncrier"]

CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst")
START_STRING = tc_settings.get(
Expand All @@ -28,15 +30,20 @@
TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})")


# Build a regex to find the header of a changelog section.
# It must have a single capture group to single out the version.
# see help(re.split) for more info.
NAME_REGEX = r".*"
VERSION_REGEX = r"([0-9]+\.[0-9]+\.[0-9][0-9ab]*)"
VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*"
VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})"
DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}"
TITLE_REGEX = (
"("
+ re.escape(
TITLE_FORMAT.format(name="NAME_REGEX", version="VERSION_REGEX", project_date="DATE_REGEX")
)
.replace("NAME_REGEX", NAME_REGEX)
.replace("VERSION_REGEX", VERSION_CAPTURE_REGEX, 1)
.replace("VERSION_REGEX", VERSION_REGEX)
.replace("DATE_REGEX", DATE_REGEX)
+ ")"
Expand Down Expand Up @@ -74,7 +81,7 @@ def main():
old_length = len(main_changes)

for branch in branches:
print(f"Looking at branch {branch}")
print(f"Looking for './{CHANGELOG_FILE}' at branch {branch}")
try:
changelog = get_changelog(repo, branch)
except GitCommandError:
Expand Down
16 changes: 0 additions & 16 deletions .ci/scripts/tweet.py

This file was deleted.

2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-316-g69ef1f6
2021.08.26-338-g2237db8
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
fetch-depth: 1
path: "galaxy_ng"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"
- name: "Install python dependencies"
Expand All @@ -36,9 +36,10 @@ jobs:
python3 setup.py sdist bdist_wheel --python-tag py3
twine check dist/*
- name: "Upload Package whl"
uses: "actions/upload-artifact@v3"
uses: "actions/upload-artifact@v4"
with:
name: "plugin_package"
path: "galaxy_ng/dist/"
if-no-files-found: "error"
retention-days: 5
overwrite: true
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
fetch-depth: 1

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

---
name: "Galaxy CI"
on: {pull_request: {branches: ['**']}, push: {branches: ['**']}}
on: workflow_dispatch

concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/create-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
path: "galaxy_ng"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
find CHANGES -type f -regex ".*\.\(bugfix\|doc\|feature\|misc\|deprecation\|removal\)" -exec git rm {} +

- name: Checkout plugin template
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: pulp/plugin_template
path: plugin_template
Expand All @@ -85,7 +85,7 @@ jobs:
git add -A

- name: Make a PR with version bump and without CHANGES/*
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
path: galaxy_ng
token: ${{ secrets.RELEASE_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 1
path: "galaxy_ng"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
fetch-depth: 0
path: "galaxy_ng"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install gitpython toml
pip install gitpython packaging toml
echo ::endgroup::

- name: "Configure Git with ansible name and email"
Expand All @@ -57,7 +57,7 @@ jobs:
run: python .ci/scripts/collect_changes.py

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.RELEASE_TOKEN }}
title: "Update Changelog"
Expand All @@ -76,12 +76,12 @@ jobs:
fetch-depth: 1
path: "galaxy_ng"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: "plugin_package"
path: "galaxy_ng/dist/"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
repository: "pulp/pulp-openapi-generator"
path: "pulp-openapi-generator"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

- uses: "actions/download-artifact@v3"
- uses: "actions/download-artifact@v4"
with:
name: "plugin_package"
path: "galaxy_ng/dist/"
Expand Down Expand Up @@ -83,19 +83,24 @@ jobs:
run: |
.github/workflows/scripts/install_python_client.sh
shell: "bash"

- name: "Upload python client packages"
uses: "actions/upload-artifact@v3"
uses: "actions/upload-artifact@v4"
with:
name: "python-client.tar"
path: "galaxy_ng/galaxy-python-client.tar"
path: |
galaxy_ng/galaxy-python-client.tar
if-no-files-found: "error"
overwrite: true

- name: "Upload python client docs"
uses: "actions/upload-artifact@v3"
uses: "actions/upload-artifact@v4"
with:
name: "python-client-docs.tar"
path: "galaxy_ng/galaxy-python-client-docs.tar"
path: |
galaxy_ng/galaxy-python-client-docs.tar
if-no-files-found: "error"
overwrite: true

- name: "Logs"
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
path: "galaxy_ng"
token: ${{ secrets.RELEASE_TOKEN }}

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.11"

Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/scripts/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ tail -v -n +1 .ci/ansible/Containerfile
cmd_prefix bash -c "echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/nopasswd"
cmd_prefix bash -c "usermod -a -G wheel pulp"

SCENARIOS=("pulp" "performance" "azure" "gcp" "s3" "generate-bindings" "lowerbounds")
if [[ " ${SCENARIOS[*]} " =~ " ${TEST} " ]]; then
# Many functional tests require these
cmd_prefix dnf install -yq lsof which
fi

if [[ "${REDIS_DISABLED:-false}" == true ]]; then
cmd_prefix bash -c "s6-rc -d change redis"
echo "The Redis service was disabled for $TEST"
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/scripts/create_release_from_tag.sh

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set -euv
source .github/workflows/scripts/utils.sh

PLUGIN_VERSION="$(sed -n -e 's/^\s*current_version\s*=\s*//p' .bumpversion.cfg | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_NAME="./galaxy_ng/dist/galaxy_ng-${PLUGIN_VERSION}-py3-none-any.whl"
PLUGIN_SOURCE="./galaxy_ng/dist/galaxy_ng-${PLUGIN_VERSION}-py3-none-any.whl"

export PULP_API_ROOT="/api/galaxy/pulp/"

Expand All @@ -31,7 +31,6 @@ pip install ${PIP_REQUIREMENTS[*]}


cd .ci/ansible/
PLUGIN_SOURCE="${PLUGIN_NAME}"
if [ "$TEST" = "s3" ]; then
PLUGIN_SOURCE="${PLUGIN_SOURCE} pulpcore[s3]"
fi
Expand Down Expand Up @@ -117,7 +116,7 @@ if [ "${PULP_API_ROOT:-}" ]; then
sed -i -e '$a api_root: "'"$PULP_API_ROOT"'"' vars/main.yaml
fi

pulp config create --base-url https://pulp --api-root "$PULP_API_ROOT"
pulp config create --base-url https://pulp --api-root "$PULP_API_ROOT" --username "admin" --password "password"


ansible-playbook build_container.yaml
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/scripts/publish_client_pypi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https:/
if [ "$RESPONSE" == "200" ];
then
echo "galaxy_ng client $VERSION has already been released. Skipping."
exit
else
twine upload -u __token__ -p "$PYPI_API_TOKEN" \
"dist/galaxy_ng_client-$VERSION-py3-none-any.whl" \
"dist/galaxy_ng-client-$VERSION.tar.gz"
fi

twine upload -u __token__ -p "$PYPI_API_TOKEN" \
"dist/galaxy_ng_client-$VERSION-py3-none-any.whl" \
"dist/galaxy_ng-client-$VERSION.tar.gz" \
;
Loading
Loading