Skip to content

Commit 5d93270

Browse files
committed
Update CI
1 parent a64273c commit 5d93270

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2026
-2279
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 21 deletions
This file was deleted.

.ci/ansible/Containerfile.j2

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,47 @@
1-
FROM {{ ci_base | default("ghcr.io/pulp/pulp-ci-centos:" + pulp_container_tag) }}
1+
FROM {{ ci_base | default(pulp_default_container) }}
22

33
# Add source directories to container
44
{% for item in plugins %}
5-
{% if item.source.startswith("./") or item.ci_requirements | default(false) %}
65
ADD ./{{ item.name }} ./{{ item.name }}
7-
{% endif %}
86
{% endfor %}
97

108
# Install python packages
9+
# S3 botocore needs to be patched to handle responses from minio during 0-byte uploads
1110
# Hacking botocore (https://github.com/boto/botocore/pull/1990)
1211

13-
RUN pip3 install
14-
{%- if stream_test | default(false) -%}
15-
{{ " " }}django-storages[sftp]
16-
{%- endif -%}
12+
# This MUST be the ONLY call to pip install in inside the container.
13+
RUN pip3 install --upgrade pip setuptools wheel && \
14+
rm -rf /root/.cache/pip && \
15+
pip3 install
1716
{%- if s3_test | default(false) -%}
18-
{{ " " }}django-storages[boto3] git+https://github.com/fabricio-aguiar/botocore.git@fix-100-continue
19-
{%- endif -%}
20-
{%- if azure_test | default(false) -%}
21-
{{ " " }}django-storages[azure]>=1.12.2
22-
{%- endif -%}
23-
{%- if gcp_test | default(false) -%}
24-
{{ " " }}django-storages[google]>=1.13.2
17+
{{ " " }}git+https://github.com/gerrod3/botocore.git@fix-100-continue
2518
{%- endif -%}
2619
{%- for item in plugins -%}
27-
{%- if item.name == "pulp-certguard" -%}
28-
{{ " " }}python-dateutil rhsm
29-
{%- endif -%}
3020
{{ " " }}{{ item.source }}
21+
{%- if item.upperbounds | default(false) -%}
22+
{{ " " }}-c ./{{ item.name }}/upperbounds_constraints.txt
23+
{%- endif -%}
24+
{%- if item.lowerbounds | default(false) -%}
25+
{{ " " }}-c ./{{ item.name }}/lowerbounds_constraints.txt
26+
{%- endif -%}
3127
{%- if item.ci_requirements | default(false) -%}
3228
{{ " " }}-r ./{{ item.name }}/ci_requirements.txt
3329
{%- endif -%}
3430
{%- endfor %}
31+
{{ " " }}-c ./{{ plugins[0].name }}/.ci/assets/ci_constraints.txt && \
32+
rm -rf /root/.cache/pip
33+
34+
{% if pulp_env is defined and pulp_env %}
35+
{% for key, value in pulp_env.items() %}
36+
ENV {{ key | upper }}={{ value }}
37+
{% endfor %}
38+
{% endif %}
39+
40+
{% if pulp_scenario_env is defined and pulp_scenario_env %}
41+
{% for key, value in pulp_scenario_env.items() %}
42+
ENV {{ key | upper }}={{ value }}
43+
{% endfor %}
44+
{% endif %}
3545

3646
USER pulp:pulp
3747
RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \

.ci/ansible/settings.py.j2

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,40 @@ API_ROOT = {{ api_root | repr }}
2626
{% endfor %}
2727
{% endif %}
2828

29-
{% if stream_test | default(false) -%}
30-
REDIRECT_TO_OBJECT_STORAGE = False
31-
DEFAULT_FILE_STORAGE = "pulpcore.app.models.storage.PulpSFTPStorage"
32-
MEDIA_ROOT = ""
33-
SFTP_STORAGE_HOST = "ci-sftp"
34-
SFTP_STORAGE_ROOT = "/storage/"
35-
SFTP_STORAGE_PARAMS = {
36-
"username": "foo",
37-
"key_filename": "/keys/id_ed25519",
38-
}
39-
{%- endif %}
40-
4129
{% 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 %}
4252
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
43-
MEDIA_ROOT = ""
4453
AWS_ACCESS_KEY_ID = "{{ minio_access_key }}"
4554
AWS_SECRET_ACCESS_KEY = "{{ minio_secret_key }}"
4655
AWS_S3_REGION_NAME = "eu-central-1"
4756
AWS_S3_ADDRESSING_STYLE = "path"
48-
S3_USE_SIGV4 = True
4957
AWS_S3_SIGNATURE_VERSION = "s3v4"
5058
AWS_STORAGE_BUCKET_NAME = "pulp3"
5159
AWS_S3_ENDPOINT_URL = "http://minio:9000"
5260
AWS_DEFAULT_ACL = "@none None"
5361
{% endif %}
62+
{% endif %}
5463

