Skip to content

Commit 66a5991

Browse files
authored
Merge pull request #699 from pulp/update-ci/3.11
Update CI files for branch 3.11
2 parents e904a64 + eb59b35 commit 66a5991

28 files changed

+340
-1211
lines changed

.ci/ansible/Containerfile.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ RUN pip3 install
1515
{%- endif -%}
1616
{%- for item in plugins -%}
1717
{{ " " }}{{ item.source }}
18+
{%- if item.upperbounds | default(false) -%}
19+
{{ " " }}-c ./{{ item.name }}/upperbounds_constraints.txt
20+
{%- endif -%}
1821
{%- if item.lowerbounds | default(false) -%}
1922
{{ " " }}-c ./{{ item.name }}/lowerbounds_constraints.txt
2023
{%- endif -%}
2124
{%- if item.ci_requirements | default(false) -%}
2225
{{ " " }}-r ./{{ item.name }}/ci_requirements.txt
2326
{%- endif -%}
2427
{%- endfor %}
28+
{{ " " }}-c ./{{ plugins[0].name }}/.ci/assets/ci_constraints.txt
2529

2630
{% if pulp_env is defined and pulp_env %}
2731
{% for key, value in pulp_env.items() %}

.ci/assets/ci_constraints.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
6+
tablib!=3.6.0
7+
# 3.6.0: This release introduced a regression removing the "html" optional dependency.

.ci/scripts/calc_constraints.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
17+
CORE_TEMPLATE_URL = "https://raw.githubusercontent.com/pulp/pulpcore/main/template_config.yml"
18+
19+
20+
def fetch_pulpcore_upper_bound(requirement):
21+
with urllib.request.urlopen(CORE_TEMPLATE_URL) as f:
22+
template = yaml.safe_load(f.read())
23+
supported_versions = template["supported_release_branches"]
24+
supported_versions.append(template["latest_release_branch"])
25+
applicable_versions = sorted(
26+
requirement.specifier.filter((Version(v) for v in supported_versions))
27+
)
28+
if len(applicable_versions) == 0:
29+
raise Exception("No supported pulpcore version in required range.")
30+
return f"{requirement.name}~={applicable_versions[-1]}"
31+
32+
33+
def split_comment(line):
34+
split_line = line.split("#", maxsplit=1)
35+
try:
36+
comment = " # " + split_line[1].strip()
37+
except IndexError:
38+
comment = ""
39+
return split_line[0].strip(), comment
40+
41+
42+
def to_upper_bound(req):
43+
try:
44+
requirement = Requirement(req)
45+
except ValueError:
46+
return f"# UNPARSABLE: {req}"
47+
else:
48+
if requirement.name == "pulpcore":
49+
# An exception to allow for pulpcore deprecation policy.
50+
return fetch_pulpcore_upper_bound(requirement)
51+
for spec in requirement.specifier:
52+
if spec.operator == "~=":
53+
return f"# NO BETTER CONSTRAINT: {req}"
54+
if spec.operator == "<=":
55+
operator = "=="
56+
max_version = spec.version
57+
return f"{requirement.name}{operator}{max_version}"
58+
if spec.operator == "<":
59+
operator = "~="
60+
version = Version(spec.version)
61+
if version.micro != 0:
62+
max_version = f"{version.major}.{version.minor}.{version.micro-1}"
63+
elif version.minor != 0:
64+
max_version = f"{version.major}.{version.minor-1}"
65+
else:
66+
return f"# NO BETTER CONSTRAINT: {req}"
67+
return f"{requirement.name}{operator}{max_version}"
68+
return f"# NO UPPER BOUND: {req}"
69+
70+
71+
def to_lower_bound(req):
72+
try:
73+
requirement = Requirement(req)
74+
except ValueError:
75+
return f"# UNPARSABLE: {req}"
76+
else:
77+
for spec in requirement.specifier:
78+
if spec.operator == ">=":
79+
if requirement.name == "pulpcore":
80+
# Currently an exception to allow for pulpcore bugfix releases.
81+
# TODO Semver libraries should be allowed too.
82+
operator = "~="
83+
else:
84+
operator = "=="
85+
min_version = spec.version
86+
return f"{requirement.name}{operator}{min_version}"
87+
return f"# NO LOWER BOUND: {req}"
88+
89+
90+
def main():
91+
"""Calculate constraints for the lower bound of dependencies where possible."""
92+
parser = argparse.ArgumentParser(
93+
prog=sys.argv[0],
94+
description="Calculate constraints for the lower or upper bound of dependencies where "
95+
"possible.",
96+
)
97+
parser.add_argument("-u", "--upper", action="store_true")
98+
parser.add_argument("filename", nargs="*")
99+
args = parser.parse_args()
100+
101+
with fileinput.input(files=args.filename) as req_file:
102+
for line in req_file:
103+
if line.strip().startswith("#"):
104+
# Shortcut comment only lines
105+
print(line.strip())
106+
else:
107+
req, comment = split_comment(line)
108+
if args.upper:
109+
new_req = to_upper_bound(req)
110+
else:
111+
new_req = to_lower_bound(req)
112+
print(new_req + comment)
113+
114+
115+
if __name__ == "__main__":
116+
main()

