Skip to content

Commit f0657da

Browse files
committed
Update CI files
1 parent b8528d3 commit f0657da

32 files changed

+565
-552
lines changed

.ci/ansible/Containerfile.j2

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
FROM {{ ci_base | default(pulp_default_container) }}
1+
FROM {{ image.ci_base }}
2+
{%- if image.webserver_snippet %}
23

3-
# Add source directories to container
4-
{% for item in plugins %}
5-
ADD ./{{ item.name }} ./{{ item.name }}
6-
{% endfor %}
4+
ADD ./{{ plugin_name }}/{{ plugin_name | replace("-", "_") }}/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ plugin_name }}.conf
5+
{%- endif %}
6+
7+
{%- for item in extra_files | default([]) %}
78

8-
{% for item in extra_files | default([]) %}
99
ADD ./{{ item.origin }} {{ item.destination }}
10-
{% endfor %}
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 && \
1414
rm -rf /root/.cache/pip && \
15-
pip3 install
16-
{%- if s3_test | default(false) -%}
17-
{{ " " }}git+https://github.com/gerrod3/botocore.git@fix-100-continue
18-
{%- endif -%}
19-
{%- for item in plugins -%}
20-
{{ " " }}{{ item.source }}
21-
{%- if item.upperbounds | default(false) -%}
22-
{{ " " }}-c ./{{ item.name }}/upperbounds_constraints.txt
15+
pip3 install {{ image.source }}
16+
{%- if image.upperbounds | default(false) -%}
17+
{{ " " }}-c ./{{ plugin_name }}/upperbounds_constraints.txt
2318
{%- endif -%}
24-
{%- if item.lowerbounds | default(false) -%}
25-
{{ " " }}-c ./{{ item.name }}/lowerbounds_constraints.txt
19+
{%- if image.lowerbounds | default(false) -%}
20+
{{ " " }}-c ./{{ plugin_name }}/lowerbounds_constraints.txt
2621
{%- endif -%}
27-
{%- if item.ci_requirements | default(false) -%}
28-
{{ " " }}-r ./{{ item.name }}/ci_requirements.txt
22+
{%- if image.ci_requirements | default(false) -%}
23+
{{ " " }}-r ./{{ plugin_name }}/ci_requirements.txt
2924
{%- endif -%}
30-
{%- endfor %}
31-
{{ " " }}-c ./{{ plugins[0].name }}/.ci/assets/ci_constraints.txt && \
25+
{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt && \
3226
rm -rf /root/.cache/pip
3327

3428
{% if pulp_env is defined and pulp_env %}
@@ -46,11 +40,8 @@ ENV {{ key | upper }}={{ value }}
4640
USER pulp:pulp
4741
RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \
4842
/usr/local/bin/pulpcore-manager collectstatic --clear --noinput --link
49-
USER root:root
5043

51-
{% for item in plugins %}
52-
RUN export plugin_path="$(pip3 show {{ item.name }} | sed -n -e 's/Location: //p')/{{ item.name }}" && \
53-
ln $plugin_path/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ item.name }}.conf || true
54-
{% endfor %}
44+
RUN mkdir /var/lib/pulp/.config
45+
USER root:root
5546

5647
ENTRYPOINT ["/init"]

.ci/ansible/build_container.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Ansible playbook to create the pulp service containers image
22
---
3-
- hosts: localhost
3+
- hosts: "localhost"
44
gather_facts: false
55
vars_files:
6-
- vars/main.yaml
6+
- "vars/main.yaml"
77
tasks:
88
- name: "Generate Containerfile from template"
9-
template:
10-
src: Containerfile.j2
11-
dest: Containerfile
12-
9+
ansible.builtin.template:
10+
src: "Containerfile.j2"
11+
dest: "Containerfile"
1312
- name: "Build pulp image"
1413
# We build from the ../.. (parent dir of pulpcore git repo) Docker build
1514
# "context" so that repos like pulp-smash are accessible to Docker

.ci/ansible/start_container.yaml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
# Ansible playbook to start the pulp service container and its supporting services
22
---
3-
- hosts: localhost
3+
- hosts: "localhost"
44
gather_facts: false
55
vars_files:
6-
- vars/main.yaml
6+
- "vars/main.yaml"
77
tasks:
88
- name: "Create Settings Directories"
9-
file:
9+
ansible.builtin.file:
1010
path: "{{ item }}"
11-
state: directory
11+
state: "directory"
1212
mode: "0755"
1313
loop:
14-
- settings
15-
- ssh
16-
- ~/.config/pulp_smash
14+
- "settings"
1715

1816
- name: "Generate Pulp Settings"
1917
template:
20-
src: settings.py.j2
21-
dest: settings/settings.py
22-
23-
- name: "Configure pulp-smash"
24-
copy:
25-
src: smash-config.json
26-
dest: ~/.config/pulp_smash/settings.json
18+
src: "settings.py.j2"
19+
dest: "settings/settings.py"
2720

2821
- name: "Setup docker networking"
2922
docker_network:
30-
name: pulp_ci_bridge
23+
name: "pulp_ci_bridge"
3124

