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

Stop publishing bindings #870

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ DEPRECATED_FILES = {
".github/workflows/fips.yml",
".github/workflows/scripts/create_release_from_tag.sh",
".github/workflows/scripts/release.py",
".github/workflows/scripts/publish_client_gem.sh",
".github/workflows/scripts/publish_client_pypi.sh",
".github/workflows/scripts/stage-changelog-for-default-branch.py",
".github/workflows/scripts/stage-changelog-for-master.py",
".github/workflows/scripts/update_ci.sh",
".travis",
Expand Down
6 changes: 0 additions & 6 deletions templates/github/.github/workflows/nightly.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ jobs:
name: "docs.tar"
path: "{{ plugin_name }}"

- name: Download Python client docs
uses: actions/download-artifact@v4
with:
name: "python-client-docs.tar"
path: "{{ plugin_name }}"

{{ set_secrets() | indent(6) }}

- name: Publish docs to pulpproject.org
Expand Down
136 changes: 7 additions & 129 deletions templates/github/.github/workflows/publish.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ defaults:
jobs:
build:
uses: "./.github/workflows/build.yml"
{%- if publish_docs_to_pulpprojectdotorg %}

build-bindings-docs:
build-docs:
needs:
- "build"
runs-on: "ubuntu-latest"
Expand All @@ -50,54 +51,11 @@ jobs:

{{ install_python_deps(["towncrier", "twine", "wheel", "httpie", "docker", "netaddr", "boto3", "ansible", "mkdocs"]) | indent(6) }}

# 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.
{{ run_script(name="Before Install", file="before_install.sh") | indent(6) }}

{{ run_script(name="Install", file="install.sh") | indent(6) }}

{{ run_script(name="Install Python client", file="install_python_client.sh", withenv=False) | indent(6) }}

{%- if deploy_client_to_rubygems %}
{{ run_script(name="Install Ruby client", file="install_ruby_client.sh", withenv=False) | indent(6) }}
{%- endif %}

- name: "Upload python client packages"
uses: "actions/upload-artifact@v4"
with:
name: "python-client.tar"
path: |
{%- for plugin in plugins %}
{{ plugin_name }}/{{ plugin.app_label }}-python-client.tar
{%- endfor %}
if-no-files-found: "error"
overwrite: true

- name: "Upload python client docs"
uses: "actions/upload-artifact@v4"
with:
name: "python-client-docs.tar"
path: |
{%- for plugin in plugins %}
{{ plugin_name }}/{{ plugin.app_label }}-python-client-docs.tar
{%- endfor %}
if-no-files-found: "error"
overwrite: true

{%- if deploy_client_to_rubygems %}
- name: "Upload ruby client packages"
uses: "actions/upload-artifact@v4"
with:
name: "ruby-client.tar"
path: |
{%- for plugin in plugins %}
{{ plugin_name }}/{{ plugin.app_label }}-ruby-client.tar
{%- endfor %}
if-no-files-found: "error"
overwrite: true
{%- endif %}

{%- if publish_docs_to_pulpprojectdotorg %}
- name: Build docs
run: |
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
Expand All @@ -112,15 +70,15 @@ jobs:
path: "{{ plugin_name }}/docs/docs.tar"
if-no-files-found: "error"
overwrite: true
{%- endif %}

{{ display_logs() | indent(6) }}
{%- endif %}

{%- if deploy_to_pypi %}
publish-package:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"
- "build"

env:
GITHUB_TOKEN: "{{ '${{ secrets.GITHUB_TOKEN }}' }}"
Expand All @@ -144,79 +102,11 @@ jobs:
.github/workflows/scripts/publish_plugin_pypi.sh {{ "${{ github.ref_name }}" }}
{%- endif %}

{%- if deploy_client_to_pypi %}
publish-python-bindings:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"

env:
GITHUB_TOKEN: "{{ '${{ secrets.GITHUB_TOKEN }}' }}"

steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}

- name: "Download Python client"
uses: "actions/download-artifact@v4"
with:
name: "python-client.tar"
path: "{{ plugin_name }}/"

