Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 17 additions & 26 deletions .ci/ansible/Containerfile.j2
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
FROM {{ ci_base | default(pulp_default_container) }}
FROM {{ image.ci_base }}
{%- if image.webserver_snippet %}

# Add source directories to container
{% for item in plugins %}
ADD ./{{ item.name }} ./{{ item.name }}
{% endfor %}
ADD ./{{ plugin_name }}/{{ plugin_name | replace("-", "_") }}/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ plugin_name }}.conf
{%- endif %}

{%- for item in extra_files | default([]) %}

{% for item in extra_files | default([]) %}
ADD ./{{ item.origin }} {{ item.destination }}
{% endfor %}
{%- endfor %}

# This MUST be the ONLY call to pip install in inside the container.
RUN pip3 install --upgrade pip setuptools wheel && \
rm -rf /root/.cache/pip && \
pip3 install
{%- if s3_test | default(false) -%}
{{ " " }}git+https://github.com/gerrod3/botocore.git@fix-100-continue
{%- endif -%}
{%- for item in plugins -%}
{{ " " }}{{ item.source }}
{%- if item.upperbounds | default(false) -%}
{{ " " }}-c ./{{ item.name }}/upperbounds_constraints.txt
pip3 install {{ image.source }}
{%- if image.upperbounds | default(false) -%}
{{ " " }}-c ./{{ plugin_name }}/upperbounds_constraints.txt
{%- endif -%}
{%- if item.lowerbounds | default(false) -%}
{{ " " }}-c ./{{ item.name }}/lowerbounds_constraints.txt
{%- if image.lowerbounds | default(false) -%}
{{ " " }}-c ./{{ plugin_name }}/lowerbounds_constraints.txt
{%- endif -%}
{%- if item.ci_requirements | default(false) -%}
{{ " " }}-r ./{{ item.name }}/ci_requirements.txt
{%- if image.ci_requirements | default(false) -%}
{{ " " }}-r ./{{ plugin_name }}/ci_requirements.txt
{%- endif -%}
{%- endfor %}
{{ " " }}-c ./{{ plugins[0].name }}/.ci/assets/ci_constraints.txt && \
{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt && \
rm -rf /root/.cache/pip

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

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

ENTRYPOINT ["/init"]
11 changes: 5 additions & 6 deletions .ci/ansible/build_container.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Ansible playbook to create the pulp service containers image
---
- hosts: localhost
- hosts: "localhost"
gather_facts: false
vars_files:
- vars/main.yaml
- "vars/main.yaml"
tasks:
- name: "Generate Containerfile from template"
template:
src: Containerfile.j2
dest: Containerfile

ansible.builtin.template:
src: "Containerfile.j2"
dest: "Containerfile"
- name: "Build pulp image"
# We build from the ../.. (parent dir of pulpcore git repo) Docker build
# "context" so that repos like pulp-smash are accessible to Docker
Expand Down
66 changes: 35 additions & 31 deletions .ci/ansible/start_container.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
# Ansible playbook to start the pulp service container and its supporting services
---
- hosts: localhost
- hosts: "localhost"
gather_facts: false
vars_files:
- vars/main.yaml
- "vars/main.yaml"
tasks:
- name: "Create Settings Directories"
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
state: "directory"
mode: "0755"
loop:
- settings
- ssh
- ~/.config/pulp_smash
- "settings"

- name: "Generate Pulp Settings"
template:
src: settings.py.j2
dest: settings/settings.py

- name: "Configure pulp-smash"
copy:
src: smash-config.json
dest: ~/.config/pulp_smash/settings.json
src: "settings.py.j2"
dest: "settings/settings.py"

- name: "Setup docker networking"
docker_network:
name: pulp_ci_bridge
name: "pulp_ci_bridge"

- name: "Start Service Containers"
docker_container:
Expand All @@ -37,24 +30,24 @@
recreate: true
privileged: true
networks:
- name: pulp_ci_bridge
- name: "pulp_ci_bridge"
aliases: "{{ item.name }}"
volumes: "{{ item.volumes | default(omit) }}"
env: "{{ item.env | default(omit) }}"
command: "{{ item.command | default(omit) }}"
state: started
state: "started"
loop: "{{ services | default([]) }}"

- name: "Retrieve Docker Network Info"
docker_network_info:
name: pulp_ci_bridge
register: pulp_ci_bridge_info
name: "pulp_ci_bridge"
register: "pulp_ci_bridge_info"

- name: "Update /etc/hosts"
lineinfile:
path: /etc/hosts
path: "/etc/hosts"
regexp: "\\s{{ item.value.Name }}\\s*$"
line: "{{ item.value.IPv4Address | ipaddr('address') }}\t{{ item.value.Name }}"
line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}"
loop: "{{ pulp_ci_bridge_info.network.Containers | dict2items }}"
become: true