3225
- name: "Start Service Containers"
3326
docker_container:
@@ -37,24 +30,24 @@
3730
recreate: true
3831
privileged: true
3932
networks:
40-
- name: pulp_ci_bridge
33+
- name: "pulp_ci_bridge"
4134
aliases: "{{ item.name }}"
4235
volumes: "{{ item.volumes | default(omit) }}"
4336
env: "{{ item.env | default(omit) }}"
4437
command: "{{ item.command | default(omit) }}"
45-
state: started
38+
state: "started"
4639
loop: "{{ services | default([]) }}"
4740

4841
- name: "Retrieve Docker Network Info"
4942
docker_network_info:
50-
name: pulp_ci_bridge
51-
register: pulp_ci_bridge_info
43+
name: "pulp_ci_bridge"
44+
register: "pulp_ci_bridge_info"
5245

5346
- name: "Update /etc/hosts"
5447
lineinfile:
55-
path: /etc/hosts
48+
path: "/etc/hosts"
5649
regexp: "\\s{{ item.value.Name }}\\s*$"
57-
line: "{{ item.value.IPv4Address | ipaddr('address') }}\t{{ item.value.Name }}"
50+
line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}"
5851
loop: "{{ pulp_ci_bridge_info.network.Containers | dict2items }}"
5952
become: true
6053

@@ -63,19 +56,19 @@
6356
aws_access_key: "{{ minio_access_key }}"
6457
aws_secret_key: "{{ minio_secret_key }}"
6558
s3_url: "http://minio:9000"
66-
region: eu-central-1
67-
name: pulp3
68-
state: present
69-
when: s3_test | default(false)
59+
region: "eu-central-1"
60+
name: "pulp3"
61+
state: "present"
62+
when: "s3_test | default(false)"
7063

7164
- block:
7265
- name: "Wait for Pulp"
7366
uri:
7467
url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/"
75-
follow_redirects: all
76-
validate_certs: no
77-
register: result
78-
until: result.status == 200
68+
follow_redirects: "all"
69+
validate_certs: "no"
70+
register: "result"
71+
until: "result.status == 200"
7972
retries: 12
8073
delay: 5
8174
rescue:
@@ -86,7 +79,7 @@
8679
- name: "Check version of component being tested"
8780
assert:
8881
that:
89-
- (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver)
82+
- "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)"
9083
fail_msg: |
9184
Component {{ item.app_label }} was expected to be installed in version {{ component_version }}.
9285
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}.
@@ -100,9 +93,20 @@
10093
login admin
10194
password password
10295
103-
- hosts: pulp
96+
- hosts: "pulp"
10497
gather_facts: false
10598
tasks:
99+
- name: "Create directory for pulp-smash config"
100+
ansible.builtin.file:
101+
path: "/var/lib/pulp/.config/pulp_smash/"
102+
state: "directory"
103+
mode: "0755"
104+
105+
- name: "Configure pulp-smash"
106+
ansible.builtin.copy:
107+
src: "smash-config.json"
108+
dest: "/var/lib/pulp/.config/pulp_smash/settings.json"
109+
106110
- name: "Set pulp admin password"
107111
command:
108112
cmd: "pulpcore-manager reset-admin-password --password password"

.ci/assets/ci_constraints.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 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.*
2+
# Pulpcore versions without the django 5 storage compatibility will fail, >3.63,<3.70
3+
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.64.*,!=3.65.*,!=3.66.*,!=3.67.*,!=3.68.*,!=3.69.*
34

45

56
tablib!=3.6.0
@@ -8,3 +9,11 @@ tablib!=3.6.0
89

910
multidict!=6.3.0
1011
# This release failed the lower bounds test for some case sensitivity in CIMultiDict.
12+
13+
14+
azure-storage-blob!=12.28.*
15+
# Apparently does not work with current azurite.
16+
17+
18+
pycares<5
19+
# older aiodns versions don't pin pycares UB, and are broken by pycares>=5

.ci/scripts/check_release.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/usr/bin/env python
2+
# /// script
3+
# requires-python = ">=3.13"
4+
# dependencies = [
5+
# "gitpython>=3.1.46,<3.2.0",
6+
# "packaging>=26.0,<26.1",
7+
# "pyyaml>=6.0.3,<6.1.0",
8+
# ]
9+
# ///
210

311
import argparse
412
import re
513
import os
14+
import sys
615
import tomllib
7-
import yaml
16+
import typing as t
817
from pathlib import Path
18+
19+
import yaml
920
from packaging.version import Version
1021
from git import Repo
1122

@@ -14,7 +25,7 @@
1425
Z_CHANGELOG_EXTS = [".bugfix", ".misc"]
1526

1627

