Skip to content

Commit 838957c

Browse files
committed
Update Azure and S3 storage settings for 2.16
Set storage settings in template_config.yml based on pulpcore requirement (>=3.28.15,<3.40). Storage formats: Azure (legacy), S3 (legacy) This addresses the recent change where plugin-template stopped automatically setting test scenario storage settings and now requires plugins to define them in their template_config.yml.
1 parent b93e842 commit 838957c

13 files changed

Lines changed: 107 additions & 87 deletions

File tree

.ci/ansible/Containerfile.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ FROM {{ ci_base | default(pulp_default_container) }}
55
ADD ./{{ item.name }} ./{{ item.name }}
66
{% endfor %}
77

8-
# Install python packages
9-
# S3 botocore needs to be patched to handle responses from minio during 0-byte uploads
10-
# Hacking botocore (https://github.com/boto/botocore/pull/1990)
8+
{% for item in extra_files | default([]) %}
9+
ADD ./{{ item.origin }} {{ item.destination }}
10+
{% endfor %}
1111

1212
# This MUST be the ONLY call to pip install in inside the container.
1313
RUN pip3 install --upgrade pip setuptools wheel && \

.ci/ansible/settings.py.j2

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,3 @@ 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 %}
33-
STORAGES = {
34-
"default": {
35-
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
36-
"OPTIONS": {
37-
"access_key": "{{ minio_access_key }}",
38-
"secret_key": "{{ minio_secret_key }}",
39-
"region_name": "eu-central-1",
40-
"addressing_style": "path",
41-
"signature_version": "s3v4",
42-
"bucket_name": "pulp3",
43-
"endpoint_url": "http://minio:9000",
44-
"default_acl": "@none None",
45-
},
46-
},
47-
"staticfiles": {
48-
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
49-
},
50-
}
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-
64-
{% if azure_test | default(false) %}
65-
DEFAULT_FILE_STORAGE = "storages.backends.azure_storage.AzureStorage"
66-
MEDIA_ROOT = ""
67-
AZURE_ACCOUNT_KEY = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
68-
AZURE_ACCOUNT_NAME = "devstoreaccount1"
69-
AZURE_CONTAINER = "pulp-test"
70-
AZURE_LOCATION = "pulp3"
71-
AZURE_OVERWRITE_FILES = True
72-
AZURE_URL_EXPIRATION_SECS = 120
73-
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;'
74-
{% endif %}
75-
76-
{% if gcp_test | default(false) %}
77-
DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
78-
MEDIA_ROOT = ""
79-
GS_BUCKET_NAME = "gcppulp"
80-
GS_CUSTOM_ENDPOINT = "http://ci-gcp:4443"
81-
{% endif %}

.ci/scripts/calc_constraints.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def to_upper_bound(req):
5353
if requirement.name == "pulpcore":
5454
# An exception to allow for pulpcore deprecation policy.
5555
return fetch_pulpcore_upper_bound(requirement)
56+
# skip requirement with environment scopes. E.g 'foo==1.0.0;python_version>=3.9'
57+
if requirement.marker:
58+
return f"# ENVIRONMENT IS UNTRACKABLE: {req}"
5659
for spec in requirement.specifier:
5760
if spec.operator == "~=":
5861
return f"# NO BETTER CONSTRAINT: {req}"

.ci/scripts/check_release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from git import Repo
1111

1212
RELEASE_BRANCH_REGEX = r"^([0-9]+)\.([0-9]+)$"
13-
Y_CHANGELOG_EXTS = [".feature", ".removal", ".deprecation"]
14-
Z_CHANGELOG_EXTS = [".bugfix", ".doc", ".misc"]
13+
Y_CHANGELOG_EXTS = [".feature"]
14+
Z_CHANGELOG_EXTS = [".bugfix", ".misc"]
1515

1616

1717
def options():

.ci/scripts/collect_changes.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
# For more info visit https://github.com/pulp/plugin_template
88

99
import itertools
10+
import json
1011
import os
1112
import re
1213
import tomllib
14+
import urllib.request
15+
from pathlib import Path
1316

1417
from git import GitCommandError, Repo
1518
from packaging.version import parse as parse_version
1619

