diff --git a/.github/template_gitref b/.github/template_gitref index 0935411..b6678d1 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-335-gdf91f79 +2021.08.26-336-g05dbeb5 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e93a6c5..734cda4 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -101,12 +101,6 @@ jobs: name: "docs.tar" path: "pulp_gem" - - name: Download Python client docs - uses: actions/download-artifact@v4 - with: - name: "python-client-docs.tar" - path: "pulp_gem" - - name: "Setting secrets" run: | python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cca7bb3..e3fb36a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,7 @@ jobs: build: uses: "./.github/workflows/build.yml" - build-bindings-docs: + build-docs: needs: - "build" runs-on: "ubuntu-latest" @@ -58,8 +58,7 @@ jobs: echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_gem/.ci/assets/httpie/" >> $GITHUB_ENV echo ::endgroup:: - # Building the bindings and docs requires accessing the OpenAPI specs endpoint, so we need to - # setup the Pulp instance. + # Building the docs requires accessing the OpenAPI specs endpoint, so we need to setup the Pulp instance. - name: "Before Install" run: | .github/workflows/scripts/before_install.sh @@ -80,40 +79,6 @@ jobs: 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: "Upload python client packages" - uses: "actions/upload-artifact@v4" - with: - name: "python-client.tar" - path: | - pulp_gem/gem-python-client.tar - if-no-files-found: "error" - overwrite: true - - - name: "Upload python client docs" - uses: "actions/upload-artifact@v4" - with: - name: "python-client-docs.tar" - path: | - pulp_gem/gem-python-client-docs.tar - if-no-files-found: "error" - overwrite: true - - name: "Upload ruby client packages" - uses: "actions/upload-artifact@v4" - with: - name: "ruby-client.tar" - path: | - pulp_gem/gem-ruby-client.tar - if-no-files-found: "error" - overwrite: true - name: Build docs run: | export DJANGO_SETTINGS_MODULE=pulpcore.app.settings @@ -143,7 +108,7 @@ jobs: publish-package: runs-on: "ubuntu-latest" needs: - - "build-bindings-docs" + - "build" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -178,90 +143,10 @@ jobs: - name: "Deploy plugin to pypi" run: | .github/workflows/scripts/publish_plugin_pypi.sh ${{ github.ref_name }} - publish-python-bindings: - runs-on: "ubuntu-latest" - needs: - - "build-bindings-docs" - - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - steps: - - uses: "actions/checkout@v4" - with: - fetch-depth: 1 - path: "pulp_gem" - - - name: "Download Python client" - uses: "actions/download-artifact@v4" - with: - name: "python-client.tar" - path: "pulp_gem/" - - - name: "Untar python client packages" - run: | - tar -xvf gem-python-client.tar - - - uses: "actions/setup-python@v5" - with: - python-version: "3.11" - - - name: "Install python dependencies" - run: | - echo ::group::PYDEPS - pip install twine - echo ::endgroup:: - - - name: "Setting secrets" - run: | - python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: "${{ toJson(secrets) }}" - - - name: "Publish client to pypi" - run: | - bash .github/workflows/scripts/publish_client_pypi.sh ${{ github.ref_name }} - publish-ruby-bindings: - runs-on: "ubuntu-latest" - needs: - - "build-bindings-docs" - - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - steps: - - uses: "actions/checkout@v4" - with: - fetch-depth: 1 - path: "pulp_gem" - - - name: "Download Ruby client" - uses: "actions/download-artifact@v4" - with: - name: "ruby-client.tar" - path: "pulp_gem/" - - - name: "Untar Ruby client packages" - run: | - tar -xvf gem-ruby-client.tar - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: "2.6" - - - name: "Setting secrets" - run: | - python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" - env: - SECRETS_CONTEXT: "${{ toJson(secrets) }}" - - - name: "Publish client to rubygems" - run: | - bash .github/workflows/scripts/publish_client_gem.sh ${{ github.ref_name }} publish-docs: runs-on: "ubuntu-latest" needs: - - "build-bindings-docs" + - "build-docs" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -294,12 +179,6 @@ jobs: name: "docs.tar" path: "pulp_gem/" - - name: "Download Python client docs" - uses: "actions/download-artifact@v4" - with: - name: "python-client-docs.tar" - path: "pulp_gem/" - - name: "Publish docs to pulpproject.org" run: | tar -xvf docs.tar @@ -308,10 +187,8 @@ jobs: create-gh-release: runs-on: "ubuntu-latest" needs: - - "build-bindings-docs" + - "build-docs" - "publish-package" - - "publish-python-bindings" - - "publish-ruby-bindings" - "publish-docs" steps: diff --git a/.github/workflows/scripts/publish_client_gem.sh b/.github/workflows/scripts/publish_client_gem.sh deleted file mode 100755 index 7e99225..0000000 --- a/.github/workflows/scripts/publish_client_gem.sh +++ /dev/null @@ -1,35 +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 pulp_gem' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -set -euv - -# make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../../.. - -VERSION="$1" - -if [[ -z "$VERSION" ]]; then - echo "No version specified." - exit 1 -fi - -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://rubygems.org/gems/pulp_gem_client/versions/$VERSION")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulp_gem client $VERSION has already been released. Skipping." - exit -fi - -mkdir -p ~/.gem -touch ~/.gem/credentials -echo "--- -:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials -sudo chmod 600 ~/.gem/credentials -gem push "pulp_gem_client-${VERSION}.gem" diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh deleted file mode 100755 index 3177557..0000000 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ /dev/null @@ -1,31 +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 pulp_gem' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -set -euv - -# make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")/../../.." - -VERSION="$1" - -if [[ -z "$VERSION" ]]; then - echo "No version specified." - exit 1 -fi - -RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https://pypi.org/project/pulp-gem-client/$VERSION/")" - -if [ "$RESPONSE" == "200" ]; -then - echo "pulp_gem client $VERSION has already been released. Skipping." -else - twine upload -u __token__ -p "$PYPI_API_TOKEN" \ - "dist/pulp_gem_client-$VERSION-py3-none-any.whl" \ - "dist/pulp_gem-client-$VERSION.tar.gz" -fi diff --git a/.github/workflows/scripts/publish_docs.sh b/.github/workflows/scripts/publish_docs.sh index c81580d..5de5855 100755 --- a/.github/workflows/scripts/publish_docs.sh +++ b/.github/workflows/scripts/publish_docs.sh @@ -35,14 +35,3 @@ if [[ "$GITHUB_WORKFLOW" == "Gem changelog update" ]]; then # Do not build bindings docs on changelog update exit fi - -mkdir -p ../gem-bindings -tar -xvf gem-python-client-docs.tar --directory ../gem-bindings -pushd ../gem-bindings - -# publish to docs.pulpproject.org/pulp_gem_client -rsync -avzh site/ doc_builder_pulp_gem@docs.pulpproject.org:/var/www/docs.pulpproject.org/pulp_gem_client/ - -# publish to docs.pulpproject.org/pulp_gem_client/en/{release} -rsync -avzh site/ doc_builder_pulp_gem@docs.pulpproject.org:/var/www/docs.pulpproject.org/pulp_gem_client/en/"$2" -popd diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index b91e931..576a9db 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -60,60 +60,28 @@ if pulp debug has-plugin --name "core" --specifier ">=3.44.0.dev" then # Use app_label to generate api.json and package to produce the proper package name. - if [ "$(jq -r '.domain_enabled' <<<"$REPORTED_STATUS")" = "true" ] - then - # Workaround: Domains are not supported by the published bindings. - # Generate new bindings for all packages. - for item in $(jq -r '.versions[] | tojson' <<<"$REPORTED_STATUS") - do - echo $item - COMPONENT="$(jq -r '.component' <<<"$item")" - VERSION="$(jq -r '.version' <<<"$item")" - MODULE="$(jq -r '.module' <<<"$item")" - PACKAGE="${MODULE%%.*}" - curl --fail-with-body -k -o api.json "${PULP_URL}${PULP_API_ROOT}api/v3/docs/api.json?bindings&component=$COMPONENT" - USE_LOCAL_API_JSON=1 ./generate.sh "${PACKAGE}" python "${VERSION}" - cmd_prefix pip3 install "/root/pulp-openapi-generator/${PACKAGE}-client" - sudo rm -rf "./${PACKAGE}-client" - done - else - # Sadly: Different pulpcore-versions aren't either... - for item in $(jq -r '.versions[]| select(.component!="gem")| tojson' <<<"$REPORTED_STATUS") - do - echo $item - COMPONENT="$(jq -r '.component' <<<"$item")" - VERSION="$(jq -r '.version' <<<"$item")" - MODULE="$(jq -r '.module' <<<"$item")" - PACKAGE="${MODULE%%.*}" - curl --fail-with-body -k -o api.json "${PULP_URL}${PULP_API_ROOT}api/v3/docs/api.json?bindings&component=$COMPONENT" - USE_LOCAL_API_JSON=1 ./generate.sh "${PACKAGE}" python "${VERSION}" - cmd_prefix pip3 install "/root/pulp-openapi-generator/${PACKAGE}-client" - sudo rm -rf "./${PACKAGE}-client" - done - fi + for item in $(jq -r '.versions[] | tojson' <<<"$REPORTED_STATUS") + do + echo $item + COMPONENT="$(jq -r '.component' <<<"$item")" + VERSION="$(jq -r '.version' <<<"$item")" + MODULE="$(jq -r '.module' <<<"$item")" + PACKAGE="${MODULE%%.*}" + curl --fail-with-body -k -o api.json "${PULP_URL}${PULP_API_ROOT}api/v3/docs/api.json?bindings&component=$COMPONENT" + USE_LOCAL_API_JSON=1 ./generate.sh "${PACKAGE}" python "${VERSION}" + cmd_prefix pip3 install "/root/pulp-openapi-generator/${PACKAGE}-client" + sudo rm -rf "./${PACKAGE}-client" + done else # Infer the client name from the package name by replacing "-" with "_". # Use the component to infer the package name on older versions of pulpcore. - if [ "$(echo "$REPORTED_STATUS" | jq -r '.domain_enabled')" = "true" ] - then - # Workaround: Domains are not supported by the published bindings. - # Generate new bindings for all packages. - for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")') - do - ./generate.sh "${item}" python - cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" - sudo rm -rf "./${item}-client" - done - else - # Sadly: Different pulpcore-versions aren't either... - for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|select(.component!="gem")|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")') - do - ./generate.sh "${item}" python - cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" - sudo rm -rf "./${item}-client" - done - fi + for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")') + do + ./generate.sh "${item}" python + cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client" + sudo rm -rf "./${item}-client" + done fi popd diff --git a/.github/workflows/scripts/stage-changelog-for-default-branch.py b/.github/workflows/scripts/stage-changelog-for-default-branch.py deleted file mode 100755 index a66697a..0000000 --- a/.github/workflows/scripts/stage-changelog-for-default-branch.py +++ /dev/null @@ -1,70 +0,0 @@ -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulp_gem' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -import argparse -import os -import textwrap - -from git import Repo -from git.exc import GitCommandError - - -helper = textwrap.dedent( - """\ - Stage the changelog for a release on main branch. - - Example: - $ python .github/workflows/scripts/stage-changelog-for-default-branch.py 3.4.0 - - """ -) - -parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper) - -parser.add_argument( - "release_version", - type=str, - help="The version string for the release.", -) - -args = parser.parse_args() - -release_version_arg = args.release_version - -release_path = os.path.dirname(os.path.abspath(__file__)) -plugin_path = release_path.split("/.github")[0] - -if not release_version_arg.endswith(".0"): - os._exit(os.system("python .ci/scripts/changelog.py")) - -print(f"\n\nRepo path: {plugin_path}") -repo = Repo(plugin_path) - -changelog_commit = None -# Look for a commit with the requested release version -for commit in repo.iter_commits(): - if f"{release_version_arg} changelog" == commit.message.split("\n")[0]: - changelog_commit = commit - break - if f"Add changelog for {release_version_arg}" == commit.message.split("\n")[0]: - changelog_commit = commit - break - -if not changelog_commit: - raise RuntimeError("Changelog commit for {release_version_arg} was not found.") - -git = repo.git -git.stash() -git.checkout("origin/main") -try: - git.cherry_pick(changelog_commit.hexsha) -except GitCommandError: - git.add("CHANGES/") - # Don't try opening an editor for the commit message - with git.custom_environment(GIT_EDITOR="true"): - git.cherry_pick("--continue") -git.reset("origin/main") diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4efe546..3f0d4af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,10 +68,6 @@ jobs: ANSIBLE_FORCE_COLOR: "1" 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: | @@ -94,16 +90,6 @@ jobs: GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" REDIS_DISABLED: "${{ contains('', matrix.env.TEST) }}" - - 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 @@ -126,34 +112,6 @@ jobs: if-no-files-found: "error" retention-days: 5 overwrite: true - - name: Upload python client packages - if: ${{ env.TEST == 'pulp' }} - uses: actions/upload-artifact@v4 - with: - name: "python-client.tar" - path: "pulp_gem/gem-python-client.tar" - if-no-files-found: "error" - retention-days: 5 - overwrite: true - - - name: Upload python client docs - if: ${{ env.TEST == 'pulp' }} - uses: actions/upload-artifact@v4 - with: - name: "python-client-docs.tar" - path: "pulp_gem/gem-python-client-docs.tar" - if-no-files-found: "error" - retention-days: 5 - overwrite: true - - name: Upload Ruby client - if: ${{ env.TEST == 'pulp' }} - uses: actions/upload-artifact@v4 - with: - name: "ruby-client.tar" - path: "pulp_gem/gem-ruby-client.tar" - if-no-files-found: "error" - retention-days: 5 - overwrite: true - name: Upload built docs if: ${{ env.TEST == 'docs' }} uses: actions/upload-artifact@v4