Skip to content

Commit

Permalink
Experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellweg committed May 27, 2024
1 parent 715cf27 commit cad3252
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-335-gdf91f79
2021.08.26-336-g05dbeb5
6 changes: 0 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
133 changes: 5 additions & 128 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
uses: "./.github/workflows/build.yml"

build-bindings-docs:
build-docs:
needs:
- "build"
runs-on: "ubuntu-latest"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -143,7 +108,7 @@ jobs:
publish-package:
runs-on: "ubuntu-latest"
needs:
- "build-bindings-docs"
- "build"

env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Expand Down Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/scripts/publish_client_gem.sh

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/scripts/publish_client_pypi.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/scripts/publish_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/ [email protected]:/var/www/docs.pulpproject.org/pulp_gem_client/

# publish to docs.pulpproject.org/pulp_gem_client/en/{release}
rsync -avzh site/ [email protected]:/var/www/docs.pulpproject.org/pulp_gem_client/en/"$2"
popd
68 changes: 18 additions & 50 deletions .github/workflows/scripts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit cad3252

Please sign in to comment.