Skip to content

Commit ee5fa79

Browse files
authored
Merge pull request #663 from stackhpc/zed-auto-tags
zed: automate Kolla Ansible tag variable definitions
2 parents 85b1e3c + 0bdc266 commit ee5fa79

File tree

10 files changed

+533
-30
lines changed

10 files changed

+533
-30
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-promote.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
name: Promote package repositories
2+
name: Promote Pulp repositories
33
on:
44
push:
55
branches:
66
# NOTE(upgrade): Reference only the current release branch here.
77
- stackhpc/zed
88
jobs:
99
promote:
10-
name: Trigger package repository promotion
10+
name: Trigger Pulp promotion workflows
1111
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
1212
runs-on: ubuntu-latest
1313
permissions: {}
@@ -27,3 +27,19 @@ jobs:
2727
- name: Display link to package repository promotion workflows
2828
run: |
2929
echo "::notice Package repository promote workflow: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/package-promote.yml"
30+
31+
# NOTE(mgoddard): Trigger another CI workflow in the
32+
# stackhpc-release-train repository.
33+
- name: Trigger container image promotion
34+
run: |
35+
gh workflow run \
36+
container-promote.yml \
37+
--repo stackhpc/stackhpc-release-train \
38+
--ref main \
39+
-f kayobe_config_branch=${{ github.ref_name }}
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.STACKHPC_RELEASE_TRAIN_TOKEN }}
42+
43+
- name: Display link to container image promotion workflows
44+
run: |
45+
echo "::notice Container image promote workflow: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/container-promote.yml"

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ jobs:
7676
if: ${{ needs.check-changes.outputs.aio == 'true' }}
7777
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
7878

79+
check-tags:
80+
name: Check container image tags
81+
needs:
82+
- build-kayobe-image
83+
uses: ./.github/workflows/stackhpc-check-tags.yml
84+
with:
85+
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
86+
secrets: inherit
87+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
88+
7989
all-in-one-ubuntu-jammy-ovs:
8090
name: aio (Ubuntu Jammy OVS)
8191
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
@@ -7,7 +7,7 @@ collections:
77
- name: pulp.squeezer
88
version: 0.0.13
99
- name: stackhpc.pulp
10-
version: 0.5.2
10+
version: 0.5.4
1111
- name: stackhpc.hashicorp
1212
version: 2.4.0
1313
- name: stackhpc.kayobe_workflows

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 }}"

etc/kayobe/kolla-image-tags.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Dict of Kolla image tags to deploy for each service.
3+
# Each key is the tag variable prefix name, and the value is another dict,
4+
# where the key is the OS distro and the value is the tag to deploy.
5+
kolla_image_tags:
6+
openstack:
7+
rocky-9: zed-rocky-9-20230921T153510
8+
ubuntu-jammy: zed-ubuntu-jammy-20230921T153510
9+
bifrost:
10+
rocky-9: zed-rocky-9-20230927T142529
11+
ubuntu-jammy: zed-ubuntu-jammy-20231101T132522
12+
ovn:
13+
rocky-9: zed-rocky-9-20230925T132313
14+
ubuntu-jammy: zed-ubuntu-jammy-20230821T155947
15+
cloudkitty:
16+
rocky-9: zed-rocky-9-20231114T124701
17+
ubuntu-jammy: zed-ubuntu-jammy-20231114T124701
18+
neutron:
19+
rocky-9: zed-rocky-9-20231115T094053
20+
ubuntu-jammy: zed-ubuntu-jammy-20231115T094053
21+
opensearch:
22+
rocky-9: zed-rocky-9-20231214T095452
23+
ubuntu-jammy: zed-ubuntu-jammy-20231214T095452

etc/kayobe/kolla/globals.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,21 @@ enable_docker_repo: "{% raw %}{{ 'overcloud' not in group_names }}{% endraw %}"
1010
# This is necessary for os migrations where mixed clouds might be deployed
1111
kolla_base_distro: "{% raw %}{{ ansible_facts.distribution | lower }}{% endraw %}"
1212

13-
kayobe_image_tags:
14-
openstack:
15-
rocky: zed-rocky-9-20230921T153510
16-
ubuntu: zed-ubuntu-jammy-20230921T153510
17-
bifrost:
18-
rocky: zed-rocky-9-20230927T142529
19-
ubuntu: zed-ubuntu-jammy-20230927T154443
20-
ovn:
21-
rocky: zed-rocky-9-20230925T132313
22-
ubuntu: zed-ubuntu-jammy-20230821T155947
23-
cloudkitty:
24-
rocky: zed-rocky-9-20231114T124701
25-
ubuntu: zed-ubuntu-jammy-20231114T124701
26-
neutron:
27-
rocky: zed-rocky-9-20231115T094053
28-
ubuntu: zed-ubuntu-jammy-20231115T094053
29-
opensearch:
30-
rocky: zed-rocky-9-20231214T095452
31-
ubuntu: zed-ubuntu-jammy-20231214T095452
13+
# Convenience variable for base distro and version string.
14+
kolla_base_distro_and_version: "{% raw %}{{ kolla_base_distro }}-{{ kolla_base_distro_version }}{% endraw %}"
3215

33-
openstack_tag: "{% raw %}{{ kayobe_image_tags['openstack'][kolla_base_distro] }}{% endraw %}"
34-
bifrost_tag: "{% raw %}{{ kayobe_image_tags['bifrost'][kolla_base_distro] }}{% endraw %}"
35-
ovn_tag: "{% raw %}{{ kayobe_image_tags['ovn'][kolla_base_distro] }}{% endraw %}"
36-
cloudkitty_tag: "{% raw %}{{ kayobe_image_tags['cloudkitty'][kolla_base_distro] }}{% endraw %}"
37-
neutron_tag: "{% raw %}{{ kayobe_image_tags['neutron'][kolla_base_distro] }}{% endraw %}"
38-
opensearch_tag: "{% raw %}{{ kayobe_image_tags['opensearch'][kolla_base_distro] }}{% endraw %}"
16+
# Dict of Kolla image tags to deploy for each service.
17+
# Each key is the tag variable prefix name, and the value is another dict,
18+
# where the key is the OS distro and the value is the tag to deploy.
19+
# NOTE: This is defined in etc/kayobe/kolla-image-tags.yml.
20+
kolla_image_tags:
21+
{{ kolla_image_tags | to_nice_yaml | indent(width=4, first=true) }}
22+
23+
# Variables defining which tag to use for each container's image.
24+
{{ lookup('pipe', 'python3 ' ~ kayobe_config_path ~ '/../../tools/kolla-images.py list-tag-vars') }}
25+
26+
#############################################################################
27+
# RabbitMQ
3928

4029
om_enable_rabbitmq_high_availability: true
4130

etc/kayobe/pulp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ stackhpc_pulp_images_kolla:
522522

523523
# List of images for each base distribution which should not/cannot be built.
524524
stackhpc_kolla_unbuildable_images:
525-
ubuntu: []
526-
rocky: []
525+
ubuntu-jammy: []
526+
rocky-9: []
527527

528528
# Whitespace-separated list of regular expressions matching Kolla image names.
529529
# Usage is similar to kolla-build CLI arguments.

0 commit comments

Comments
 (0)