5564
{% if azure_test | default(false) %}
5665
DEFAULT_FILE_STORAGE = "storages.backends.azure_storage.AzureStorage"
@@ -61,7 +70,7 @@ AZURE_CONTAINER = "pulp-test"
6170
AZURE_LOCATION = "pulp3"
6271
AZURE_OVERWRITE_FILES = True
6372
AZURE_URL_EXPIRATION_SECS = 120
64-
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol={{ pulp_scheme }};AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint={{ pulp_scheme }}://ci-azurite:10000/devstoreaccount1;'
73+
AZURE_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;'
6574
{% endif %}
6675

6776
{% if gcp_test | default(false) %}

.ci/ansible/start_container.yaml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515
- ssh
1616
- ~/.config/pulp_smash
1717

18-
- name: Generate an OpenSSH keypair
19-
community.crypto.openssh_keypair:
20-
path: ssh/id_ed25519
21-
type: ed25519
22-
owner: 700 # pulp in the container
23-
become: true
24-
when: stream_test | default(false)
25-
2618
- name: "Generate Pulp Settings"
2719
template:
2820
src: settings.py.j2
@@ -91,22 +83,14 @@
9183
command: "docker logs pulp"
9284
failed_when: true
9385

94-
- block:
95-
- name: "Check version of component being tested"
96-
assert:
97-
that:
98-
- (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver)
99-
fail_msg: |
100-
Component {{ component_name }} was expected to be installed in version {{ component_version }}.
101-
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}.
102-
rescue:
103-
- name: "Check version of component being tested (legacy)"
104-
assert:
105-
that:
106-
- (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] | canonical_semver == (component_version | canonical_semver)
107-
fail_msg: |
108-
Component {{ legacy_component_name }} was expected to be installed in version {{ component_version }}.
109-
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] }}.
86+
- name: "Check version of component being tested"
87+
assert:
88+
that:
89+
- (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver)
90+
fail_msg: |
91+
Component {{ item.app_label }} was expected to be installed in version {{ component_version }}.
92+
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}.
93+
loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}"
11094

11195
- name: "Set pulp password in .netrc"
11296
copy:

.ci/assets/ci_constraints.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Pulpcore versions without the openapi command do no longer work in the CI
2+
pulpcore>=3.21.30,!=3.23.*,!=3.24.*,!=3.25.*,!=3.26.*,!=3.27.*,!=3.29.*,!=3.30.*,!=3.31.*,!=3.32.*,!=3.33.*,!=3.34.*,!=3.35.*,!=3.36.*,!=3.37.*,!=3.38.*,!=3.40.*,!=3.41.*,!=3.42.*,!=3.43.*,!=3.44.*,!=3.45.*,!=3.46.*,!=3.47.*,!=3.48.*,!=3.50.*,!=3.51.*,!=3.52.*,!=3.53.*,!=3.54.*
3+
4+
5+
tablib!=3.6.0
6+
# 3.6.0: This release introduced a regression removing the "html" optional dependency.
7+
8+
9+
multidict!=6.3.0
10+
# This release failed the lower bounds test for some case sensitivity in CIMultiDict.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
bump2version
1+
bump-my-version
22
gitpython
33
towncrier