Expand All @@ -63,19 +56,19 @@
aws_access_key: "{{ minio_access_key }}"
aws_secret_key: "{{ minio_secret_key }}"
s3_url: "http://minio:9000"
region: eu-central-1
name: pulp3
state: present
when: s3_test | default(false)
region: "eu-central-1"
name: "pulp3"
state: "present"
when: "s3_test | default(false)"

- block:
- name: "Wait for Pulp"
uri:
url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/"
follow_redirects: all
validate_certs: no
register: result
until: result.status == 200
follow_redirects: "all"
validate_certs: "no"
register: "result"
until: "result.status == 200"
retries: 12
delay: 5
rescue:
Expand All @@ -86,7 +79,7 @@
- name: "Check version of component being tested"
assert:
that:
- (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver)
- "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)"
fail_msg: |
Component {{ item.app_label }} was expected to be installed in version {{ component_version }}.
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}.
Expand All @@ -100,9 +93,20 @@
login admin
password password

- hosts: pulp
- hosts: "pulp"
gather_facts: false
tasks:
- name: "Create directory for pulp-smash config"
ansible.builtin.file:
path: "/var/lib/pulp/.config/pulp_smash/"
state: "directory"
mode: "0755"

- name: "Configure pulp-smash"
ansible.builtin.copy:
src: "smash-config.json"
dest: "/var/lib/pulp/.config/pulp_smash/settings.json"

- name: "Set pulp admin password"
command:
cmd: "pulpcore-manager reset-admin-password --password password"
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,21 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v6"
with:
fetch-depth: 1
path: "pulp_python"
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v6"
with:
fetch-depth: 1
repository: "pulp/pulp-openapi-generator"
path: "pulp-openapi-generator"
- uses: "actions/setup-python@v5"
- uses: "actions/setup-python@v6"
with:
python-version: "3.11"
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install build packaging twine wheel mkdocs jq
echo ::endgroup::
- name: "Build package"
run: |
python3 -m build
Expand All @@ -48,15 +46,15 @@ jobs:
pulpcore-manager openapi --file "api.json"
pulpcore-manager openapi --bindings --component "python" --file "python-api.json"
- name: "Upload Package whl"
uses: "actions/upload-artifact@v4"
uses: "actions/upload-artifact@v5"
with:
name: "plugin_package"
path: "pulp_python/dist/"
if-no-files-found: "error"
retention-days: 5
overwrite: true
- name: "Upload API specs"
uses: "actions/upload-artifact@v4"
uses: "actions/upload-artifact@v5"
with:
name: "api_spec"
path: |
Expand All @@ -75,7 +73,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
- name: "Upload python client packages"
uses: "actions/upload-artifact@v4"
uses: "actions/upload-artifact@v5"
with:
name: "python-client.tar"
path: |
Expand All @@ -84,7 +82,7 @@ jobs:
retention-days: 5
overwrite: true
- name: "Upload python client docs"
uses: "actions/upload-artifact@v4"
uses: "actions/upload-artifact@v5"
with:
name: "python-client-docs.tar"
path: |
Expand All @@ -102,7 +100,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
- name: "Upload Ruby client"
uses: "actions/upload-artifact@v4"
uses: "actions/upload-artifact@v5"
with:
name: "ruby-client.tar"
path: |
Expand Down
Loading
Loading