Skip to content

Commit 66c8335

Browse files
committed
CI: Add a job to check whether all expected images are in Test Pulp
1 parent 2de3ed6 commit 66c8335

File tree

5 files changed

+104
-1
lines changed

5 files changed

+104
-1
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
# This workflow queries the Test Pulp server to check that all image tags
3+
# specified in kolla_image_tags are present.
4+
5+
name: Check container image tags
6+
on:
7+
workflow_call:
8+
inputs:
9+
kayobe_image:
10+
description: Kayobe container image
11+
type: string
12+
required: true
13+
secrets:
14+
KAYOBE_VAULT_PASSWORD:
15+
required: true
16+
17+
env:
18+
ANSIBLE_FORCE_COLOR: True
19+
jobs:
20+
check-tags:
21+
name: Check container image tags
22+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
23+
runs-on: [self-hosted, stackhpc-kayobe-config-aio]
24+
permissions: {}
25+
env:
26+
KAYOBE_ENVIRONMENT: ci-aio
27+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
28+
KAYOBE_IMAGE: ${{ inputs.kayobe_image }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
submodules: true
33+
34+
# The same tag may be reused (e.g. pr-123), so ensure we have the latest image.
35+
- name: Pull latest Kayobe image
36+
run: |
37+
sudo docker image pull $KAYOBE_IMAGE
38+
39+
- name: Check container image tags
40+
run: |
41+
sudo -E docker run -t --rm \
42+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
43+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
44+
$KAYOBE_IMAGE \
45+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh \
46+
'$KAYOBE_CONFIG_PATH/ansible/check-tags.yml'
47+
#env:
48+
#KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}

.github/workflows/stackhpc-pull-request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ jobs:
4141
uses: ./.github/workflows/stackhpc-build-kayobe-image.yml
4242
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
4343

44+
check-tags:
45+
name: Check container image tags
46+
needs:
47+
- build-kayobe-image
48+
uses: ./.github/workflows/stackhpc-check-tags.yml
49+
with:
50+
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
51+
secrets: inherit
52+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
53+
4454
all-in-one-ubuntu-jammy-ovs:
4555
name: aio (Ubuntu Jammy OVS)
4656
needs:

etc/kayobe/ansible/check-tags.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# This playbook queries the Pulp server to check that all image tags specified
3+
# in kolla_image_tags are present.
4+
5+
- name: Check whether tags exist in Pulp container registry
6+
hosts: localhost
7+
tasks:
8+
- name: Query images and tags
9+
command:
10+
cmd: >-
11+
{{ kayobe_config_path }}/../../tools/kolla-images.py list-tags
12+
register: kolla_images_result
13+
changed_when: false
14+
15+
- name: Set a fact about images and tags
16+
set_fact:
17+
kolla_images: "{{ kolla_images_result.stdout | from_yaml }}"
18+
19+
- name: Set a fact about the Pulp URL
20+
set_fact:
21+
pulp_url: "{{ stackhpc_repo_mirror_url }}"
22+
23+
# Use state=read and allow_missing=false to check for missing tags in test pulp.
24+
- import_role:
25+
name: stackhpc.pulp.pulp_container_content
26+
vars:
27+
pulp_container_content: >-
28+
{%- set contents = [] -%}
29+
{%- for image, tags in kolla_images.items() -%}
30+
{%- set repository = kolla_docker_namespace ~ "/" ~ image -%}
31+
{%- set content = {
32+
"allow_missing": False,
33+
"repository": repository,
34+
"state": "read",
35+
"tags": tags,
36+
} -%}
37+
{%- set _ = contents.append(content) -%}
38+
{%- endfor -%}
39+
{{ contents }}

etc/kayobe/ansible/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ collections:
33
- name: stackhpc.cephadm
44
version: 1.14.0
55
- name: stackhpc.pulp
6-
version: 0.5.2
6+
version: 0.5.4
77
- name: stackhpc.hashicorp
88
version: 2.4.0
99
roles:

etc/kayobe/environments/ci-aio/stackhpc-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ stackhpc_docker_registry_password: !vault |
6262
38333133393730633666613965653364316162353337313330346164303631313731646461363461
6363
3963323635373866630a633533376339363734626664333765313665623662613764363038383735
6464
38646138376438643533376161376634653439386230353365316239613430363338
65+
66+
# Override Pulp credentials to allow querying container image tags in the
67+
# check-tags.yml custom playbook.
68+
pulp_url: "{{ stackhpc_repo_mirror_url }}"
69+
pulp_username: "{{ stackhpc_docker_registry_username }}"
70+
pulp_password: "{{ stackhpc_docker_registry_password }}"

0 commit comments

Comments
 (0)