Skip to content

Commit

Permalink
Add GCP scenario
Browse files Browse the repository at this point in the history
closes pulp#713
  • Loading branch information
fao89 committed Dec 23, 2022
1 parent e8465b5 commit fe23e34
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bootstrap.yaml
Expand Up @@ -93,6 +93,7 @@ jobs:
- TEST: pulp
- TEST: docs
- TEST: azure
- TEST: gcp
- TEST: s3
- TEST: lowerbounds
outputs:
Expand Down
1 change: 1 addition & 0 deletions CHANGES/713.feature
@@ -0,0 +1 @@
Add GCP scenario
1 change: 1 addition & 0 deletions plugin-template
Expand Up @@ -54,6 +54,7 @@ DEFAULT_SETTINGS = {
"publish_docs_to_pulpprojectdotorg": False,
"pulp_settings": None,
"pulp_settings_azure": None,
"pulp_settings_gcp": None,
"pulp_settings_s3": None,
"pulp_settings_stream": None,
"pulpcore_branch": "main",
Expand Down
3 changes: 3 additions & 0 deletions templates/github/.ci/ansible/Containerfile.j2.copy
Expand Up @@ -20,6 +20,9 @@ RUN pip3 install \
{%- if azure_test | default(false) -%}
{{ " " }}django-storages[azure]>=1.12.2
{%- endif -%}
{%- if gcp_test | default(false) -%}
{{ " " }}django-storages[google]>=1.13.2
{%- endif -%}
{%- for item in plugins -%}
{%- if item.name == "pulp-certguard" -%}
{{ " " }}python-dateutil rhsm
Expand Down
7 changes: 7 additions & 0 deletions templates/github/.ci/ansible/settings.py.j2.copy
Expand Up @@ -63,3 +63,10 @@ AZURE_OVERWRITE_FILES = True
AZURE_URL_EXPIRATION_SECS = 120
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol={{ pulp_scheme }};AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint={{ pulp_scheme }}://ci-azurite:10000/devstoreaccount1;'
{% endif %}

{% if gcp_test | default(false) %}
DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
MEDIA_ROOT = ""
GS_BUCKET_NAME = "gcppulp"
GS_CUSTOM_ENDPOINT = "http://gcp:4443"
{% endif %}
3 changes: 3 additions & 0 deletions templates/github/.github/workflows/ci.yml.j2
Expand Up @@ -109,6 +109,9 @@ jobs:
{%- if test_azure %}
- TEST: azure
{%- endif %}
{%- if test_gcp %}
- TEST: gcp
{%- endif %}
{%- if test_s3 %}
- TEST: s3
{%- endif %}
Expand Down
3 changes: 3 additions & 0 deletions templates/github/.github/workflows/nightly.yml.j2
Expand Up @@ -36,6 +36,9 @@ jobs:
{%- if test_azure %}
- TEST: azure
{%- endif %}
{%- if test_gcp %}
- TEST: gcp
{%- endif %}
{%- if test_s3 %}
- TEST: s3
{%- endif %}
Expand Down
3 changes: 3 additions & 0 deletions templates/github/.github/workflows/release.yml.j2
Expand Up @@ -77,6 +77,9 @@ jobs:
{%- if test_azure %}
- TEST: azure
{%- endif %}
{%- if test_gcp %}
- TEST: gcp
{%- endif %}
{%- if test_s3 %}
- TEST: s3
{%- endif %}
Expand Down
21 changes: 21 additions & 0 deletions templates/github/.github/workflows/scripts/install.sh.j2
Expand Up @@ -203,6 +203,27 @@ pulp_scenario_settings: {{ pulp_settings_azure | tojson }}\
fi
{%- endif %}

{%- if test_gcp %}

if [ "$TEST" = "gcp" ]; then
mkdir -p cigcp
cd cigcp
openssl req -newkey rsa:2048 -x509 -nodes -keyout gcpkey.pem -new -out gcpcert.pem -sha256 -days 365 -addext "subjectAltName=DNS:ci-gcp" -subj "/C=CO/ST=ST/L=LO/O=OR/OU=OU/CN=CN"
sudo cp gcpcert.pem /usr/local/share/ca-certificates/gcpcert.crt
sudo dpkg-reconfigure ca-certificates
cd ..
sed -i -e '/^services:/a \
- name: ci-gcp\
image: fsouza/fake-gcs-server\
volumes:\
- storage_data:/etc/pulp\
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 }}\
' vars/main.yaml
fi
{%- endif %}

echo "PULP_API_ROOT=${PULP_API_ROOT}" >> "$GITHUB_ENV"

if [ "${PULP_API_ROOT:-}" ]; then
Expand Down

0 comments on commit fe23e34

Please sign in to comment.