From 4277dbc413b85c9cd4c65721e8aea5d1192c4273 Mon Sep 17 00:00:00 2001 From: pulpbot Date: Tue, 21 Nov 2023 21:59:12 +0000 Subject: [PATCH] Update CI files [noissue] --- .ci/scripts/changelog.py | 70 ----- .ci/scripts/cherrypick.sh | 69 ----- .ci/scripts/tweet.py | 16 -- .ci/scripts/update_ci_branches.py | 25 -- .ci/scripts/upper_bound.py | 24 -- .github/template_gitref | 2 +- .github/workflows/build.yml | 21 +- .github/workflows/ci.yml | 12 +- .github/workflows/create-branch.yml | 2 +- .github/workflows/lint.yml | 9 +- .github/workflows/nightly.yml | 266 +++--------------- .github/workflows/pr_checks.yml | 2 +- .github/workflows/release.yml | 129 +++++---- .github/workflows/scripts/before_install.sh | 7 - .../scripts/install_python_client.sh | 49 ++-- .../workflows/scripts/install_ruby_client.sh | 41 +-- .../workflows/scripts/publish_client_pypi.sh | 18 +- .github/workflows/scripts/publish_docs.sh | 14 +- .github/workflows/scripts/script.sh | 60 ++-- .github/workflows/scripts/update_ci.sh | 31 -- .github/workflows/test.yml | 86 ++++-- template_config.yml | 6 +- 22 files changed, 265 insertions(+), 694 deletions(-) delete mode 100755 .ci/scripts/changelog.py delete mode 100755 .ci/scripts/cherrypick.sh delete mode 100755 .ci/scripts/tweet.py delete mode 100755 .ci/scripts/update_ci_branches.py delete mode 100755 .ci/scripts/upper_bound.py delete mode 100755 .github/workflows/scripts/update_ci.sh diff --git a/.ci/scripts/changelog.py b/.ci/scripts/changelog.py deleted file mode 100755 index 026169b10c..0000000000 --- a/.ci/scripts/changelog.py +++ /dev/null @@ -1,70 +0,0 @@ -import re -import os -import requests -from packaging.version import Version -from git import Repo - -repo = Repo(os.getcwd()) -heads = repo.git.ls_remote("--heads", "https://github.com/pulp/pulpcore.git").split("\n") -branches = [h.split("/")[-1] for h in heads if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])] -branches.sort(key=lambda ver: Version(ver), reverse=True) - - -def get_changelog(branch): - """ - Get changelog file for a given branch. - - """ - return requests.get( - f"https://raw.githubusercontent.com/pulp/pulpcore/{branch}/CHANGES.rst" - ).text - - -def get_changelog_releases(changelog): - """ - Get all versions in changelog. - - """ - versions = re.findall( - r"([0-9]+)\.([0-9]+)\.([0-9][0-9ab]*) \([0-9]{4}-[0-9]{2}-[0-9]{2}\)", changelog - ) - return {".".join(v) for v in versions} - - -def get_changelog_entry(changelog, version): - """ - Get changelog entry for a given version. - - """ - entries = changelog.split(f"{version} (")[1].split("=====\n") - header = f"{version} ({entries[0]}=====\n" - text = "\n\n\n".join(entries[1].split("\n\n\n")[0:-1]) - return header + text + "\n\n\n" - - -main_changelog = get_changelog("main") -main_entries = get_changelog_releases(main_changelog) -entries_list = list(main_entries) -to_add = {} -for branch in branches: - changelog = get_changelog(branch) - entries = get_changelog_releases(changelog) - for entry in entries.difference(main_entries): - description = get_changelog_entry(changelog, entry) - entries_list.append(entry) - print(description) - to_add[entry] = description - -entries_list.sort(key=lambda ver: Version(ver), reverse=True) -for version in sorted(to_add, key=lambda ver: Version(ver)): - next_version = entries_list[entries_list.index(version) + 1] - new_changelog = main_changelog.split(f"{next_version} (")[0] + to_add[version] - new_changelog = new_changelog + f"{next_version} (" - new_changelog = new_changelog + main_changelog.split(f"{next_version} (")[1] - main_changelog = new_changelog - -with open("CHANGES.rst", "w") as f: - f.write(main_changelog) - -if to_add: - repo.git.commit("-m", "Update Changelog\n\n[noissue]", "CHANGES.rst") diff --git a/.ci/scripts/cherrypick.sh b/.ci/scripts/cherrypick.sh deleted file mode 100755 index ebc8d8f1d6..0000000000 --- a/.ci/scripts/cherrypick.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulpcore' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -set -e - -if [ ! -d CHANGES ]; then - echo "Error: no CHANGES directory detected. This script must be run from the project root." - exit 1 -fi - -if [ $# -lt 3 ] -then - echo "Usage: .ci/scripts/cherrypick.sh [commit-hash] [original-issue-id] [backport-issue-id]" - echo " ex: .ci/scripts/cherrypick.sh abcd1234 1234 4567" - echo "" - echo "Note: make sure you are on a fork of the release branch before running this script." - exit -fi - -commit="$(git rev-parse $1)" -issue="$2" -backport="$3" -commit_message=$(git log --format=%B -n 1 $commit) - -if ! echo $commit_message | tr '[:upper:]' '[:lower:]' | grep -q "\[noissue\]" -then - if ! echo $commit_message | tr '[:upper:]' '[:lower:]' | grep -q -E "(fixes|closes).*#$issue" - then - echo "Error: issue $issue not detected in commit message." && exit 1 - fi -fi - -if [ "$4" = "--continue" ] -then - echo "Continue after manually resolving conflicts..." -elif [ "$4" = "" ] -then - if ! git cherry-pick --no-commit "$commit" - then - echo "Please resolve and add merge conflicts and restart this command with appended '--continue'." - exit 1 - fi -else - exit 1 -fi - -for file in $(find CHANGES -name "$issue.*") -do - newfile="${file/$issue/$backport}" - git mv "$file" "$newfile" - sed -i -e "\$a (backported from #$issue)" "$newfile" - git add "$newfile" -done - -commit_message="$(printf "$commit_message" | sed -E 's/(fixes|closes)/backports/i')" -commit_message="$commit_message - -fixes #$backport - -(cherry picked from commit $commit)" -git commit -m "$commit_message" - -printf "\nSuccessfully backported commit $1.\n" diff --git a/.ci/scripts/tweet.py b/.ci/scripts/tweet.py deleted file mode 100755 index 5d08962b55..0000000000 --- a/.ci/scripts/tweet.py +++ /dev/null @@ -1,16 +0,0 @@ -import os -import sys -from tweepy import Client - -release_version = sys.argv[1] -if release_version.endswith(".0"): - client = Client( - consumer_key=os.getenv("TWITTER_API_KEY"), - consumer_secret=os.getenv("TWITTER_API_KEY_SECRET"), - access_token=os.getenv("TWITTER_ACCESS_TOKEN"), - access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"), - ) - link = "https://docs.pulpproject.org/pulpcore/changes.html" - msg = f"pulpcore-{release_version} - Check out for more details: {link}" - release_msg = f"Hey! We've just released {msg}" - client.create_tweet(text=release_msg) diff --git a/.ci/scripts/update_ci_branches.py b/.ci/scripts/update_ci_branches.py deleted file mode 100755 index 5e41ca8de4..0000000000 --- a/.ci/scripts/update_ci_branches.py +++ /dev/null @@ -1,25 +0,0 @@ -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulpcore' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -import os -import sys -import requests - -branches = sys.argv[1:] - -headers = { - "Authorization": f"Bearer {os.environ['GITHUB_TOKEN']}", - "Accept": "application/vnd.github.v3+json", -} - -github_api = "https://api.github.com" -workflow_path = "/actions/workflows/update_ci.yml/dispatches" -url = f"{github_api}/repos/pulp/pulpcore{workflow_path}" - -for branch in branches: - print(f"Updating {branch}") - requests.post(url, headers=headers, json={"ref": branch}) diff --git a/.ci/scripts/upper_bound.py b/.ci/scripts/upper_bound.py deleted file mode 100755 index 64d4bbbe6a..0000000000 --- a/.ci/scripts/upper_bound.py +++ /dev/null @@ -1,24 +0,0 @@ -import warnings -from pkg_resources import Requirement - -packages = [] - -try: - with open("requirements.txt", "r") as fd: - for line in fd.readlines(): - if not line.startswith("#"): - req = Requirement.parse(line) - spec = str(req.specs) - if "~=" in spec: - warnings.warn(f"Please avoid using ~= on {req.name}") - continue - if len(req.specs) < 2 and "==" not in spec and "<" not in spec: - packages.append(req.name) -except FileNotFoundError: - # skip this test for plugins that don't use a requirements.txt - pass - -if packages: - raise RuntimeError( - "The following packages are missing upper bound: {}".format(", ".join(packages)) - ) diff --git a/.github/template_gitref b/.github/template_gitref index b11f949e5a..c2170fb2f4 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-265-gbdd41dd +2021.08.26-273-g7facb0a diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49ce88fccc..995bc1fa0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,18 +6,23 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Build +name: "Build" on: workflow_call: +defaults: + run: + working-directory: "pulpcore" + jobs: build: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v4 with: fetch-depth: 1 + path: "pulpcore" - uses: actions/setup-python@v4 with: python-version: "3.8" @@ -26,12 +31,12 @@ jobs: echo ::group::PYDEPS pip install packaging wheel echo ::endgroup:: - - name: Build package - run: python3 setup.py sdist bdist_wheel --python-tag py3 + - name: "Build package" + run: "python3 setup.py sdist bdist_wheel --python-tag py3" - name: 'Upload Package whl' - uses: actions/upload-artifact@v3 + uses: "actions/upload-artifact@v3" with: - name: plugin_package - path: dist/ - if-no-files-found: error + name: "plugin_package" + path: "pulpcore/dist/" + if-no-files-found: "error" retention-days: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f7b982165..2487c27c4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,10 @@ concurrency: group: ${{ github.ref_name }}-${{ github.workflow }} cancel-in-progress: true +defaults: + run: + working-directory: "pulpcore" + jobs: ready-to-ship: @@ -21,6 +25,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + path: "pulpcore" - uses: actions/setup-python@v4 with: python-version: "3.8" @@ -31,10 +36,6 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} run: sh .github/workflows/scripts/check_commit.sh @@ -52,6 +53,9 @@ jobs: needs: build uses: "./.github/workflows/test.yml" deprecations: + defaults: + run: + working-directory: "." runs-on: ubuntu-latest if: github.base_ref == 'main' needs: test diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index dec2cd3a96..c45fc9637f 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - path: pulpcore + path: "pulpcore" - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7f036e515e..c1fe0bc592 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,10 +6,14 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Lint +name: "Lint" on: workflow_call: +defaults: + run: + working-directory: "pulpcore" + jobs: lint: runs-on: ubuntu-latest @@ -18,9 +22,12 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 + path: "pulpcore" + - uses: actions/setup-python@v4 with: python-version: "3.8" + # lint_requirements contains tools needed for flake8, etc. - name: Install requirements run: pip3 install -r lint_requirements.txt diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cb4fc59faf..a29e9e9284 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,7 +6,7 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Core Nightly CI +name: "Core Nightly CI" on: schedule: # * is a special character in YAML so you have to quote this string @@ -14,165 +14,22 @@ on: - cron: '00 3 * * *' workflow_dispatch: +defaults: + run: + working-directory: "pulpcore" + concurrency: - group: ${{ github.ref_name }}-${{ github.workflow }} + group: "${{ github.ref_name }}-${{ github.workflow }}" cancel-in-progress: true jobs: build: - uses: ./.github/workflows/build.yml + uses: "./.github/workflows/build.yml" test: - runs-on: ubuntu-latest - needs: build - - strategy: - fail-fast: false - matrix: - env: - - TEST: pulp - - TEST: docs - - TEST: azure - - TEST: s3 - - - TEST: generate-bindings - - TEST: lowerbounds - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - uses: actions/download-artifact@v3 - with: - name: plugin_package - path: dist/ - - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install httpie - run: | - echo ::group::HTTPIE - pip install httpie - echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV - - - name: Set environment variables - run: | - echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV - - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - uses: ruby/setup-ruby@v1 - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - with: - ruby-version: "2.6" - - - name: Install - run: .github/workflows/scripts/install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Before Script - run: .github/workflows/scripts/before_script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - REDIS_DISABLED: ${{ contains('s3', matrix.env.TEST) }} - - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} - - - name: Install Python client - run: .github/workflows/scripts/install_python_client.sh - shell: bash - - - name: Install Ruby client - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - run: .github/workflows/scripts/install_ruby_client.sh - shell: bash - - - name: Script - run: .github/workflows/scripts/script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Upload python client packages - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: python-client.tar - path: python-client.tar - - - name: Upload python client docs - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: python-client-docs.tar - path: python-client-docs.tar - - - name: Upload ruby client packages - if: ${{ env.TEST == 'bindings' || env.TEST == 'generate-bindings' }} - uses: actions/upload-artifact@v3 - with: - name: ruby-client.tar - path: ruby-client.tar - - name: Upload built docs - if: ${{ env.TEST == 'docs' }} - uses: actions/upload-artifact@v3 - with: - name: docs.tar - path: docs/docs.tar - - - name: Logs - if: always() - run: | - echo "Need to debug? Please check: https://github.com/marketplace/actions/debugging-with-tmate" - http --timeout 30 --check-status --pretty format --print hb "https://pulp${PULP_API_ROOT}api/v3/status/" || true - docker images || true - docker ps -a || true - docker logs pulp || true - docker exec pulp ls -latr /etc/yum.repos.d/ || true - docker exec pulp cat /etc/yum.repos.d/* || true - docker exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" + runs-on: "ubuntu-latest" + needs: "build" + uses: "./.github/workflows/test.yml" changelog: runs-on: ubuntu-latest @@ -180,6 +37,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + path: "pulpcore" - uses: actions/setup-python@v4 with: @@ -203,116 +61,58 @@ jobs: uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.RELEASE_TOKEN }} - title: 'Update Changelog' - body: '' - branch: 'changelog/update' + title: "Update Changelog" + body: "" + branch: "changelog/update" delete-branch: true + path: "pulpcore" publish: runs-on: ubuntu-latest needs: test - env: - TEST: publish - steps: - uses: actions/checkout@v4 with: fetch-depth: 1 + path: "pulpcore" + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + repository: "pulp/pulp-openapi-generator" + path: "pulp-openapi-generator" - uses: actions/download-artifact@v3 with: - name: plugin_package - path: dist/ + name: "plugin_package" + path: "pulpcore/dist/" - uses: actions/setup-python@v4 with: python-version: "3.8" - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.6" - - - name: Install httpie - run: | - echo ::group::HTTPIE - pip install httpie - echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV - - name: Set environment variables run: | echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV - - name: Install python dependencies - run: | - echo ::group::PYDEPS - pip install wheel - echo ::endgroup:: - - - name: Before Install - run: .github/workflows/scripts/before_install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install - run: .github/workflows/scripts/install.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - - - name: Install Python client - run: .github/workflows/scripts/install_python_client.sh - shell: bash - - - name: Install Ruby client - run: .github/workflows/scripts/install_ruby_client.sh - shell: bash - - - name: Before Script - run: .github/workflows/scripts/before_script.sh - shell: bash - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - REDIS_DISABLED: ${{ contains('s3', matrix.env.TEST) }} - - - name: Setting secrets - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} - - name: Download built docs uses: actions/download-artifact@v3 with: - name: docs.tar + name: "docs.tar" + path: "pulpcore" - name: Download Python client docs uses: actions/download-artifact@v3 with: - name: python-client-docs.tar + name: "python-client-docs.tar" + path: "pulpcore" + + - name: Setting secrets + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: ${{ toJson(secrets) }} - name: Publish docs to pulpproject.org run: | diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 6584e96901..fe9fe7b4ca 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -16,7 +16,7 @@ on: # Static analysis should be fine however. concurrency: - group: ${{ github.ref_name }}-${{ github.workflow }} + group: ${{ github.event.pull_request.number }}-${{ github.workflow }} cancel-in-progress: true jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e5366bf05..bbd3ffb4f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,12 +13,13 @@ on: release: description: "Release tag (e.g. 3.2.1)" -env: - RELEASE_WORKFLOW: true +defaults: + run: + working-directory: "pulpcore" jobs: build-artifacts: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false @@ -27,6 +28,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + path: "pulpcore" - uses: actions/setup-python@v4 with: @@ -51,14 +53,15 @@ jobs: - name: Create the release commit, tag it, create a post-release commit, and build plugin package run: python .github/workflows/scripts/release.py ${{ github.event.inputs.release }} - - name: 'Tar files' - run: tar -cvf pulpcore.tar . + - name: "Tar files" + run: | + tar -cvf pulpcore.tar . - - name: 'Upload Artifact' + - name: "Upload Artifact" uses: actions/upload-artifact@v3 with: - name: pulpcore.tar - path: pulpcore.tar + name: "pulpcore.tar" + path: "pulpcore/pulpcore.tar" build-bindings-docs: @@ -71,7 +74,14 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: pulpcore.tar + name: "pulpcore.tar" + path: "pulpcore/" + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + repository: "pulp/pulp-openapi-generator" + path: "pulp-openapi-generator" - uses: actions/setup-python@v4 with: @@ -80,24 +90,16 @@ jobs: with: ruby-version: "2.6" - - name: Untar repository + - name: "Untar repository" run: | tar -xf pulpcore.tar - # update to the branch's latest ci files rather than the ones from the release tag. this is - # helpful when there was a problem with the ci files during the release which needs to be - # fixed after the release tag has been created - - name: Update ci files - run: | - git checkout "origin/${GITHUB_REF##*/}" -- .ci - git checkout "origin/${GITHUB_REF##*/}" -- .github - - name: Install httpie run: | echo ::group::HTTPIE pip install httpie echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV + echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulpcore/.ci/assets/httpie/" >> $GITHUB_ENV # Building the bindings and docs requires accessing the OpenAPI specs endpoint, so we need to # setup the Pulp instance. @@ -107,10 +109,6 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} @@ -121,10 +119,6 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} shell: bash @@ -135,23 +129,25 @@ jobs: - name: Install Ruby client run: .github/workflows/scripts/install_ruby_client.sh shell: bash - - - name: Upload python client packages + - name: "Upload python client packages" uses: actions/upload-artifact@v3 with: - name: python-client.tar - path: python-client.tar + name: "python-client.tar" + path: "pulpcore/core-python-client.tar" + if-no-files-found: "error" - - name: Upload python client docs + - name: "Upload python client docs" uses: actions/upload-artifact@v3 with: - name: python-client-docs.tar - path: python-client-docs.tar - - name: Upload ruby client packages + name: "python-client-docs.tar" + path: "pulpcore/core-python-client-docs.tar" + if-no-files-found: "error" + - name: "Upload ruby client packages" uses: actions/upload-artifact@v3 with: - name: ruby-client.tar - path: ruby-client.tar + name: "ruby-client.tar" + path: "pulpcore/core-ruby-client.tar" + if-no-files-found: "error" - name: Build docs run: | export DJANGO_SETTINGS_MODULE=pulpcore.app.settings @@ -159,11 +155,11 @@ jobs: make -C docs/ PULP_URL="https://pulp" diagrams html tar -cvf docs/docs.tar docs/_build - - name: Upload built docs + - name: "Upload built docs" uses: actions/upload-artifact@v3 with: - name: docs.tar - path: docs/docs.tar + name: "docs.tar" + path: "pulpcore/docs/docs.tar" - name: Logs if: always() @@ -189,7 +185,8 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: pulpcore.tar + name: "pulpcore.tar" + path: "pulpcore/" - uses: actions/setup-python@v4 with: @@ -208,14 +205,6 @@ jobs: run: | tar -xf pulpcore.tar - # update to the branch's latest ci files rather than the ones from the release tag. this is - # helpful when there was a problem with the ci files during the release which needs to be - # fixed after the release tag has been created - - name: Update ci files - run: | - git checkout "origin/${GITHUB_REF##*/}" -- .ci - git checkout "origin/${GITHUB_REF##*/}" -- .github - - name: Setting secrets run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: @@ -224,20 +213,22 @@ jobs: - name: Install python dependencies run: | echo ::group::PYDEPS - pip install gitpython requests packaging~=21.3 tweepy + pip install gitpython requests packaging~=21.3 echo ::endgroup:: - name: Push branch and tag to GitHub run: bash .github/workflows/scripts/push_branch_and_tag_to_github.sh ${{ github.event.inputs.release }} - - name: Download built docs + - name: "Download built docs" uses: actions/download-artifact@v3 with: - name: docs.tar + name: "docs.tar" + path: "pulpcore/" - - name: Download Python client docs + - name: "Download Python client docs" uses: actions/download-artifact@v3 with: - name: python-client-docs.tar + name: "python-client-docs.tar" + path: "pulpcore/" - name: Publish docs to pulpproject.org run: | @@ -245,26 +236,32 @@ jobs: .github/workflows/scripts/publish_docs.sh tag ${{ github.event.inputs.release }} - name: Deploy plugin to pypi run: bash .github/workflows/scripts/publish_plugin_pypi.sh ${{ github.event.inputs.release }} - - name: Download Python client + - name: "Download Python client" uses: actions/download-artifact@v3 with: - name: python-client.tar + name: "python-client.tar" + path: "pulpcore/" - - name: Untar python client packages - run: tar -xvf python-client.tar + - name: "Untar python client packages" + run: | + tar -xvf python-client.tar - - name: Publish client to pypi - run: bash .github/workflows/scripts/publish_client_pypi.sh - - name: Download Ruby client + - name: "Publish client to pypi" + run: | + bash .github/workflows/scripts/publish_client_pypi.sh + - name: "Download Ruby client" uses: actions/download-artifact@v3 with: - name: ruby-client.tar + name: "ruby-client.tar" + path: "pulpcore/" - - name: Untar Ruby client packages - run: tar -xvf ruby-client.tar + - name: "Untar Ruby client packages" + run: | + tar -xvf ruby-client.tar - - name: Publish client to rubygems - run: bash .github/workflows/scripts/publish_client_gem.sh + - name: "Publish client to rubygems" + run: | + bash .github/workflows/scripts/publish_client_gem.sh - name: Create release on GitHub run: bash .github/workflows/scripts/create_release_from_tag.sh ${{ github.event.inputs.release }} diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index 3b1a3bd11d..577edf3193 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -55,11 +55,6 @@ then echo $COMMIT_MSG | sed -n -e 's/.*CI Base Image:\s*\([-_/[:alnum:]]*:[-_[:alnum:]]*\).*/ci_base: "\1"/p' >> .ci/ansible/vars/main.yaml fi - -cd .. - -git clone --depth=1 https://github.com/pulp/pulp-openapi-generator.git - # Intall requirements for ansible playbooks pip install docker netaddr boto3 ansible @@ -73,8 +68,6 @@ then exit $s fi -cd pulpcore - if [[ "$TEST" = "lowerbounds" ]]; then python3 .ci/scripts/calc_deps_lowerbounds.py > lowerbounds_requirements.txt mv lowerbounds_requirements.txt requirements.txt diff --git a/.github/workflows/scripts/install_python_client.sh b/.github/workflows/scripts/install_python_client.sh index 83e35f1e1d..caa949b17a 100755 --- a/.github/workflows/scripts/install_python_client.sh +++ b/.github/workflows/scripts/install_python_client.sh @@ -9,45 +9,36 @@ set -mveuo pipefail -export PULP_URL="${PULP_URL:-https://pulp}" - # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. +source .github/workflows/scripts/utils.sh + +export PULP_URL="${PULP_URL:-https://pulp}" + pip install twine wheel -export REPORTED_VERSION=$(http $PULP_URL/pulp/api/v3/status/ | jq --arg plugin core --arg legacy_plugin pulpcore -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version') -export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" -if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then - export VERSION=${REPORTED_VERSION} -else - export EPOCH="$(date +%s)" - export VERSION=${REPORTED_VERSION}${EPOCH} -fi - -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulpcore-client/$VERSION/) - -if [ "$response" == "200" ]; -then - echo "pulpcore client $VERSION has already been released. Installing from PyPI." - docker exec pulp pip3 install pulpcore-client==$VERSION - mkdir -p dist - tar cvf python-client.tar ./dist - exit -fi - -cd ../pulp-openapi-generator +REPORTED_STATUS="$(pulp status)" +REPORTED_VERSION="$(echo "$REPORTED_STATUS" | jq --arg plugin "core" -r '.versions[] | select(.component == $plugin) | .version')" +VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')" + +pushd ../pulp-openapi-generator rm -rf pulpcore-client -./generate.sh pulpcore python $VERSION -cd pulpcore-client +./generate.sh pulpcore python "$VERSION" +pushd pulpcore-client python setup.py sdist bdist_wheel --python-tag py3 -find . -name "*.whl" -exec docker exec pulp pip3 install /root/pulp-openapi-generator/pulpcore-client/{} \; -tar cvf ../../pulpcore/python-client.tar ./dist + +twine check "dist/pulpcore_client-$VERSION-py3-none-any.whl" || exit 1 +twine check "dist/pulpcore-client-$VERSION.tar.gz" || exit 1 + +cmd_prefix pip3 install "/root/pulp-openapi-generator/pulpcore-client/dist/pulpcore_client-${VERSION}-py3-none-any.whl" +tar cvf ../../pulpcore/core-python-client.tar ./dist find ./docs/* -exec sed -i 's/Back to README/Back to HOME/g' {} \; find ./docs/* -exec sed -i 's/README//g' {} \; cp README.md docs/index.md sed -i 's/docs\///g' docs/index.md find ./docs/* -exec sed -i 's/\.md//g' {} \; -tar cvf ../../pulpcore/python-client-docs.tar ./docs -exit $? +tar cvf ../../pulpcore/core-python-client-docs.tar ./docs +popd +popd diff --git a/.github/workflows/scripts/install_ruby_client.sh b/.github/workflows/scripts/install_ruby_client.sh index d43d73391d..f7c153e091 100755 --- a/.github/workflows/scripts/install_ruby_client.sh +++ b/.github/workflows/scripts/install_ruby_client.sh @@ -7,37 +7,26 @@ # # For more info visit https://github.com/pulp/plugin_template -set -euv +set -mveuo pipefail # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. +source .github/workflows/scripts/utils.sh + export PULP_URL="${PULP_URL:-https://pulp}" -export REPORTED_VERSION=$(http $PULP_URL/pulp/api/v3/status/ | jq --arg plugin core --arg legacy_plugin pulpcore -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version') -export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" -if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then - export VERSION=${REPORTED_VERSION} -else - export EPOCH="$(date +%s)" - export VERSION=${REPORTED_VERSION}${EPOCH} -fi - -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://rubygems.org/gems/pulpcore_client/versions/$VERSION) - -if [ "$response" == "200" ]; -then - echo "pulpcore client $VERSION has already been released. Installing from RubyGems.org." - gem install pulpcore_client -v $VERSION - touch pulpcore_client-$VERSION.gem - tar cvf ruby-client.tar ./pulpcore_client-$VERSION.gem - exit -fi - -cd ../pulp-openapi-generator + +REPORTED_STATUS="$(pulp status)" +REPORTED_VERSION="$(echo "$REPORTED_STATUS" | jq --arg plugin "core" -r '.versions[] | select(.component == $plugin) | .version')" +VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')" + +pushd ../pulp-openapi-generator rm -rf pulpcore-client -./generate.sh pulpcore ruby $VERSION -cd pulpcore-client +./generate.sh pulpcore ruby "$VERSION" +pushd pulpcore-client gem build pulpcore_client -gem install --both ./pulpcore_client-$VERSION.gem -tar cvf ../../pulpcore/ruby-client.tar ./pulpcore_client-$VERSION.gem +gem install --both "./pulpcore_client-$VERSION.gem" +tar cvf ../../pulpcore/core-ruby-client.tar "./pulpcore_client-$VERSION.gem" +popd +popd diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh index 5458b1065f..8a28b2be8d 100755 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ b/.github/workflows/scripts/publish_client_pypi.sh @@ -10,28 +10,26 @@ set -euv # make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. +cd "$(dirname "$(realpath -e "$0")")/../../.." pip install twine -export VERSION=$(ls dist | sed -rn 's/pulpcore-client-(.*)\.tar.gz/\1/p') +VERSION="$(ls dist | sed -rn 's/pulpcore-client-(.*)\.tar.gz/\1/p')" if [[ -z "$VERSION" ]]; then echo "No client package found." exit fi -export response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulpcore-client/$VERSION/) +RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulpcore-client/$VERSION/")" -if [ "$response" == "200" ]; +if [ "$RESPONSE" == "200" ]; then echo "pulpcore client $VERSION has already been released. Skipping." exit fi -twine check dist/pulpcore_client-$VERSION-py3-none-any.whl || exit 1 -twine check dist/pulpcore-client-$VERSION.tar.gz || exit 1 -twine upload dist/pulpcore_client-$VERSION-py3-none-any.whl -u pulp -p $PYPI_PASSWORD -twine upload dist/pulpcore-client-$VERSION.tar.gz -u pulp -p $PYPI_PASSWORD - -exit $? +twine upload -u pulp -p "$PYPI_PASSWORD" \ +"dist/pulpcore_client-$VERSION-py3-none-any.whl" \ +"dist/pulpcore-client-$VERSION.tar.gz" \ +; diff --git a/.github/workflows/scripts/publish_docs.sh b/.github/workflows/scripts/publish_docs.sh index 5f1c959c4d..409141966c 100755 --- a/.github/workflows/scripts/publish_docs.sh +++ b/.github/workflows/scripts/publish_docs.sh @@ -10,7 +10,7 @@ set -euv # make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. +cd "$(dirname "$(realpath -e "$0")")/../../.." mkdir ~/.ssh touch ~/.ssh/pulp-infra @@ -27,10 +27,11 @@ export DJANGO_SETTINGS_MODULE=pulpcore.app.settings export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py export WORKSPACE=$PWD -eval "$(ssh-agent -s)" #start the ssh agent +# start the ssh agent +eval "$(ssh-agent -s)" ssh-add ~/.ssh/pulp-infra -python3 .github/workflows/scripts/docs-publisher.py --build-type $1 --branch $2 +python3 .github/workflows/scripts/docs-publisher.py --build-type "$1" --branch "$2" if [[ "$GITHUB_WORKFLOW" == "Core changelog update" ]]; then # Do not build bindings docs on changelog update @@ -39,9 +40,9 @@ fi pip install mkdocs pymdown-extensions "Jinja2<3.1" -mkdir -p ../bindings -tar -xvf python-client-docs.tar --directory ../bindings -cd ../bindings +mkdir -p ../core-bindings +tar -xvf core-python-client-docs.tar --directory ../core-bindings +pushd ../core-bindings cat >> mkdocs.yml << DOCSYAML --- site_name: Pulpcore Client @@ -61,3 +62,4 @@ rsync -avzh site/ doc_builder_pulpcore@docs.pulpproject.org:/var/www/docs.pulppr # publish to docs.pulpproject.org/pulpcore_client/en/{release} rsync -avzh site/ doc_builder_pulpcore@docs.pulpproject.org:/var/www/docs.pulpproject.org/pulpcore_client/en/"$2" +popd diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index d3b7d01f88..14c74f7d70 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -12,7 +12,6 @@ set -mveuo pipefail # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../../.. -REPO_ROOT="$PWD" source .github/workflows/scripts/utils.sh @@ -38,65 +37,52 @@ if [[ "$TEST" = "docs" ]]; then tar -cvf docs.tar ./_build cd .. - if [ -f $POST_DOCS_TEST ]; then - source $POST_DOCS_TEST + if [ -f "$POST_DOCS_TEST" ]; then + source "$POST_DOCS_TEST" fi exit fi REPORTED_STATUS="$(pulp status)" -if [[ "${RELEASE_WORKFLOW:-false}" == "true" ]]; then - # TODO Move this to prerelease checks - REPORTED_VERSION="$(echo $REPORTED_STATUS | jq --arg plugin core --arg legacy_plugin pulpcore -r '.versions[] | select(.component == $plugin or .component == $legacy_plugin) | .version')" - response=$(curl --write-out %{http_code} --silent --output /dev/null https://pypi.org/project/pulpcore/$REPORTED_VERSION/) - if [ "$response" == "200" ]; - then - echo "pulpcore $REPORTED_VERSION has already been released. Skipping running tests." - exit - fi -fi - echo "machine pulp login admin password password " | cmd_user_stdin_prefix bash -c "cat >> ~pulp/.netrc" # Some commands like ansible-galaxy specifically require 600 -cmd_user_stdin_prefix bash -c "chmod 600 ~pulp/.netrc" +cmd_prefix bash -c "chmod 600 ~pulp/.netrc" -cd ../pulp-openapi-generator -if [ "$(echo "$REPORTED_STATUS" | jq -r '.versions[0].package')" = "null" ] +# Workaround: Domains are not supported by the published bindings. +if [ "$(echo "$REPORTED_STATUS" | jq -r '.domain_enabled')" = "true" ] then - # We are on an old version of pulpcore without package in the status report - for app_label in $(echo "$REPORTED_STATUS" | jq -r '.versions[].component') + pushd ../pulp-openapi-generator + for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[].package|sub("-"; "_")') do - if [ "$app_label" = "core" ] - then - item=pulpcore - else - item="pulp_${app_label}" - fi ./generate.sh "${item}" python cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" sudo rm -rf "./${item}-client" done + popd else - for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[].package|sub("-"; "_")') + # Sadly: Different pulpcore-versions aren't either... + pushd ../pulp-openapi-generator + for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|select(.component!="core").package|sub("-"; "_")') do ./generate.sh "${item}" python cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" sudo rm -rf "./${item}-client" done + popd fi -cd $REPO_ROOT - -cat unittest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt" -cat functest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt" -cmd_prefix pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt +echo "$REPORTED_STATUS" | jq -r '.versions[]|(.package|sub("_"; "-")) + "-client==" + .version' > bindings_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt" < unittest_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt" < functest_requirements.txt +cmd_stdin_prefix bash -c "cat > /tmp/bindings_requirements.txt" < bindings_requirements.txt +cmd_prefix pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt -r /tmp/bindings_requirements.txt CERTIFI=$(cmd_prefix python3 -c 'import certifi; print(certifi.where())') -cmd_prefix bash -c "cat /etc/pulp/certs/pulp_webserver.crt | tee -a "$CERTIFI" > /dev/null" +cmd_prefix bash -c "cat /etc/pulp/certs/pulp_webserver.crt >> '$CERTIFI'" # check for any uncommitted migrations echo "Checking for uncommitted migrations..." @@ -110,13 +96,13 @@ if [[ "$TEST" == "performance" ]]; then if [[ -z ${PERFORMANCE_TEST+x} ]]; then cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulpcore.tests.performance" else - cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulpcore.tests.performance.test_$PERFORMANCE_TEST" + cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulpcore.tests.performance.test_${PERFORMANCE_TEST}" fi exit fi -if [ -f $FUNC_TEST_SCRIPT ]; then - source $FUNC_TEST_SCRIPT +if [ -f "$FUNC_TEST_SCRIPT" ]; then + source "$FUNC_TEST_SCRIPT" else if [[ "$GITHUB_WORKFLOW" == "Core Nightly CI/CD" ]] then @@ -138,6 +124,6 @@ pip install -r test_requirements.txt pytest -v -m pulpcore popd -if [ -f $POST_SCRIPT ]; then - source $POST_SCRIPT +if [ -f "$POST_SCRIPT" ]; then + source "$POST_SCRIPT" fi diff --git a/.github/workflows/scripts/update_ci.sh b/.github/workflows/scripts/update_ci.sh deleted file mode 100755 index 195b440192..0000000000 --- a/.github/workflows/scripts/update_ci.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulpcore' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -set -eu - -if [ ! -f "template_config.yml" ]; then - echo "No template_config.yml detected." - exit 1 -fi - -pushd ../plugin_template -./plugin-template --github pulpcore -popd - -# Check if only gitref file has changed, so no effect on CI workflows. -if [[ $(git diff --name-only) == ".github/template_gitref" ]]; then - echo "No changes detected in github section." - git restore ".github/template_gitref" -fi - -if [[ $(git status --porcelain) ]]; then - git add -A - git commit -m "Update CI files" -m "[noissue]" -else - echo "No updates needed" -fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 106b415121..741abbb80d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,13 +6,17 @@ # For more info visit https://github.com/pulp/plugin_template --- -name: Test +name: "Test" on: workflow_call: +defaults: + run: + working-directory: "pulpcore" + jobs: test: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: @@ -32,22 +36,29 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 + path: "pulpcore" + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + repository: "pulp/pulp-openapi-generator" + path: "pulp-openapi-generator" - uses: actions/setup-python@v4 with: python-version: "3.8" - - uses: actions/download-artifact@v3 + - uses: "actions/download-artifact@v3" with: - name: plugin_package - path: dist/ + name: "plugin_package" + path: "pulpcore/dist/" - name: Install httpie run: | echo ::group::HTTPIE pip install httpie echo ::endgroup:: - echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/.ci/assets/httpie/" >> $GITHUB_ENV + echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulpcore/.ci/assets/httpie/" >> $GITHUB_ENV - name: Set environment variables run: | @@ -59,12 +70,12 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} + - uses: ruby/setup-ruby@v1 + if: ${{ env.TEST == 'pulp' }} + with: + ruby-version: "2.6" - name: Install run: .github/workflows/scripts/install.sh @@ -72,10 +83,6 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} @@ -85,19 +92,17 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} REDIS_DISABLED: ${{ contains('s3', matrix.env.TEST) }} - - name: Setting secrets - if: github.event_name != 'pull_request' - run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: ${{ toJson(secrets) }} + - name: Install Python client + run: .github/workflows/scripts/install_python_client.sh + shell: bash + - name: Install Ruby client + if: ${{ env.TEST == 'pulp' }} + run: .github/workflows/scripts/install_ruby_client.sh + shell: bash - name: Script run: .github/workflows/scripts/script.sh @@ -105,16 +110,43 @@ jobs: env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - GITHUB_PULL_REQUEST: ${{ github.event.number }} - GITHUB_PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} - GITHUB_BRANCH: ${{ github.head_ref }} - GITHUB_REPO_SLUG: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} - name: Extract Deprecations from Logs id: deprecations run: echo deprecations-${{ matrix.env.TEST }}=$(docker logs pulp 2>&1 | grep -i pulpcore.deprecation | base64 -w 0) >> $GITHUB_OUTPUT + - name: Upload python client packages + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "python-client.tar" + path: "pulpcore/core-python-client.tar" + if-no-files-found: "error" + retention-days: 5 + + - name: Upload python client docs + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "python-client-docs.tar" + path: "pulpcore/core-python-client-docs.tar" + if-no-files-found: "error" + retention-days: 5 + - name: Upload Ruby client + if: ${{ env.TEST == 'pulp' }} + uses: actions/upload-artifact@v3 + with: + name: "ruby-client.tar" + path: "pulpcore/core-ruby-client.tar" + if-no-files-found: "error" + retention-days: 5 + - name: Upload built docs + if: ${{ env.TEST == 'docs' }} + uses: actions/upload-artifact@v3 + with: + name: "docs.tar" + path: "pulpcore/docs/docs.tar" - name: Logs if: always() diff --git a/template_config.yml b/template_config.yml index 9015d7a1b3..8bc377f2f4 100644 --- a/template_config.yml +++ b/template_config.yml @@ -1,7 +1,7 @@ # This config represents the latest values used when running the plugin-template. Any settings that # were not present before running plugin-template have been added with their default values. -# generated with plugin_template@2021.08.26-265-gbdd41dd +# generated with plugin_template@2021.08.26-270-gb889ae0 additional_repos: - branch: main @@ -48,6 +48,9 @@ parallel_test_workers: 8 plugin_app_label: core plugin_default_branch: main plugin_name: pulpcore +plugins: +- app_label: core + name: pulpcore post_job_template: null pre_job_template: null publish_docs_to_pulpprojectdotorg: true @@ -71,7 +74,6 @@ pypi_username: pulp python_version: '3.8' release_email: pulp-infra@redhat.com release_user: pulpbot -single_commit_check: true stalebot: true stalebot_days_until_close: 30 stalebot_days_until_stale: 90