20+
21+
PYPI_PROJECT = "pulp_container"
22+
1723
# Read Towncrier settings
18-
with open("pyproject.toml", "rb") as fp:
19-
tc_settings = tomllib.load(fp)["tool"]["towncrier"]
24+
tc_settings = tomllib.loads(Path("pyproject.toml").read_text())["tool"]["towncrier"]
2025

2126
CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst")
2227
START_STRING = tc_settings.get(
@@ -35,7 +40,7 @@
3540
# see help(re.split) for more info.
3641
NAME_REGEX = r".*"
3742
VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*"
38-
VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})"
43+
VERSION_CAPTURE_REGEX = rf"(?:YANKED )?({VERSION_REGEX})"
3944
DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}"
4045
TITLE_REGEX = (
4146
"("
@@ -75,6 +80,20 @@ def main():
7580
branches.sort(key=lambda ref: parse_version(ref.remote_head), reverse=True)
7681
branches = [ref.name for ref in branches]
7782

83+
changed = False
84+
85+
try:
86+
response = urllib.request.urlopen(f"https://pypi.org/pypi/{PYPI_PROJECT}/json")
87+
pypi_record = json.loads(response.read())
88+
yanked_versions = {
89+
parse_version(version): release[0]["yanked_reason"]
90+
for version, release in pypi_record["releases"].items()
91+
if release[0]["yanked"] is True
92+
}
93+
except Exception:
94+
# If something failed, just don't mark anything as yanked.
95+
yanked_versions = {}
96+
7897
with open(CHANGELOG_FILE, "r") as f:
7998
main_changelog = f.read()
8099
preamble, main_changes = split_changelog(main_changelog)
@@ -95,9 +114,19 @@ def main():
95114
if left[0] != right[0]:
96115
main_changes.append(right)
97116

117+
if yanked_versions:
118+
for change in main_changes:
119+
if change[0] in yanked_versions and "YANKED" not in change[1].split("\n")[0]:
120+
reason = yanked_versions[change[0]]
121+
version = str(change[0])
122+
change[1] = change[1].replace(version, "YANKED " + version, count=1)
123+
if reason:
124+
change[1] = change[1].replace("\n", f"\n\nYank reason: {reason}\n", count=1)
125+
changed = True
126+
98127
new_length = len(main_changes)
99-
if old_length < new_length:
100-
print(f"{new_length - old_length} new versions have been added.")
128+
if old_length < new_length or changed:
129+
print(f"{new_length - old_length} new versions have been added (or something has changed).")
101130
with open(CHANGELOG_FILE, "w") as fp:
102131
fp.write(preamble)
103132
for change in main_changes:

.github/workflows/create-branch.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222

23+
permissions:
24+
contents: write
25+
2326
steps:
2427
- uses: "actions/checkout@v4"
2528
with:

.github/workflows/docs.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# For more info visit https://github.com/pulp/plugin_template
77

88
---
9-
name: "Docs"
9+
name: "Docs CI"
1010
on:
1111
workflow_call:
1212

1313
jobs:
14-
test:
14+
changelog:
1515
if: "endsWith(github.base_ref, 'main')"
1616
runs-on: "ubuntu-latest"
1717
defaults:
@@ -22,28 +22,22 @@ jobs:
2222
with:
2323
fetch-depth: 1
2424
path: "pulp_container"
25-
- uses: "actions/checkout@v4"
26-
with:
27-
fetch-depth: 0
28-
repository: "pulp/pulp-docs"
29-
path: "pulp-docs"
30-
ref: "rewrite-as-mkdocs-plugin"
3125
- uses: "actions/setup-python@v5"
3226
with:
3327
python-version: "3.12"
3428
- name: "Install python dependencies"
3529
run: |
3630
echo ::group::PYDEPS
37-
pip install ../pulp-docs towncrier
31+
pip install towncrier
3832
echo ::endgroup::
3933
- name: "Build changelog"
4034
run: |
4135
towncrier build --yes --version 4.0.0.ci
42-
- name: "Build docs"
43-
working-directory: "pulp-docs"
44-
run: |
45-
pulp-docs fetch --dest ..
46-
pulp-docs build
36+
docs:
37+
if: "endsWith(github.base_ref, 'main')"
38+
uses: 'pulp/pulp-docs/.github/workflows/docs-ci.yml@rewrite-as-mkdocs-plugin'
39+
with:
40+
pulpdocs_ref: 'rewrite-as-mkdocs-plugin'
4741

4842
no-test:
4943
if: "!endsWith(github.base_ref, 'main')"

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
- uses: "actions/setup-python@v5"
4545
with:
46-
python-version: "3.11"
46+
python-version: "3.13"
4747

4848
- name: "Install python dependencies"
4949
run: |

.github/workflows/publish.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,36 @@ jobs:
146146
- "publish-python-bindings"
147147
- "publish-ruby-bindings"
148148

149+
permissions:
150+
contents: write
151+
152+
env:
153+
TAG_NAME: "${{ github.ref_name }}"
154+
149155
steps:
156+
- uses: "actions/checkout@v4"
157+
with:
158+
fetch-depth: 0
159+
path: "pulp_container"
160+
161+
- uses: "actions/setup-python@v5"
162+
with:
163+
python-version: "3.11"
164+
165+
- name: "Install towncrier"
166+
run: |
167+
pip install towncrier
168+
169+
- name: "Get release notes"
170+
id: get_release_notes
171+
run: |
172+
NOTES=$(towncrier build --draft --version $TAG_NAME)
173+
echo "body<<EOF" >> $GITHUB_OUTPUT
174+
echo "$NOTES" >> $GITHUB_OUTPUT
175+
echo "EOF" >> $GITHUB_OUTPUT
176+
150177
- name: "Create release on GitHub"
151178
uses: "actions/github-script@v7"
152-
env:
153-
TAG_NAME: "${{ github.ref_name }}"
154179
with:
155180
script: |
156181
const { TAG_NAME } = process.env;
@@ -159,5 +184,6 @@ jobs:
159184
owner: context.repo.owner,
160185
repo: context.repo.repo,
161186
tag_name: TAG_NAME,
187+
body: `${{ steps.get_release_notes.outputs.body }}`,
162188
make_latest: "legacy",
163189
});

