Skip to content

Commit 3d7cba5

Browse files
committed
Update CI files
1 parent c3adb40 commit 3d7cba5

89 files changed

Lines changed: 464 additions & 509 deletions

File tree

Some content is hidden

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

.ci/ansible/Containerfile.j2

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ ADD ./{{ item.origin }} {{ item.destination }}
1010
{%- endfor %}
1111

1212
# 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 {{ image.source }}
13+
RUN --mount=type=cache,target=/root/.cache/uv uv pip install --upgrade setuptools wheel && \
14+
uv pip install {{ image.source }}
1615
{%- if image.upperbounds | default(false) -%}
1716
{{ " " }}-c ./{{ plugin_name }}/upperbounds_constraints.txt
1817
{%- endif -%}
@@ -22,8 +21,7 @@ RUN pip3 install --upgrade pip setuptools wheel && \
2221
{%- if image.ci_requirements | default(false) -%}
2322
{{ " " }}-r ./{{ plugin_name }}/ci_requirements.txt
2423
{%- endif -%}
25-
{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt && \
26-
rm -rf /root/.cache/pip
24+
{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt
2725

2826
{% if pulp_env is defined and pulp_env %}
2927
{% for key, value in pulp_env.items() %}
@@ -44,4 +42,8 @@ RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \
4442
RUN mkdir /var/lib/pulp/.config
4543
USER root:root
4644

45+
# Lots of plugins try to use this path, and throw warnings if they cannot access it.
46+
RUN mkdir /.pytest_cache
47+
RUN chown pulp:pulp /.pytest_cache
48+
4749
ENTRYPOINT ["/init"]

.ci/ansible/build_container.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Ansible playbook to create the pulp service containers image
22
---
3-
- hosts: "localhost"
3+
- name: "Build CI Container Image"
4+
hosts: "localhost"
45
gather_facts: false
56
vars_files:
67
- "vars/main.yaml"
@@ -9,6 +10,7 @@
910
ansible.builtin.template:
1011
src: "Containerfile.j2"
1112
dest: "Containerfile"
13+
1214
- name: "Build pulp image"
1315
# We build from the ../.. (parent dir of pulpcore git repo) Docker build
1416
# "context" so that repos like pulp-smash are accessible to Docker
@@ -18,9 +20,20 @@
1820
# 1-off-builds and CI purposes (which has no cache across CI runs.)
1921
# Run build.yaml with -e cache=false if your builds are using outdated
2022
# layers.
21-
command: "docker build --network host --no-cache={{ not cache | default(true) | bool }} -t {{ image.name }}:{{ image.tag }} -f {{ playbook_dir }}/Containerfile ../../.."
23+
ansible.builtin.command:
24+
argv:
25+
- "docker"
26+
- "build"
27+
- "--network"
28+
- "host"
29+
- "--no-cache={{ not cache | default(true) | bool }}"
30+
- "-t"
31+
- "{{ image.name }}:{{ image.tag }}"
32+
- "-f"
33+
- "{{ playbook_dir }}/Containerfile"
34+
- "../../.."
2235

2336
- name: "Clean image cache"
24-
docker_prune:
25-
images : true
37+
community.docker.docker_prune:
38+
images: true
2639
...

.ci/ansible/filter/repr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import, division, print_function
2+
23
from packaging.version import parse as parse_version
34

45
__metaclass__ = type

.ci/ansible/settings.py.j2

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
SECRET_KEY = "{{ django_secret }}"
12
CONTENT_ORIGIN = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}"
23
ANSIBLE_API_HOSTNAME = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}"
34
ANSIBLE_CONTENT_HOSTNAME = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}/pulp/content"
@@ -10,10 +11,6 @@ REDIS_HOST = "localhost"
1011
REDIS_PORT = 6379
1112
ANALYTICS = False
1213

13-
{% if api_root is defined %}
14-
API_ROOT = {{ api_root | repr }}
15-
{% endif %}
16-
1714
{% if pulp_settings %}
1815
{% for key, value in pulp_settings.items() %}
1916
{{ key | upper }} = {{ value | repr }}

.ci/ansible/start_container.yaml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Ansible playbook to start the pulp service container and its supporting services
22
---
3-
- hosts: "localhost"
3+
- name: "Start CI Containers"
4+
hosts: "localhost"
45
gather_facts: false
56
vars_files:
67
- "vars/main.yaml"
@@ -14,16 +15,18 @@
1415
- "settings"
1516

1617
- name: "Generate Pulp Settings"
17-
template:
18+
ansible.builtin.template:
1819
src: "settings.py.j2"
1920
dest: "settings/settings.py"
21+
vars:
22+
django_secret: "lookup('community.general.random_string', length=50, overwrite_all='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')"
2023

2124
- name: "Setup docker networking"
22-
docker_network:
25+
community.docker.docker_network:
2326
name: "pulp_ci_bridge"
2427

2528
- name: "Start Service Containers"
26-
docker_container:
29+
community.docker.docker_container:
2730
name: "{{ item.name }}"
2831
image: "{{ item.image }}"
2932
auto_remove: true
@@ -39,12 +42,12 @@
3942
loop: "{{ services | default([]) }}"
4043

4144
- name: "Retrieve Docker Network Info"
42-
docker_network_info:
45+
community.docker.docker_network_info:
4346
name: "pulp_ci_bridge"
4447
register: "pulp_ci_bridge_info"
4548