.ci/scripts/calc_deps_lowerbounds.py

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

.ci/scripts/changelog.py

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

.ci/scripts/tweet.py

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

.ci/scripts/update_ci_branches.py

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

.github/template_gitref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021.08.26-339-gf0d923e
1+
2021.08.26-354-g82d22de

.github/workflows/build.yml

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,30 @@ jobs:
2323
with:
2424
fetch-depth: 1
2525
path: "pulp_python"
26+
- uses: "actions/checkout@v4"
27+
with:
28+
fetch-depth: 1
29+
repository: "pulp/pulp-openapi-generator"
30+
path: "pulp-openapi-generator"
2631
- uses: "actions/setup-python@v5"
2732
with:
2833
python-version: "3.11"
2934
- name: "Install python dependencies"
3035
run: |
3136
echo ::group::PYDEPS
32-
pip install packaging twine wheel
37+
pip install packaging twine wheel mkdocs jq
3338
echo ::endgroup::
3439
- name: "Build package"
3540
run: |
3641
python3 setup.py sdist bdist_wheel --python-tag py3
3742
twine check dist/*
43+
- name: "Install built packages"
44+
run: |
45+
pip install dist/pulp_python-*-py3-none-any.whl -c .ci/assets/ci_constraints.txt
46+
- name: "Generate api specs"
47+
run: |
48+
pulpcore-manager openapi --file "api.json"
49+
pulpcore-manager openapi --bindings --component "python" --file "python-api.json"
3850
- name: "Upload Package whl"
3951
uses: "actions/upload-artifact@v4"
4052
with:
@@ -43,3 +55,59 @@ jobs:
4355
if-no-files-found: "error"
4456
retention-days: 5
4557
overwrite: true
58+
- name: "Upload API specs"
59+
uses: "actions/upload-artifact@v4"
60+
with:
61+
name: "api_spec"
62+
path: |
63+
pulp_python/api.json
64+
pulp_python/python-api.json
65+
if-no-files-found: "error"
66+
retention-days: 5
67+
overwrite: true
68+
- name: "Build Python bindings packages"
69+
run: |
70+
.github/workflows/scripts/build_python_client.sh
71+
shell: "bash"
72+
env:
73+
PY_COLORS: "1"
74+
ANSIBLE_FORCE_COLOR: "1"
75+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
76+
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
77+
- name: "Upload python client packages"
78+
uses: "actions/upload-artifact@v4"
79+
with:
80+
name: "python-client.tar"
81+
path: |
82+
pulp_python/python-python-client.tar
83+
if-no-files-found: "error"
84+
retention-days: 5
85+
overwrite: true
86+
- name: "Upload python client docs"
87+
uses: "actions/upload-artifact@v4"
88+
with:
89+
name: "python-client-docs.tar"
90+
path: |
91+
pulp_python/python-python-client-docs.tar
92+
if-no-files-found: "error"
93+
retention-days: 5
94+
overwrite: true
95+
- name: "Build Ruby bindings packages"
96+
run: |
97+
.github/workflows/scripts/build_ruby_client.sh
98+
shell: "bash"
99+
env:
100+
PY_COLORS: "1"
101+
ANSIBLE_FORCE_COLOR: "1"
102+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
103+
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
104+
- name: "Upload Ruby client"
105+
uses: "actions/upload-artifact@v4"
106+
with:
107+
name: "ruby-client.tar"
108+
path: |
109+
pulp_python/python-ruby-client.tar
110+
if-no-files-found: "error"
111+
retention-days: 5
112+
overwrite: true
113+
...

0 commit comments

Comments
 (0)