22
33{% include ' header.j2' %}
44
5- set -mveuo pipefail
5+ set -euo pipefail
66
77# make sure this script runs at the repo root
88cd " $( dirname " $( realpath -e " $0 " ) " ) " /../../..
99
10- export PRE_BEFORE_INSTALL=$PWD /.github/workflows/scripts/pre_before_install.sh
11- export POST_BEFORE_INSTALL=$PWD /.github/workflows/scripts/post_before_install.sh
12-
13- {% if setup_py -%}
14- COMPONENT_VERSION=$( sed -ne " s/\s*version.*=.*['\" ]\(.*\)['\" ][\s,]*/\1/p" setup.py)
15- {%- else -%}
16- COMPONENT_VERSION=$( python3 -c " import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" )
17- {%- endif %}
10+ if [ -f .github/workflows/scripts/pre_before_install.sh ]; then
11+ source .github/workflows/scripts/pre_before_install.sh
12+ fi
1813
19- # Compose ansible container definition.
20- mkdir .ci/ansible/vars || true
21- echo " ---" > .ci/ansible/vars/main.yaml
22- echo " legacy_component_name: {{ plugin_name | snake }}" >> .ci/ansible/vars/main.yaml
23- echo " component_name: {{ plugin_app_label }}" >> .ci/ansible/vars/main.yaml
24- echo " component_version: '${COMPONENT_VERSION} '" >> .ci/ansible/vars/main.yaml
14+ COMPONENT_VERSION=" $( bump-my-version show current_version | tail -n -1 | python -c ' from packaging.version import Version; print(Version(input()))' ) "
15+ COMPONENT_SOURCE=" ./{{ plugin_name }}/dist/{{ plugin_name | snake }}-${COMPONENT_VERSION} -py3-none-any.whl"
2516
26- if [ -f $PRE_BEFORE_INSTALL ]; then
27- source $PRE_BEFORE_INSTALL
17+ {%- set PULPCORE_PREFIX = " " if plugin_name == " pulpcore" else " pulpcore" %}
18+ {%- if test_s3 %}
19+ if [ " $TEST " = " s3" ]; then
20+ COMPONENT_SOURCE=" ${COMPONENT_SOURCE} {{ PULPCORE_PREFIX }}[s3]"
2821fi
29-
30- if [[ " $TEST " = " s3" ]]; then
31- for i in {1..3}
32- do
33- ansible-galaxy collection install " amazon.aws:8.1.0" && s=0 && break || s=$? && sleep 3
34- done
35- if [[ $s -gt 0 ]]
36- then
37- echo " Failed to install amazon.aws"
38- exit $s
22+ {%- endif %}
23+ {%- if test_azure %}
24+ if [ " $TEST " = " azure" ]; then
25+ COMPONENT_SOURCE=" ${COMPONENT_SOURCE} {{ PULPCORE_PREFIX }}[azure]"
3926fi
27+ {%- endif %}
28+ {%- if test_gcp %}
29+ if [ " $TEST " = " gcp" ]; then
30+ COMPONENT_SOURCE=" ${COMPONENT_SOURCE} {{ PULPCORE_PREFIX }}[google]"
4031fi
32+ {%- endif %}
4133
4234if [[ " $TEST " = " pulp" ]]; then
4335 python3 .ci/scripts/calc_constraints.py -u {% if setup_py -%} requirements.txt {% else -%} pyproject.toml {% endif -%} > upperbounds_constraints.txt
@@ -46,6 +38,108 @@ if [[ "$TEST" = "lowerbounds" ]]; then
4638 python3 .ci/scripts/calc_constraints.py {% if setup_py -%} requirements.txt {% else -%} pyproject.toml {% endif -%} > lowerbounds_constraints.txt
4739fi
4840
49- if [ -f $POST_BEFORE_INSTALL ]; then
50- source $POST_BEFORE_INSTALL
41+ {%- if test_reroute %}
42+ export PULP_API_ROOT=$( test " ${TEST} " = " s3" && echo " /rerouted/djnd/" || echo " {{ api_root }}" )
43+ {%- else %}
44+ export PULP_API_ROOT=" {{ api_root }}"
45+ {%- endif %}
46+
47+ echo " PULP_API_ROOT=${PULP_API_ROOT} " >> " $GITHUB_ENV "
48+
49+ # Compose the scenario definition.
50+ mkdir -p .ci/ansible/vars
51+
52+ cat > .ci/ansible/vars/main.yaml << VARSYAML
53+ ---
54+ scenario: "${TEST} "
55+ legacy_component_name: "{{ plugin_name | snake }}"
56+ component_name: "{{ plugin_app_label }}"
57+ component_version: "${COMPONENT_VERSION} "
58+ pulp_env: {{ pulp_env | tojson }}
59+ pulp_settings: {{ pulp_settings | tojson }}
60+ pulp_scheme: "{{ pulp_scheme }}"
61+ {%- if ci_base_image.count(":") %}
62+ pulp_default_container: "{{ ci_base_image }}"
63+ {% else %}
64+ pulp_default_container: "{{ ci_base_image + ":latest" }}"
65+ {% endif -%}
66+ api_root: "${PULP_API_ROOT} "
67+ image:
68+ name: "pulp"
69+ tag: "ci_build"
70+ plugins:
71+ - name: "{{ plugin_name }}"
72+ source: "${COMPONENT_SOURCE} "
73+ ci_requirements: $( test -f ci_requirements.txt && echo -n true || echo -n false)
74+ upperbounds: $( test " ${TEST} " = " pulp" && echo -n true || echo -n false)
75+ lowerounds: $( test " ${TEST} " = " lowerbounds" && echo -n true || echo -n false)
76+ {%- if extra_files %}
77+ extra_files:
78+ {%- for item in extra_files %}
79+ - origin: "{{ item.origin }}"
80+ destination: "{{ item.destination }}"
81+ {%- endfor %}
82+ {%- endif %}
83+ services:
84+ - name: "pulp"
85+ image: "pulp:ci_build"
86+ volumes:
87+ - "./settings:/etc/pulp"
88+ - "./ssh:/keys/"
89+ - "~/.config:/var/lib/pulp/.config"
90+ - "../../../pulp-openapi-generator:/root/pulp-openapi-generator"
91+ env:
92+ PULP_WORKERS: "4"
93+ PULP_HTTPS: "{{ 'true' if pulp_scheme == 'https' else 'false' }}"
94+ {%- if docker_fixtures %}
95+ - name: "pulp-fixtures"
96+ image: "docker.io/pulp/pulp-fixtures:latest"
97+ env:
98+ BASE_URL: "http://pulp-fixtures:8080"
99+ {%- endif %}
100+ VARSYAML
101+
102+ if [ " $TEST " = " s3" ]; then
103+ MINIO_ACCESS_KEY=AKIAIT2Z5TDYPX3ARJBA
104+ MINIO_SECRET_KEY=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
105+ cat >> .ci/ansible/vars/main.yaml << VARSYAML
106+ - name: "minio"
107+ image: "minio/minio"
108+ env:
109+ MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY} "
110+ MINIO_SECRET_KEY: "${MINIO_SECRET_KEY} "
111+ command: "server /data"
112+ minio_access_key: "${MINIO_ACCESS_KEY} "
113+ minio_secret_key: "${MINIO_SECRET_KEY} "
114+ pulp_scenario_settings: {{ pulp_settings_s3 | tojson }}
115+ pulp_scenario_env: {{ pulp_env_s3 | tojson }}
116+ VARSYAML
117+ fi
118+
119+ if [ " $TEST " = " azure" ]; then
120+ cat >> .ci/ansible/vars/main.yaml << VARSYAML
121+ - name: "ci-azurite"
122+ image: "mcr.microsoft.com/azure-storage/azurite"
123+ volumes:
124+ - "./azurite:/etc/pulp\"
125+ command: "azurite-blob --skipApiVersionCheck --blobHost 0.0.0.0"
126+ pulp_scenario_settings: {{ pulp_settings_azure | tojson }}
127+ pulp_scenario_env: {{ pulp_env_azure | tojson }}
128+ VARSYAML
129+ fi
130+
131+ if [ " $TEST " = " gcp" ]; then
132+ - name: " ci-gcp"
133+ image: " fsouza/fake-gcs-server"
134+ volumes:
135+ - " storage_data:/etc/pulp"
136+ command: " -scheme http"
137+ pulp_scenario_settings: {{ pulp_settings_gcp | tojson }}
138+ pulp_scenario_env: {{ pulp_env_gcp | tojson }}
139+ fi
140+
141+ cat .ci/ansible/vars/main.yaml
142+
143+ if [ -f .github/workflows/scripts/post_before_install.sh ]; then
144+ source .github/workflows/scripts/post_before_install.sh
51145fi
0 commit comments