4649
- name: "Update /etc/hosts"
47-
lineinfile:
50+
ansible.builtin.lineinfile:
4851
path: "/etc/hosts"
4952
regexp: "\\s{{ item.value.Name }}\\s*$"
5053
line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}"
@@ -55,16 +58,27 @@
5558
amazon.aws.s3_bucket:
5659
aws_access_key: "{{ minio_access_key }}"
5760
aws_secret_key: "{{ minio_secret_key }}"
58-
s3_url: "http://minio:9000"
61+
endpoint_url: "http://minio:9000"
5962
region: "eu-central-1"
6063
name: "pulp3"
6164
state: "present"
6265
when: "s3_test | default(false)"
6366

64-
- block:
67+
- name: "Wait on Services"
68+
block:
69+
- name: "Wait for azurite"
70+
ansible.builtin.uri:
71+
url: "http://ci-azurite:10000/"
72+
status_code:
73+
- 200
74+
- 400
75+
when: "azure_test | default(false)"
76+
retries: 2
77+
delay: 5
78+
6579
- name: "Wait for Pulp"
66-
uri:
67-
url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/"
80+
ansible.builtin.uri:
81+
url: "http://pulp{{ pulp_scenario_settings.api_root | default(pulp_settings.api_root | default('\/pulp\/', True), True) }}api/v3/status/"
6882
follow_redirects: "all"
6983
validate_certs: "no"
7084
register: "result"
@@ -73,11 +87,12 @@
7387
delay: 5
7488
rescue:
7589
- name: "Output pulp container log"
76-
command: "docker logs pulp"
90+
ansible.builtin.command:
91+
cmd: "docker logs pulp"
7792
failed_when: true
7893

7994
- name: "Check version of component being tested"
80-
assert:
95+
ansible.builtin.assert:
8196
that:
8297
- "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)"
8398
fail_msg: |
@@ -86,14 +101,15 @@
86101
loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}"
87102

88103
- name: "Set pulp password in .netrc"
89-
copy:
104+
ansible.builtin.copy:
90105
dest: "~/.netrc"
91106
content: |
92107
machine pulp
93108
login admin
94109
password password
95110
96-
- hosts: "pulp"
111+
- name: "Prepare Pulp Application Container"
112+
hosts: "pulp"
97113
gather_facts: false
98114
tasks:
99115
- name: "Create directory for pulp-smash config"
@@ -108,6 +124,6 @@
108124
dest: "/var/lib/pulp/.config/pulp_smash/settings.json"
109125

110126
- name: "Set pulp admin password"
111-
command:
127+
ansible.builtin.command:
112128
cmd: "pulpcore-manager reset-admin-password --password password"
113129
...

.ci/scripts/calc_constraints.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
import argparse
99
import fileinput
10-
import urllib.request
1110
import sys
11+
import urllib.request
12+
13+
import yaml
1214
from packaging.requirements import Requirement
1315
from packaging.version import Version
14-
import yaml
1516

1617
try:
1718
import tomllib

.ci/scripts/check_gettext.sh

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

.ci/scripts/check_pulpcore_imports.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
# make sure this script runs at the repo root
1111
cd "$(dirname "$(realpath -e "$0")")"/../..
1212

13-
set -uv
13+
set -u
1414

1515
# check for imports not from pulpcore.plugin. exclude tests
16-
MATCHES=$(grep -n -r --include \*.py "from pulpcore.*import" . | grep -v "tests\|plugin")
16+
MATCHES="$(grep -n -r --include \*.py "from pulpcore.*import" pulp_container | grep -v "tests\|plugin")"
1717

1818
if [ $? -ne 1 ]; then
1919
printf "\nERROR: Detected bad imports from pulpcore:\n"

.ci/scripts/check_release.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
# ///
1010

1111
import argparse
12-
import re
1312
import os
13+
import re
1414
import sys
15-
import tomllib
1615
import typing as t
1716
from pathlib import Path
1817

18+
import tomllib
1919
import yaml
20-
from packaging.version import Version
2120
from git import Repo
21+
from packaging.version import Version
2222

2323
RELEASE_BRANCH_REGEX = r"^([0-9]+)\.([0-9]+)$"
2424
Y_CHANGELOG_EXTS = [".feature"]
@@ -157,9 +157,9 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:
157157

158158
if reasons:
159159
curr_version = Version(last_tag)
160-
assert curr_version.base_version.startswith(
161-
branch
162-
), "Current-version has to belong to the current branch!"
160+
assert curr_version.base_version.startswith(branch), (
161+
"Current-version has to belong to the current branch!"
162+
)
163163
next_version = Version(f"{branch}.{curr_version.micro + 1}")
164164
print(
165165
f"A Z-release is needed for {branch}, "

.ci/scripts/check_requirements.py

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

8-
import tomllib
98
import warnings
9+
10+
import tomllib
1011
from packaging.requirements import Requirement
1112

1213
CHECK_MATRIX = [
1314
("pyproject.toml", True, True, True),
1415
("requirements.txt", True, True, True),
15-
("dev_requirements.txt", False, True, False),
1616
("ci_requirements.txt", False, True, True),
1717
("doc_requirements.txt", False, True, False),
1818
("lint_requirements.txt", False, True, True),

0 commit comments

Comments
 (0)