- name: "Untar python client packages"
run: |
{%- for plugin in plugins %}
tar -xvf {{ plugin.app_label }}-python-client.tar
{%- endfor %}

{{ setup_python() | indent(6) }}

{{ install_python_deps(["twine"]) | indent(6) }}

{{ set_secrets() | indent(6) }}

- name: "Publish client to pypi"
run: |
bash .github/workflows/scripts/publish_client_pypi.sh {{ "${{ github.ref_name }}" }}
{%- endif %}

{%- if deploy_client_to_rubygems %}
publish-ruby-bindings:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"

env:
GITHUB_TOKEN: "{{ "${{ secrets.GITHUB_TOKEN }}" }}"

steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}

- name: "Download Ruby client"
uses: "actions/download-artifact@v4"
with:
name: "ruby-client.tar"
path: "{{ plugin_name }}/"

- name: "Untar Ruby client packages"
run: |
{%- for plugin in plugins %}
tar -xvf {{ plugin.app_label }}-ruby-client.tar
{%- endfor %}

{{ setup_ruby() | indent(6) }}

{{ set_secrets() | indent(6) }}

- name: "Publish client to rubygems"
run: |
bash .github/workflows/scripts/publish_client_gem.sh {{ "${{ github.ref_name }}" }}
{%- endif %}

{%- if publish_docs_to_pulpprojectdotorg %}
publish-docs:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"
- "build-docs"

env:
GITHUB_TOKEN: "{{ "${{ secrets.GITHUB_TOKEN }}" }}"
Expand All @@ -236,12 +126,6 @@ jobs:
name: "docs.tar"
path: "{{ plugin_name }}/"

- name: "Download Python client docs"
uses: "actions/download-artifact@v4"
with:
name: "python-client-docs.tar"
path: "{{ plugin_name }}/"

- name: "Publish docs to pulpproject.org"
run: |
tar -xvf docs.tar
Expand All @@ -251,16 +135,10 @@ jobs:
create-gh-release:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"
- "build-docs"
{%- if deploy_to_pypi %}
- "publish-package"
{%- endif %}
{%- if deploy_client_to_pypi %}
- "publish-python-bindings"
{%- endif %}
{%- if deploy_client_to_rubygems %}
- "publish-ruby-bindings"
{%- endif %}
{%- if publish_docs_to_pulpprojectdotorg %}
- "publish-docs"
{%- endif %}
Expand Down

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions templates/github/.github/workflows/scripts/publish_docs.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,3 @@ if [[ "$GITHUB_WORKFLOW" == "{{ plugin_app_label | camel }} changelog update" ]]
# Do not build bindings docs on changelog update
exit
fi

{%- for plugin in plugins %}

mkdir -p ../{{ plugin.app_label }}-bindings
tar -xvf {{ plugin.app_label }}-python-client-docs.tar --directory ../{{ plugin.app_label }}-bindings
pushd ../{{ plugin.app_label }}-bindings

# publish to docs.pulpproject.org/{{ plugin.name | snake }}_client
rsync -avzh site/ doc_builder_{{ plugin.name | snake }}@docs.pulpproject.org:/var/www/docs.pulpproject.org/{{ plugin.name | snake }}_client/

# publish to docs.pulpproject.org/{{ plugin.name | snake }}_client/en/{release}
rsync -avzh site/ doc_builder_{{ plugin.name | snake }}@docs.pulpproject.org:/var/www/docs.pulpproject.org/{{ plugin.name | snake }}_client/en/"$2"
popd
{%- endfor %}
76 changes: 18 additions & 58 deletions templates/github/.github/workflows/scripts/script.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,68 +59,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[]
{%- for plugin in plugins -%}
| select(.component!="{{ plugin.app_label }}")
{%- endfor -%}
| 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[]
{%- for plugin in plugins -%}
|select(.component!="{{ plugin.app_label }}")
{%- endfor -%}
|(.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

Expand Down
Loading
Loading