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

Fix openapi client generation in the playbooks. #2109

Merged
merged 7 commits into from
Mar 29, 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
8 changes: 4 additions & 4 deletions .github/workflows/ci_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ jobs:
run: pip3 install ansible

- name: run the build container playbook
run: cd dev/playbooks; ansible-playbook -i 'localhost,' --forks=1 -v build_container.yaml
run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v build_container.yaml

- name: run the start container playbook
run: cd dev/playbooks; ansible-playbook -i 'localhost,' --forks=1 -v start_container.yaml
run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v start_container.yaml

- name: run the unit test playbook
run: cd dev/playbooks; ansible-playbook -i 'localhost,' --forks=1 -v run_unit_tests.yaml
run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v run_unit_tests.yaml

- name: run the functional test playbook
run: cd dev/playbooks; ansible-playbook -i 'localhost,' --forks=1 -v run_functional_tests.yaml
run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v run_functional_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash -x

set -e

PULP_IP=$1
PLUGIN=$2

cd ../../..
if [[ ! -d pulp-openapi-generator ]]; then
git clone https://github.com/pulp/pulp-openapi-generator
fi
cd pulp-openapi-generator;

export USE_LOCAL_API_JSON=true;
export PULP_URL="https://${PULP_IP}/api/galaxy/pulp/api/v3/";

curl -L -k -u admin:password -o status.json "https://${PULP_IP}/api/galaxy/pulp/api/v3/status/";
curl -L -k -u admin:password -o api.json "https://${PULP_IP}/api/galaxy/pulp/api/v3/docs/api.json?bindings&plugin=${PLUGIN}";

if [ "${PLUGIN}" == "galaxy_ng" ]; then
cat status.json | head
export REPORTED_VERSION=$(jq '.versions[] | select (.component == "galaxy").version' status.json | tr -d '"')
echo "REPORTED_VERSION: ${REPORTED_VERSION}"
export VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')"
echo "FINAL_VERSION: ${FINAL_VERSION}"
else
export VERSION=""
fi;

bash -x generate.sh ${PLUGIN} python ${VERSION}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,41 @@
connection: local
register: pulp_ip

#- name: run the generate script
# galaxy_ng.tools.local_run:
# command: >
# cd ../../../pulp-openapi-generator;
# export USE_LOCAL_API_JSON=true;
# export PULP_URL='https://{{ pulp_ip.stdout }}/api/galaxy/pulp/api/v3/';
# curl -L -k -u admin:password -o status.json 'https://{{ pulp_ip.stdout }}/api/galaxy/pulp/api/v3/status/';
# curl -L -k -u admin:password -o api.json 'https://{{ pulp_ip.stdout }}/api/galaxy/pulp/api/v3/docs/api.json?bindings&plugin={{ item }}';
# if [ "{{ item }}" == "galaxy_ng" ]; then
# cat status.json | head
# export REPORTED_VERSION=$(jq '.versions[] | select (.component == "galaxy").version' status.json | tr -d '"')
# echo "REPORTED_VERSION: ${REPORTED_VERSION}"
# export VERSION="$(echo "$REPORTED_VERSION" | python -c 'from packaging.version import Version; print(Version(input()))')"
# echo "FINAL_VERSION: ${FINAL_VERSION}"
# else
# export VERSION=""
# fi;
# bash -x generate.sh {{ item }} python $VERSION
# connection: local
# loop:
# - galaxy_ng
# - pulp_ansible
# - pulp_container
# - pulpcore

- name: copy the generate script to a tmp location
copy:
src: generate.sh
dest: /tmp/generate.sh
mode: '0777'
connection: local

- name: run the generate script
galaxy_ng.tools.local_run:
command: >
cd ../../../pulp-openapi-generator;
export USE_LOCAL_API_JSON=true;
curl -L -k -u admin:password -o api.json 'https://{{ pulp_ip.stdout }}/api/galaxy/pulp/api/v3/docs/api.json?bindings&plugin={{ item }}';
bash -x generate.sh {{ item }} python
command: /tmp/generate.sh {{ pulp_ip.stdout }} {{ item }}
connection: local
loop:
- galaxy_ng
Expand All @@ -25,9 +53,12 @@
- pulpcore

- name: install the generated client inside the pulp container
shell: cd /src/pulp-openapi-generator/{{ item }}-client/; pip3 install -e .
shell: cd /src/pulp-openapi-generator/{{ item }}-client/; pip3 install .
loop:
- galaxy_ng
- pulp_ansible
- pulp_container
- pulpcore

- name: show what we eneded up with
shell: pip3 list | grep -e galaxy -e pulp -e ansible
Loading