.github/workflows/scripts/install.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ if [ "$TEST" = "s3" ]; then
9595
sed -i -e '$a s3_test: true\
9696
minio_access_key: "'$MINIO_ACCESS_KEY'"\
9797
minio_secret_key: "'$MINIO_SECRET_KEY'"\
98-
pulp_scenario_settings: {"flatpak_index": false}\
98+
pulp_scenario_settings: {"AWS_ACCESS_KEY_ID": "AKIAIT2Z5TDYPX3ARJBA", "AWS_DEFAULT_ACL": "@none None", "AWS_S3_ADDRESSING_STYLE": "path", "AWS_S3_ENDPOINT_URL": "http://minio:9000", "AWS_S3_REGION_NAME": "eu-central-1", "AWS_S3_SIGNATURE_VERSION": "s3v4", "AWS_SECRET_ACCESS_KEY": "fqRvjWaPU5o0fCqQuUWbj9Fainj2pVZtBCiDiieS", "AWS_STORAGE_BUCKET_NAME": "pulp3", "DEFAULT_FILE_STORAGE": "storages.backends.s3boto3.S3Boto3Storage", "MEDIA_ROOT": "", "flatpak_index": false}\
9999
pulp_scenario_env: {}\
100-
test_storages_compat_layer: false\
101100
' vars/main.yaml
102101
export PULP_API_ROOT="/rerouted/djnd/"
103102
fi
@@ -110,7 +109,7 @@ if [ "$TEST" = "azure" ]; then
110109
- ./azurite:/etc/pulp\
111110
command: "azurite-blob --blobHost 0.0.0.0"' vars/main.yaml
112111
sed -i -e '$a azure_test: true\
113-
pulp_scenario_settings: {"flatpak_index": true}\
112+
pulp_scenario_settings: {"AZURE_ACCOUNT_KEY": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==", "AZURE_ACCOUNT_NAME": "devstoreaccount1", "AZURE_CONNECTION_STRING": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;", "AZURE_CONTAINER": "pulp-test", "AZURE_LOCATION": "pulp3", "AZURE_OVERWRITE_FILES": true, "AZURE_URL_EXPIRATION_SECS": 120, "DEFAULT_FILE_STORAGE": "storages.backends.azure_storage.AzureStorage", "MEDIA_ROOT": "", "flatpak_index": true}\
114113
pulp_scenario_env: {}\
115114
' vars/main.yaml
116115
fi

0 commit comments

Comments
 (0)