Skip to content
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
71 changes: 67 additions & 4 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,74 @@ DEFAULT_SETTINGS = {
"pulp_env_gcp": {},
"pulp_env_s3": {},
"pulp_scheme": "https",
"pulp_settings_azure": {"domain_enabled": True},
"pulp_settings_gcp": None,
"pulp_settings_azure": {
"domain_enabled": True,
"MEDIA_ROOT": "",
"STORAGES": {
"default": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
"account_key": (
"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/"
"K1SZFPTOtr/KBHBeksoGMGw=="
),
"account_name": "devstoreaccount1",
"location": "pulp3",
"azure_container": "pulp-test",
"overwrite_files": True,
"expiration_secs": 120,
"connection_string": (
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey"
"=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/"
"K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/"
"devstoreaccount1;"
),
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
},
},
"pulp_settings_gcp": {
"domain_enabled": True,
"MEDIA_ROOT": "",
"STORAGES": {
"default": {
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
"OPTIONS": {
"bucket_name": "gcppulp",
"custom_endpoint": "http://ci-gcp:4443",
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
},
},
"pulp_settings": None,
"pulp_settings_s3": None,
"pulp_settings_s3": {
"domain_enabled": True,
"MEDIA_ROOT": "",
"STORAGES": {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"access_key": "AKIAIT2Z5TDYPX3ARJBA",
"secret_key": "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",
"region_name": "eu-central-1",
"addressing_style": "path",
"signature_version": "s3v4",
"bucket_name": "pulp3",
"endpoint_url": "http://minio:9000",
"default_acl": "@none",
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
},
},
"pydocstyle": True,
"release_email": "pulp-infra@redhat.com",
"release_user": "pulpbot",
Expand All @@ -73,7 +137,6 @@ DEFAULT_SETTINGS = {
"test_performance": False,
"test_reroute": True,
"test_s3": False,
"test_storages_compat_layer": False,
"use_issue_template": True,
}

Expand Down
2 changes: 1 addition & 1 deletion templates/bootstrap/pyproject.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
]
requires-python = ">=3.9"
dependencies = [
"pulpcore>=3.49.0,<3.85",
"pulpcore>=3.70.0,<3.100",
]

[project.urls]
Expand Down
124 changes: 0 additions & 124 deletions templates/github/.ci/ansible/settings.py.j2.copy
Original file line number Diff line number Diff line change
Expand Up @@ -26,127 +26,3 @@ API_ROOT = {{ api_root | repr }}
{% endfor %}
{% endif %}

{# =======================================
Macros for legacy and new storage settings
========================================== -#}

{%- macro s3_settings(legacy) -%}
{%- if legacy %}
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
AWS_ACCESS_KEY_ID = "{{ minio_access_key }}"
AWS_SECRET_ACCESS_KEY = "{{ minio_secret_key }}"
AWS_S3_REGION_NAME = "eu-central-1"
AWS_S3_ADDRESSING_STYLE = "path"
AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_STORAGE_BUCKET_NAME = "pulp3"
AWS_S3_ENDPOINT_URL = "http://minio:9000"
AWS_DEFAULT_ACL = "@none None"
{%- else %}
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"access_key": "{{ minio_access_key }}",
"secret_key": "{{ minio_secret_key }}",
"region_name": "eu-central-1",
"addressing_style": "path",
"signature_version": "s3v4",
"bucket_name": "pulp3",
"endpoint_url": "http://minio:9000",
"default_acl": "@none None",
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}
{%- endif %}
{%- endmacro -%}

{%- macro azure_settings(legacy) -%}
{%- if legacy %}
DEFAULT_FILE_STORAGE = "storages.backends.azure_storage.AzureStorage"
AZURE_ACCOUNT_KEY = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
AZURE_ACCOUNT_NAME = "devstoreaccount1"
AZURE_CONTAINER = "pulp-test"
AZURE_LOCATION = "pulp3"
AZURE_OVERWRITE_FILES = True
AZURE_URL_EXPIRATION_SECS = 120
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;'
Comment on lines -68 to -75
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to "move" this information into the default template values?
(I know it only helps a newly templated plugin, but it also serves as some sort of documentation.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this actually enables it in the ephemeral catdog plugin of this repository. ;)

{%- else %}
STORAGES = {
"default": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
"account_key": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==",
"account_name": "devstoreaccount1",
"location": "pulp3",
"azure_container": "pulp-test",
"overwrite_files": True,
"expiration_secs": 120,
"connection_string": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;",
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}
{%- endif %}
{%- endmacro -%}

{%- macro gcp_settings(legacy) -%}
{%- if legacy %}
DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
GS_BUCKET_NAME = "gcppulp"
GS_CUSTOM_ENDPOINT = "http://ci-gcp:4443"
{%- else %}
STORAGES = {
"default": {
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
"OPTIONS": {
"bucket_name": "gcppulp",
"custom_endpoint": "http://ci-gcp:4443",
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}
{%- endif %}
{%- endmacro -%}

{#- ==========================================
Render according to test_storages_compat_layer
==============================================

Case 1) test_storages_compat_layer is unset
- All storages render the legacy setting
- Branches using pulpcore <3.70 must leave this key unset (use legacy)

Case 2) test_storages_compat_layer is True
- To tests both work, only one setting uses the new storage setting
- Branches using pulpcore >=3.70,<3.85 must set this key to True (test both)

Case 3) test_storages_compat_layer is False
- All storages render the new setting
- Branches using pulpcore >=3.85 must set this key to False (use new)
-#}

{% if s3_test | default(false) or azure_test | default(false) or gcp_test | default(false)%}
MEDIA_ROOT=""
{% endif %}
{%- if test_storages_compat_layer is not defined -%}
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=True) }}{%- endif -%}
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=True) }}{%- endif -%}
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=True) }}{%- endif -%}
{%- else -%}
{%- if test_storages_compat_layer is true -%}
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=False) }}{%- endif -%}
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=True) }}{%- endif -%}
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=True) }}{%- endif -%}
{%- elif test_storages_compat_layer is false -%}
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=False) }}{%- endif -%}
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=False) }}{%- endif -%}
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=False) }}{%- endif -%}
{%- endif -%}
{%- endif -%}
2 changes: 0 additions & 2 deletions templates/github/.github/workflows/scripts/install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ 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 }}\
test_storages_compat_layer: {{ test_storages_compat_layer | tojson }}\
' vars/main.yaml

{%- if test_reroute %}
Expand All @@ -154,7 +153,6 @@ if [ "$TEST" = "azure" ]; then
sed -i -e '$a azure_test: true\
pulp_scenario_settings: {{ pulp_settings_azure | tojson }}\
pulp_scenario_env: {{ pulp_env_azure | tojson }}\
test_storages_compat_layer: {{ test_storages_compat_layer | tojson }}\
' vars/main.yaml
fi
{%- endif %}
Expand Down