Skip to content

Commit 108c8d6

Browse files
committed
Update CI files
1 parent b80cbd5 commit 108c8d6

87 files changed

Lines changed: 439 additions & 502 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \
4444
RUN mkdir /var/lib/pulp/.config
4545
USER root:root
4646

47+
# Lots of plugins try to use this path, and throw warnings if they cannot access it.
48+
RUN mkdir /.pytest_cache
49+
RUN chown pulp:pulp /.pytest_cache
50+
4751
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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ REDIS_HOST = "localhost"
1010
REDIS_PORT = 6379
1111
ANALYTICS = False
1212

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

.ci/ansible/start_container.yaml

Lines changed: 29 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,16 @@
1415
- "settings"
1516

1617
- name: "Generate Pulp Settings"
17-
template:
18+
ansible.builtin.template:
1819
src: "settings.py.j2"
1920
dest: "settings/settings.py"
2021

2122
- name: "Setup docker networking"
22-
docker_network:
23+
community.docker.docker_network:
2324
name: "pulp_ci_bridge"
2425

2526
- name: "Start Service Containers"
26-
docker_container:
27+
community.docker.docker_container:
2728
name: "{{ item.name }}"
2829
image: "{{ item.image }}"
2930
auto_remove: true
@@ -39,12 +40,12 @@
3940
loop: "{{ services | default([]) }}"
4041

4142
- name: "Retrieve Docker Network Info"
42-
docker_network_info:
43+
community.docker.docker_network_info:
4344
name: "pulp_ci_bridge"
4445
register: "pulp_ci_bridge_info"
4546

4647
- name: "Update /etc/hosts"
47-
lineinfile:
48+
ansible.builtin.lineinfile:
4849
path: "/etc/hosts"
4950
regexp: "\\s{{ item.value.Name }}\\s*$"
5051
line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}"
@@ -55,16 +56,27 @@
5556
amazon.aws.s3_bucket:
5657
aws_access_key: "{{ minio_access_key }}"
5758
aws_secret_key: "{{ minio_secret_key }}"
58-
s3_url: "http://minio:9000"
59+
endpoint_url: "http://minio:9000"
5960
region: "eu-central-1"
6061
name: "pulp3"
6162
state: "present"
6263
when: "s3_test | default(false)"
6364

64-
- block:
65+
- name: "Wait on Services"
66+
block:
67+
- name: "Wait for azurite"
68+
ansible.builtin.uri:
69+
url: "http://ci-azurite:10000/"
70+
status_code:
71+
- 200
72+
- 400
73+
when: "azure_test | default(false)"
74+
retries: 2
75+
delay: 5
76+
6577
- name: "Wait for Pulp"
66-
uri:
67-
url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/"
78+
ansible.builtin.uri:
79+
url: "http://pulp{{ pulp_scenario_settings.api_root | default(pulp_settings.api_root | default('\/pulp\/', True), True) }}api/v3/status/"
6880
follow_redirects: "all"
6981
validate_certs: "no"
7082
register: "result"
@@ -73,11 +85,12 @@
7385
delay: 5
7486
rescue:
7587
- name: "Output pulp container log"
76-
command: "docker logs pulp"
88+
ansible.builtin.command:
89+
cmd: "docker logs pulp"
7790
failed_when: true
7891

7992
- name: "Check version of component being tested"
80-
assert:
93+
ansible.builtin.assert:
8194
that:
8295
- "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)"
8396
fail_msg: |
@@ -86,14 +99,15 @@
8699
loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}"
87100

88101
- name: "Set pulp password in .netrc"
89-
copy:
102+
ansible.builtin.copy:
90103
dest: "~/.netrc"
91104
content: |
92105
machine pulp
93106
login admin
94107
password password
95108
96-
- hosts: "pulp"
109+
- name: "Prepare Pulp Application Container"
110+
hosts: "pulp"
97111
gather_facts: false
98112
tasks:
99113
- name: "Create directory for pulp-smash config"
@@ -108,6 +122,6 @@
108122
dest: "/var/lib/pulp/.config/pulp_smash/settings.json"
109123

110124
- name: "Set pulp admin password"
111-
command:
125+
ansible.builtin.command:
112126
cmd: "pulpcore-manager reset-admin-password --password password"
113127
...

.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)