diff --git a/README.md b/README.md index 6a27684f..e1ffac0d 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,16 @@ The following settings are stored in `template_config.yml`. pulp_settings_ A dictionary of settings that the plugin tests can set - additionally. `` is one of "azure", "s3", "stream". + additionally. `` is one of "azure", "s3", "gcp". + + pulp_env A dictionary of ENV variables used globally by all runners. The variables + are translated to separate ENV layers in Containerfile configuring the base + Pulp image. + + pulp_env_ + A dictionary of ENV variables that will be translated to separate ENV + layers in Containerfile configuring the base Pulp image. `` is one + of "azure", "s3", "gcp". pydocstyle Boolean, whether to have flake8 use pydocstyle to check for compliance with Python docstring conventions. diff --git a/plugin-template b/plugin-template index a8e83e08..b8264e8c 100755 --- a/plugin-template +++ b/plugin-template @@ -62,12 +62,15 @@ DEFAULT_SETTINGS = { "pre_job_template": None, "publish_docs_to_pulpprojectdotorg": False, "pulpprojectdotorg_key_id": None, + "pulp_env": {}, + "pulp_env_azure": {}, + "pulp_env_gcp": {}, + "pulp_env_s3": {}, "pulp_scheme": "https", "pulp_settings_azure": None, "pulp_settings_gcp": None, "pulp_settings": None, "pulp_settings_s3": None, - "pulp_settings_stream": None, "pydocstyle": True, "pypi_username": None, "python_version": "3.8", diff --git a/templates/github/.ci/ansible/Containerfile.j2.copy b/templates/github/.ci/ansible/Containerfile.j2.copy index 66f15a72..482ee277 100644 --- a/templates/github/.ci/ansible/Containerfile.j2.copy +++ b/templates/github/.ci/ansible/Containerfile.j2.copy @@ -30,6 +30,18 @@ RUN pip3 install {%- endif -%} {%- endfor %} +{% if pulp_env is defined and pulp_env %} +{% for key, value in pulp_env.items() %} +ENV {{ key | upper }}={{ value }} +{% endfor %} +{% endif %} + +{% if pulp_scenario_env is defined and pulp_scenario_env %} +{% for key, value in pulp_scenario_env.items() %} +ENV {{ key | upper }}={{ value }} +{% endfor %} +{% endif %} + USER pulp:pulp RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \ /usr/local/bin/pulpcore-manager collectstatic --clear --noinput --link diff --git a/templates/github/.github/workflows/scripts/install.sh.j2 b/templates/github/.github/workflows/scripts/install.sh.j2 index 1900eccb..a53d147f 100755 --- a/templates/github/.github/workflows/scripts/install.sh.j2 +++ b/templates/github/.github/workflows/scripts/install.sh.j2 @@ -70,6 +70,7 @@ services: VARSYAML cat >> vars/main.yaml << VARSYAML +pulp_env: {{ pulp_env | tojson }} pulp_settings: {{ pulp_settings | tojson }} pulp_scheme: {{ pulp_scheme }} {% if python_version == "3.6" %} @@ -108,6 +109,7 @@ if [ "$TEST" = "s3" ]; then minio_access_key: "'$MINIO_ACCESS_KEY'"\ minio_secret_key: "'$MINIO_SECRET_KEY'"\ pulp_scenario_settings: {{ pulp_settings_s3 | tojson }}\ +pulp_scenario_env: {{ pulp_env_s3 | tojson }}\ ' vars/main.yaml {%- if test_reroute %} @@ -133,6 +135,7 @@ if [ "$TEST" = "azure" ]; then command: "azurite-blob --blobHost 0.0.0.0{% if pulp_scheme == "https" %} --cert /etc/pulp/azcert.pem --key /etc/pulp/azkey.pem{% endif %}"' vars/main.yaml sed -i -e '$a azure_test: true\ pulp_scenario_settings: {{ pulp_settings_azure | tojson }}\ +pulp_scenario_env: {{ pulp_env_azure | tojson }}\ ' vars/main.yaml fi {%- endif %} @@ -154,6 +157,7 @@ if [ "$TEST" = "gcp" ]; then command: "{% if pulp_scheme == "https" %} -cert-location /etc/pulp/gcpcert.pem {% else %} -scheme http{% endif %}"' vars/main.yaml sed -i -e '$a gcp_test: true\ pulp_scenario_settings: {{ pulp_settings_gcp | tojson }}\ +pulp_scenario_env: {{ pulp_env_gcp | tojson }}\ ' vars/main.yaml fi {%- endif %}