Skip to content

Commit a3196b0

Browse files
gerrod3ggainey
authored andcommitted
Bump pulpcore upperbound to <3.100
1 parent 4de2a01 commit a3196b0

File tree

8 files changed

+111
-31
lines changed

8 files changed

+111
-31
lines changed

.ci/ansible/settings.py.j2

Lines changed: 92 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,22 @@ API_ROOT = {{ api_root | repr }}
2626
{% endfor %}
2727
{% endif %}
2828

29-
{% if s3_test | default(false) %}
30-
MEDIA_ROOT: ""
31-
S3_USE_SIGV4 = True
32-
{% if test_storages_compat_layer is defined and test_storages_compat_layer %}
29+
{# =======================================
30+
Macros for legacy and new storage settings
31+
========================================== -#}
32+
33+
{%- macro s3_settings(legacy) -%}
34+
{%- if legacy %}
35+
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
36+
AWS_ACCESS_KEY_ID = "{{ minio_access_key }}"
37+
AWS_SECRET_ACCESS_KEY = "{{ minio_secret_key }}"
38+
AWS_S3_REGION_NAME = "eu-central-1"
39+
AWS_S3_ADDRESSING_STYLE = "path"
40+
AWS_S3_SIGNATURE_VERSION = "s3v4"
41+
AWS_STORAGE_BUCKET_NAME = "pulp3"
42+
AWS_S3_ENDPOINT_URL = "http://minio:9000"
43+
AWS_DEFAULT_ACL = "@none None"
44+
{%- else %}
3345
STORAGES = {
3446
"default": {
3547
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
@@ -48,34 +60,93 @@ STORAGES = {
4860
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
4961
},
5062
}
51-
{% else %}
52-
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
53-
AWS_ACCESS_KEY_ID = "{{ minio_access_key }}"
54-
AWS_SECRET_ACCESS_KEY = "{{ minio_secret_key }}"
55-
AWS_S3_REGION_NAME = "eu-central-1"
56-
AWS_S3_ADDRESSING_STYLE = "path"
57-
AWS_S3_SIGNATURE_VERSION = "s3v4"
58-
AWS_STORAGE_BUCKET_NAME = "pulp3"
59-
AWS_S3_ENDPOINT_URL = "http://minio:9000"
60-
AWS_DEFAULT_ACL = "@none None"
61-
{% endif %}
62-
{% endif %}
63+
{%- endif %}
64+
{%- endmacro -%}
6365

64-
{% if azure_test | default(false) %}
66+
{%- macro azure_settings(legacy) -%}
67+
{%- if legacy %}
6568
DEFAULT_FILE_STORAGE = "storages.backends.azure_storage.AzureStorage"
66-
MEDIA_ROOT = ""
6769
AZURE_ACCOUNT_KEY = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
6870
AZURE_ACCOUNT_NAME = "devstoreaccount1"
6971
AZURE_CONTAINER = "pulp-test"
7072
AZURE_LOCATION = "pulp3"
7173
AZURE_OVERWRITE_FILES = True
7274
AZURE_URL_EXPIRATION_SECS = 120
7375
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;'
74-
{% endif %}
76+
{%- else %}
77+
STORAGES = {
78+
"default": {
79+
"BACKEND": "storages.backends.azure_storage.AzureStorage",
80+
"OPTIONS": {
81+
"account_key": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==",
82+
"account_name": "devstoreaccount1",
83+
"location": "pulp3",
84+
"azure_container": "pulp-test",
85+
"overwrite_files": True,
86+
"expiration_secs": 120,
87+
"connection_string": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;",
88+
},
89+
},
90+
"staticfiles": {
91+
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
92+
},
93+
}
94+
{%- endif %}
95+
{%- endmacro -%}
7596

76-
{% if gcp_test | default(false) %}
97+
{%- macro gcp_settings(legacy) -%}
98+
{%- if legacy %}
7799
DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
78-
MEDIA_ROOT = ""
79100
GS_BUCKET_NAME = "gcppulp"
80101
GS_CUSTOM_ENDPOINT = "http://ci-gcp:4443"
102+
{%- else %}
103+
STORAGES = {
104+
"default": {
105+
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
106+
"OPTIONS": {
107+
"bucket_name": "gcppulp",
108+
"custom_endpoint": "http://ci-gcp:4443",
109+
},
110+
},
111+
"staticfiles": {
112+
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
113+
},
114+
}
115+
{%- endif %}
116+
{%- endmacro -%}
117+
118+
{#- ==========================================
119+
Render according to test_storages_compat_layer
120+
==============================================
121+
122+
Case 1) test_storages_compat_layer is unset
123+
- All storages render the legacy setting
124+
- Branches using pulpcore <3.70 must leave this key unset (use legacy)
125+
126+
Case 2) test_storages_compat_layer is True
127+
- To tests both work, only one setting uses the new storage setting
128+
- Branches using pulpcore >=3.70,<3.85 must set this key to True (test both)
129+
130+
Case 3) test_storages_compat_layer is False
131+
- All storages render the new setting
132+
- Branches using pulpcore >=3.85 must set this key to False (use new)
133+
-#}
134+
135+
{% if s3_test | default(false) or azure_test | default(false) or gcp_test | default(false)%}
136+
MEDIA_ROOT=""
81137
{% endif %}
138+
{%- if test_storages_compat_layer is not defined -%}
139+
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=True) }}{%- endif -%}
140+
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=True) }}{%- endif -%}
141+
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=True) }}{%- endif -%}
142+
{%- else -%}
143+
{%- if test_storages_compat_layer is true -%}
144+
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=False) }}{%- endif -%}
145+
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=True) }}{%- endif -%}
146+
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=True) }}{%- endif -%}
147+
{%- elif test_storages_compat_layer is false -%}
148+
{%- if s3_test | default(false) -%}{{ s3_settings(legacy=False) }}{%- endif -%}
149+
{%- if azure_test | default(false) -%}{{ azure_settings(legacy=False) }}{%- endif -%}
150+
{%- if gcp_test | default(false) -%}{{ gcp_settings(legacy=False) }}{%- endif -%}
151+
{%- endif -%}
152+
{%- endif -%}

