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

Add flag to exercise django's STORAGES setting on CI #941

Merged
merged 3 commits into from
Jan 15, 2025
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
1 change: 1 addition & 0 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ DEFAULT_SETTINGS = {
"test_performance": False,
"test_reroute": True,
"test_s3": False,
"test_storages_compat_layer": False,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add s3 to that name

Copy link
Member Author

Choose a reason for hiding this comment

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

I would argue this is an implementation detail, but we can also be more concrete and put something like use_new_storages_on_s3 if you prefer.

"use_issue_template": True,
}

Expand Down
25 changes: 23 additions & 2 deletions templates/github/.ci/ansible/settings.py.j2.copy
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,39 @@ API_ROOT = {{ api_root | repr }}
{% endif %}

{% if s3_test | default(false) %}
MEDIA_ROOT: ""
S3_USE_SIGV4 = True
{% if test_storages_compat_layer is defined and test_storages_compat_layer %}
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",
},
}
{% else %}
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
MEDIA_ROOT = ""
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"
S3_USE_SIGV4 = True
AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_STORAGE_BUCKET_NAME = "pulp3"
AWS_S3_ENDPOINT_URL = "http://minio:9000"
AWS_DEFAULT_ACL = "@none None"
{% endif %}
{% endif %}

{% if azure_test | default(false) %}
DEFAULT_FILE_STORAGE = "storages.backends.azure_storage.AzureStorage"
Expand Down
1 change: 1 addition & 0 deletions templates/github/.github/workflows/scripts/install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ 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 Down
Loading