17-
def options():
28+
def options() -> argparse.Namespace:
1829
"""Check which branches need a release."""
1930
parser = argparse.ArgumentParser()
2031
parser.add_argument(
@@ -33,13 +44,13 @@ def options():
3344
return parser.parse_args()
3445

3546

36-
def template_config():
47+
def template_config() -> dict[str, t.Any]:
3748
# Assume this script lies in .ci/scripts
3849
path = Path(__file__).absolute().parent.parent.parent / "template_config.yml"
3950
return yaml.safe_load(path.read_text())
4051

4152

42-
def current_version(repo, commitish):
53+
def current_version(repo: Repo, commitish: str) -> Version:
4354
try:
4455
pyproject_toml = tomllib.loads(repo.git.show(f"{commitish}:pyproject.toml"))
4556
try:
@@ -53,7 +64,7 @@ def current_version(repo, commitish):
5364
return Version(current_version)
5465

5566

56-
def check_pyproject_dependencies(repo, from_commit, to_commit):
67+
def check_pyproject_dependencies(repo: Repo, from_commit: str, to_commit: str) -> list[str]:
5768
try:
5869
new_pyproject = tomllib.loads(repo.git.show(f"{to_commit}:pyproject.toml"))
5970
try:
@@ -74,8 +85,8 @@ def check_pyproject_dependencies(repo, from_commit, to_commit):
7485
return ["pyproject.toml changed somehow (PLEASE check if dependencies are affected)."]
7586

7687

77-
def main(options, template_config):
78-
DEFAULT_BRANCH = template_config["plugin_default_branch"]
88+
def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:
89+
DEFAULT_BRANCH: str = template_config["plugin_default_branch"]
7990

8091
repo = Repo()
8192

@@ -88,7 +99,7 @@ def main(options, template_config):
8899

89100
# Warning: This will not work if branch names contain "/" but we don't really care here.
90101
heads = [h.split("/")[-1] for h in repo.git.branch("--remote").split("\n")]
91-
available_branches = [h for h in heads if re.search(RELEASE_BRANCH_REGEX, h)]
102+
available_branches = [h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)]
92103
available_branches.sort(key=lambda ver: Version(ver))
93104
available_branches.append(DEFAULT_BRANCH)
94105

@@ -105,7 +116,10 @@ def main(options, template_config):
105116

106117
if diff := branches - set(available_branches):
107118
print(f"Supplied branches contains non-existent branches! {diff}")
108-
exit(1)
119+
return 1
120+
121+
branches = [branch for branch in available_branches if branch in branches]
122+
branches.reverse()
109123

110124
print(f"Checking for releases on branches: {branches}")
111125

@@ -170,6 +184,8 @@ def main(options, template_config):
170184
if len(releases) == 0:
171185
print("No new releases to perform.")
172186

187+
return 0
188+
173189

174190
if __name__ == "__main__":
175-
main(options(), template_config())
191+
sys.exit(main(options(), template_config()))
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
# This script is running with elevated privileges from the main branch against pull requests.
3+
#
4+
# It cleans the input from artifacts which are used by the pulp documentation internally,
5+
# but clutter for GitHub releases
6+
7+
import sys
8+
9+
NOTE = """
10+
> [!NOTE]
11+
> Official changes are available on [Pulp docs]({docs_url})\
12+
"""
13+
14+
15+
def main():
16+
plugin_name = sys.argv[1]
17+
version_str = sys.argv[2]
18+
docs_url = f"https://pulpproject.org/{plugin_name}/changes/#{version_str}"
19+
note_added = False
20+
for line in sys.stdin:
21+
if line.endswith("\n"):
22+
line = line[:-1]
23+
if line.startswith("#"):
24+
print(line.split(" {: #")[0])
25+
if not note_added and version_str in line:
26+
print(NOTE.format(docs_url=docs_url))
27+
note_added = True
28+
else:
29+
print(line)
30+
31+
32+
if __name__ == "__main__":
33+
main()

.ci/scripts/collect_changes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/bin/env python3
2+
# /// script
3+
# requires-python = ">=3.13"
4+
# dependencies = [
5+
# "gitpython>=3.1.46,<3.2.0",
6+
# "packaging>=26.0,<26.1",
7+
# ]
8+
# ///
9+
210
# WARNING: DO NOT EDIT!
311
#
412
# This file was generated by plugin_template, and is managed by it. Please use

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!---
2+
Thank you for submitting a PR to the Pulp Project!
3+
4+
If this is your first time contributing, please read the Pull Request Walkthrough documentation
5+
(https://pulpproject.org/pulpcore/docs/dev/guides/pull-request-walkthrough/).
6+
-->
7+
8+
### 📜 Checklist
9+
10+
- [ ] Commits are cleanly separated with meaningful messages (simple features and bug fixes should be [squashed](https://pulpproject.org/pulpcore/docs/dev/guides/git/#rebasing-and-squashing) to one commit)
11+
- [ ] A [changelog entry](https://pulpproject.org/pulpcore/docs/dev/guides/git/#changelog-update) or entries has been added for any significant changes
12+
- [ ] Follows the [Pulp policy on AI Usage](https://pulpproject.org/help/more/governance/ai_policy/)
13+
- [ ] (For new features) - User documentation and test coverage has been added
14+
15+
See: [Pull Request Walkthrough](https://pulpproject.org/pulpcore/docs/dev/guides/pull-request-walkthrough/)

0 commit comments

Comments
 (0)