.github/workflows/scripts/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ minio_access_key: "'$MINIO_ACCESS_KEY'"\
9797
minio_secret_key: "'$MINIO_SECRET_KEY'"\
9898
pulp_scenario_settings: {"domain_enabled": true, "flatpak_index": false, "token_auth_disabled": true}\
9999
pulp_scenario_env: {}\
100-
test_storages_compat_layer: true\
100+
test_storages_compat_layer: false\
101101
' vars/main.yaml
102102
export PULP_API_ROOT="/rerouted/djnd/"
103103
fi
@@ -112,6 +112,7 @@ if [ "$TEST" = "azure" ]; then
112112
sed -i -e '$a azure_test: true\
113113
pulp_scenario_settings: {"content_origin": null, "domain_enabled": true, "flatpak_index": true}\
114114
pulp_scenario_env: {}\
115+
test_storages_compat_layer: false\
115116
' vars/main.yaml
116117
fi
117118

CHANGES/+3.85-compat.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump pulpcore upperbound to <3.100. pulp_container is now a Python >=3.11 project.

pulp_container/app/registry_api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from pulpcore.plugin.models import Artifact, ContentArtifact, UploadChunk
3030
from pulpcore.plugin.files import PulpTemporaryUploadedFile
31-
from pulpcore.plugin.tasking import add_and_remove, dispatch
31+
from pulpcore.plugin.tasking import dispatch
3232
from pulpcore.plugin.util import get_objects_for_user, get_url, get_domain
3333
from pulpcore.plugin.exceptions import TimeoutException
3434

@@ -74,6 +74,7 @@
7474
S3StorageRedirects,
7575
AzureStorageRedirects,
7676
)
77+
from pulp_container.app.tasks import aadd_and_remove
7778
from pulp_container.app.token_verification import (
7879
RegistryAuthentication,
7980
TokenAuthentication,
@@ -1137,7 +1138,7 @@ def handle_safe_method(self, request, path, pk):
11371138
add_content_units = self.get_content_units_to_add(manifest, tag)
11381139

11391140
dispatch(
1140-
add_and_remove,
1141+
aadd_and_remove,
11411142
exclusive_resources=[repository],
11421143
kwargs={
11431144
"repository_pk": str(repository.pk),
@@ -1393,7 +1394,7 @@ def put(self, request, path, pk=None):
13931394
remove_content_units = [str(pk) for pk in tags_to_remove.values_list("pk")]
13941395

13951396
immediate_task = dispatch(
1396-
add_and_remove,
1397+
aadd_and_remove,
13971398
exclusive_resources=[repository],
13981399
kwargs={
13991400
"repository_pk": str(repository.pk),
@@ -1563,7 +1564,7 @@ def put(self, request, path, pk):
15631564
signature.touch()
15641565

15651566
immediate_task = dispatch(
1566-
add_and_remove,
1567+
aadd_and_remove,
15671568
exclusive_resources=[repository],
15681569
kwargs={
15691570
"repository_pk": str(repository.pk),

pulp_container/app/tasks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .download_image_data import download_image_data # noqa
1+
from .download_image_data import aadd_and_remove, download_image_data # noqa
22
from .builder import build_image_from_containerfile, build_image # noqa
33
from .recursive_add import recursive_add_content # noqa
44
from .recursive_remove import recursive_remove_content # noqa

pulp_container/app/tasks/download_image_data.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import json
22
import logging
33

4+
from asgiref.sync import sync_to_async
5+
46
from pulpcore.plugin.stages import DeclarativeContent
7+
from pulpcore.plugin.tasking import add_and_remove
58

69
from pulp_container.app.models import ContainerRemote, ContainerRepository, Tag
710
from pulp_container.app.utils import determine_media_type_from_json
@@ -13,6 +16,10 @@
1316
log = logging.getLogger(__name__)
1417

1518

19+
async def aadd_and_remove(*args, **kwargs):
20+
return await sync_to_async(add_and_remove)(*args, **kwargs)
21+
22+
1623
def download_image_data(repository_pk, remote_pk, raw_text_manifest_data, tag_name):
1724
repository = ContainerRepository.objects.get(pk=repository_pk)
1825
remote = ContainerRemote.objects.get(pk=remote_pk)

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ classifiers=[
2020
"Framework :: Django",
2121
"Programming Language :: Python",
2222
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.9",
2423
]
25-
requires-python = ">=3.9"
24+
requires-python = ">=3.11"
2625
dependencies = [
2726
"jsonschema>=4.4,<4.25",
28-
"pulpcore>=3.73.2,<3.85",
27+
"pulpcore>=3.73.2,<3.100",
2928
"pyjwt[crypto]>=2.4,<2.11",
3029
]
3130

template_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ test_lowerbounds: true
8484
test_performance: false
8585
test_reroute: true
8686
test_s3: true
87-
test_storages_compat_layer: true
87+
test_storages_compat_layer: false
8888
use_issue_template: true
8989

0 commit comments

Comments
 (0)