.ci/scripts/calc_constraints.py

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# WARNING: DO NOT EDIT!
2+
#
3+
# This file was generated by plugin_template, and is managed by it. Please use
4+
# './plugin-template --github pulp_python' to update this file.
5+
#
6+
# For more info visit https://github.com/pulp/plugin_template
7+
8+
import argparse
9+
import fileinput
10+
import urllib.request
11+
import sys
12+
from packaging.requirements import Requirement
13+
from packaging.version import Version
14+
import yaml
15+
16+
try:
17+
import tomllib
18+
except ImportError:
19+
import tomli as tomllib
20+
21+
22+
CORE_TEMPLATE_URL = "https://raw.githubusercontent.com/pulp/pulpcore/main/template_config.yml"
23+
24+
25+
def fetch_pulpcore_upper_bound(requirement):
26+
with urllib.request.urlopen(CORE_TEMPLATE_URL) as f:
27+
template = yaml.safe_load(f.read())
28+
supported_versions = template["supported_release_branches"]
29+
supported_versions.append(template["latest_release_branch"])
30+
applicable_versions = sorted(
31+
requirement.specifier.filter((Version(v) for v in supported_versions))
32+
)
33+
if len(applicable_versions) == 0:
34+
raise Exception("No supported pulpcore version in required range.")
35+
return f"{requirement.name}~={applicable_versions[-1]}"
36+
37+
38+
def split_comment(line):
39+
split_line = line.split("#", maxsplit=1)
40+
try:
41+
comment = " # " + split_line[1].strip()
42+
except IndexError:
43+
comment = ""
44+
return split_line[0].strip(), comment
45+
46+
47+
def to_upper_bound(req):
48+
try:
49+
requirement = Requirement(req)
50+
except ValueError:
51+
return f"# UNPARSABLE: {req}"
52+
else:
53+
if requirement.name == "pulpcore":
54+
# An exception to allow for pulpcore deprecation policy.
55+
return fetch_pulpcore_upper_bound(requirement)
56+
for spec in requirement.specifier:
57+
if spec.operator == "~=":
58+
return f"# NO BETTER CONSTRAINT: {req}"
59+
if spec.operator == "<=":
60+
operator = "=="
61+
max_version = spec.version
62+
return f"{requirement.name}{operator}{max_version}"
63+
if spec.operator == "<":
64+
operator = "~="
65+
version = Version(spec.version)
66+
if version.micro != 0:
67+
max_version = f"{version.major}.{version.minor}.{version.micro - 1}"
68+
elif version.minor != 0:
69+
max_version = f"{version.major}.{version.minor - 1}"
70+
elif version.major != 0:
71+
max_version = f"{version.major - 1}.0"
72+
else:
73+
return f"# NO BETTER CONSTRAINT: {req}"
74+
return f"{requirement.name}{operator}{max_version}"
75+
return f"# NO UPPER BOUND: {req}"
76+
77+
78+
def to_lower_bound(req):
79+
try:
80+
requirement = Requirement(req)
81+
except ValueError:
82+
return f"# UNPARSABLE: {req}"
83+
else:
84+
for spec in requirement.specifier:
85+
if spec.operator == ">=":
86+
min_version = spec.version
87+
if requirement.name == "pulpcore":
88+
# Currently an exception to allow for pulpcore bugfix releases.
89+
# TODO Semver libraries should be allowed too.
90+
operator = "~="
91+
if len(Version(min_version).release) != 3:
92+
raise RuntimeError("Pulpcore lower bound must be in the form '>=x.y.z'.")
93+
else:
94+
operator = "=="
95+
return f"{requirement.name}{operator}{min_version}"
96+
return f"# NO LOWER BOUND: {req}"
97+
98+
99+
def main():
100+
"""Calculate constraints for the lower bound of dependencies where possible."""
101+
parser = argparse.ArgumentParser(
102+
prog=sys.argv[0],
103+
description="Calculate constraints for the lower or upper bound of dependencies where "
104+
"possible.",
105+
)
106+
parser.add_argument("-u", "--upper", action="store_true")
107+
parser.add_argument("filename", nargs="*")
108+
args = parser.parse_args()
109+
110+
modifier = to_upper_bound if args.upper else to_lower_bound
111+
112+
req_files = [filename for filename in args.filename if not filename.endswith("pyproject.toml")]
113+
pyp_files = [filename for filename in args.filename if filename.endswith("pyproject.toml")]
114+
if req_files:
115+
with fileinput.input(files=req_files) as req_file:
116+
for line in req_file:
117+
if line.strip().startswith("#"):
118+
# Shortcut comment only lines
119+
print(line.strip())
120+
else:
121+
req, comment = split_comment(line)
122+
new_req = modifier(req)
123+
print(new_req + comment)
124+
for filename in pyp_files:
125+
with open(filename, "rb") as fp:
126+
pyproject = tomllib.load(fp)
127+
for req in pyproject["project"]["dependencies"]:
128+
new_req = modifier(req)
129+
print(new_req)
130+
optional_dependencies = pyproject["project"].get("optional-dependencies")
131+
if optional_dependencies:
132+
for opt in optional_dependencies.values():
133+
for req in opt:
134+
new_req = modifier(req)
135+
print(new_req)
136+
137+
138+
if __name__ == "__main__":
139+
main()

.ci/scripts/calc_deps_lowerbounds.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)