Skip to content

Commit a0de37b

Browse files
committed
Merge stackhpc/xena into stackhpc/yoga
2 parents 837e215 + 764c3d6 commit a0de37b

File tree

10 files changed

+479
-7
lines changed

10 files changed

+479
-7
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
name: Build overcloud host images
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
centos:
7+
description: Build CentOS Stream
8+
type: boolean
9+
default: true
10+
rocky:
11+
description: Build Rocky Linux
12+
type: boolean
13+
default: true
14+
ubuntu:
15+
description: Build Ubuntu
16+
type: boolean
17+
default: true
18+
19+
env:
20+
ANSIBLE_FORCE_COLOR: True
21+
jobs:
22+
overcloud-host-image-build:
23+
name: Build overcloud host images
24+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
25+
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
path: src/kayobe-config
30+
31+
- name: Clone StackHPC Kayobe repository
32+
uses: actions/checkout@v3
33+
with:
34+
repository: stackhpc/kayobe
35+
ref: refs/heads/stackhpc/xena
36+
path: src/kayobe
37+
38+
# FIXME: Failed in kolla-ansible : Ensure the latest version of pip is installed
39+
- name: Install dependencies
40+
run: |
41+
sudo dnf -y install python3-virtualenv
42+
43+
- name: Setup networking
44+
run: |
45+
if ! ip l show breth1 >/dev/null 2>&1; then
46+
sudo ip l add breth1 type bridge
47+
fi
48+
sudo ip l set breth1 up
49+
if ! ip a show breth1 | grep 192.168.33.3/24; then
50+
sudo ip a add 192.168.33.3/24 dev breth1
51+
fi
52+
if ! ip l show dummy1 >/dev/null 2>&1; then
53+
sudo ip l add dummy1 type dummy
54+
fi
55+
sudo ip l set dummy1 up
56+
sudo ip l set dummy1 master breth1
57+
58+
- name: Install Kayobe
59+
run: |
60+
mkdir -p venvs &&
61+
pushd venvs &&
62+
python3 -m venv kayobe &&
63+
source kayobe/bin/activate &&
64+
pip install -U pip &&
65+
pip install ../src/kayobe
66+
67+
- name: Bootstrap the control host
68+
run: |
69+
source venvs/kayobe/bin/activate &&
70+
source src/kayobe-config/kayobe-env --environment ci-builder &&
71+
kayobe control host bootstrap
72+
73+
- name: Configure the seed host
74+
run: |
75+
source venvs/kayobe/bin/activate &&
76+
source src/kayobe-config/kayobe-env --environment ci-builder &&
77+
kayobe seed host configure
78+
env:
79+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
80+
81+
- name: Create bifrost_httpboot Docker volume
82+
run: |
83+
if [[ $(sudo docker volume ls -f Name=bifrost_httpboot -q | wc -l) = 0 ]]; then
84+
sudo docker volume create bifrost_httpboot
85+
fi
86+
87+
- name: Clean any previous build artifact
88+
run: |
89+
rm -f /tmp/updated_images.txt
90+
91+
- name: Build a CentOS Stream 8 overcloud host image
92+
run: |
93+
source venvs/kayobe/bin/activate &&
94+
source src/kayobe-config/kayobe-env --environment ci-builder &&
95+
kayobe overcloud host image build --force-rebuild \
96+
-e os_distribution=centos \
97+
-e stackhpc_overcloud_dib_name=overcloud-centos-stream-8
98+
env:
99+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
100+
if: inputs.centos
101+
102+
- name: Upload CentOS Stream 8 overcloud host image artifact
103+
run: |
104+
source venvs/kayobe/bin/activate &&
105+
source src/kayobe-config/kayobe-env --environment ci-builder &&
106+
kayobe playbook run \
107+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
108+
-e image_path='/opt/kayobe/images/overcloud-centos-stream-8' \
109+
-e os_distribution='centos'
110+
env:
111+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
112+
if: inputs.centos
113+
114+
- name: Build a Rocky Linux 8 overcloud host image
115+
run: |
116+
source venvs/kayobe/bin/activate &&
117+
source src/kayobe-config/kayobe-env --environment ci-builder &&
118+
kayobe overcloud host image build --force-rebuild \
119+
-e os_distribution=rocky \
120+
-e stackhpc_overcloud_dib_name=overcloud-rocky-linux-8
121+
env:
122+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
123+
if: inputs.rocky
124+
125+
- name: Upload Rocky Linux 8 overcloud host image artifact
126+
run: |
127+
source venvs/kayobe/bin/activate &&
128+
source src/kayobe-config/kayobe-env --environment ci-builder &&
129+
kayobe playbook run \
130+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
131+
-e image_path='/opt/kayobe/images/overcloud-rocky-linux-8' \
132+
-e os_distribution='rocky'
133+
env:
134+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
135+
if: inputs.rocky
136+
137+
# FIXME: Need EPEL on CentOS for debootstrap. It is disabled by default.
138+
# Do this via config?
139+
- name: Enable EPEL repository
140+
run: |
141+
sudo dnf config-manager --set-enabled epel
142+
143+
- name: Build a Ubuntu Focal 20.04 overcloud host image
144+
run: |
145+
source venvs/kayobe/bin/activate &&
146+
source src/kayobe-config/kayobe-env --environment ci-builder &&
147+
kayobe overcloud host image build --force-rebuild \
148+
-e os_distribution=ubuntu \
149+
-e stackhpc_overcloud_dib_name=overcloud-ubuntu-focal
150+
env:
151+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
152+
if: inputs.ubuntu
153+
154+
- name: Upload Ubuntu Focal 20.04 overcloud host image artifact
155+
run: |
156+
source venvs/kayobe/bin/activate &&
157+
source src/kayobe-config/kayobe-env --environment ci-builder &&
158+
kayobe playbook run \
159+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
160+
-e image_path='/opt/kayobe/images/overcloud-ubuntu-focal' \
161+
-e os_distribution='ubuntu'
162+
env:
163+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
164+
if: inputs.ubuntu
165+
166+
- name: Upload updated images artifact
167+
uses: actions/upload-artifact@v3
168+
with:
169+
name: Updated images list
170+
path: /tmp/updated_images.txt
171+
retention-days: 7
172+
if: always()
173+
174+
- name: Clean up old images
175+
run: |
176+
sudo rm -rf /opt/kayobe/images/
177+
if: always()
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
name: Promote overcloud host image
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
os_image:
7+
description: Image to promote
8+
type: choice
9+
required: true
10+
default: 'CentOS Stream 8'
11+
options:
12+
- 'CentOS Stream 8'
13+
- 'Rocky Linux 8'
14+
- 'Ubuntu Focal 20.04'
15+
image_tag:
16+
description: Tag to promote
17+
type: string
18+
required: true
19+
env:
20+
ANSIBLE_FORCE_COLOR: True
21+
jobs:
22+
overcloud-host-image-promote:
23+
name: Promote overcloud host image
24+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
25+
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
path: src/kayobe-config
30+
31+
- name: Clone StackHPC Kayobe repository
32+
uses: actions/checkout@v3
33+
with:
34+
repository: stackhpc/kayobe
35+
ref: refs/heads/stackhpc/xena
36+
path: src/kayobe
37+
38+
# FIXME: Failed in kolla-ansible : Ensure the latest version of pip is installed
39+
- name: Install dependencies
40+
run: |
41+
sudo dnf -y install python3-virtualenv
42+
43+
- name: Setup networking
44+
run: |
45+
if ! ip l show breth1 >/dev/null 2>&1; then
46+
sudo ip l add breth1 type bridge
47+
fi
48+
sudo ip l set breth1 up
49+
if ! ip a show breth1 | grep 192.168.33.3/24; then
50+
sudo ip a add 192.168.33.3/24 dev breth1
51+
fi
52+
if ! ip l show dummy1 >/dev/null 2>&1; then
53+
sudo ip l add dummy1 type dummy
54+
fi
55+
sudo ip l set dummy1 up
56+
sudo ip l set dummy1 master breth1
57+
58+
- name: Install Kayobe
59+
run: |
60+
mkdir -p venvs &&
61+
pushd venvs &&
62+
python3 -m venv kayobe &&
63+
source kayobe/bin/activate &&
64+
pip install -U pip &&
65+
pip install ../src/kayobe
66+
67+
- name: Bootstrap the control host
68+
run: |
69+
source venvs/kayobe/bin/activate &&
70+
source src/kayobe-config/kayobe-env --environment ci-builder &&
71+
kayobe control host bootstrap
72+
73+
- name: Configure the seed host
74+
run: |
75+
source venvs/kayobe/bin/activate &&
76+
source src/kayobe-config/kayobe-env --environment ci-builder &&
77+
kayobe seed host configure
78+
env:
79+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
80+
81+
- name: Promote CentOS Stream 8 overcloud host image artifact
82+
run: |
83+
source venvs/kayobe/bin/activate &&
84+
source src/kayobe-config/kayobe-env --environment ci-builder &&
85+
kayobe playbook run \
86+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \
87+
-e image_path='/opt/kayobe/images/overcloud-centos-stream-8' \
88+
-e os_distribution='centos' \
89+
-e os_release='8-stream'
90+
env:
91+
OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }}
92+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
93+
if: os_image == 'CentOS Stream 8'
94+
95+
- name: Promote Rocky Linux 8 overcloud host image artifact
96+
run: |
97+
source venvs/kayobe/bin/activate &&
98+
source src/kayobe-config/kayobe-env --environment ci-builder &&
99+
kayobe playbook run \
100+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \
101+
-e image_path='/opt/kayobe/images/overcloud-rocky-linux-8' \
102+
-e os_distribution='rocky' \
103+
-e os_release='8'
104+
env:
105+
OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }}
106+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
107+
if: os_image == 'Rocky Linux 8'
108+
109+
- name: Promote Ubuntu Focal 20.04 overcloud host image artifact
110+
run: |
111+
source venvs/kayobe/bin/activate &&
112+
source src/kayobe-config/kayobe-env --environment ci-builder &&
113+
kayobe playbook run \
114+
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \
115+
-e image_path='/opt/kayobe/images/overcloud-ubuntu-focal' \
116+
-e os_distribution='ubuntu' \
117+
-e os_release='focal'
118+
env:
119+
OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }}
120+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
121+
if: os_image == 'Ubuntu Focal 20.04'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# Tag is the version of the image to promote, stored in an env variable named OVERCLOUD_HOST_IMAGE_TAG
3+
- name: Promote an image to production
4+
hosts: localhost
5+
vars:
6+
remote_pulp_url: "{{ stackhpc_release_pulp_url }}"
7+
remote_pulp_username: "{{ stackhpc_image_repository_username }}"
8+
remote_pulp_password: "{{ stackhpc_image_repository_password }}"
9+
repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
10+
base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
11+
promotion_tag: "{{ lookup('env', 'OVERCLOUD_HOST_IMAGE_TAG') }}"
12+
tasks:
13+
14+
- name: Check whether the image exists
15+
pulp.squeezer.file_distribution:
16+
pulp_url: "{{ remote_pulp_url }}"
17+
username: "{{ remote_pulp_username }}"
18+
password: "{{ remote_pulp_password }}"
19+
name: "{{ repository_name }}_{{ promotion_tag }}"
20+
base_path: "{{ base_path }}/{{ promotion_tag }}"
21+
register: distribution_details
22+
23+
- name: Fail if the image does not exist
24+
fail:
25+
msg: "Image {{ promotion_tag }} does not exist"
26+
when: distribution_details.distribution is none
27+
28+
- name: Ensure production content guard is set
29+
pulp.squeezer.file_distribution:
30+
pulp_url: "{{ remote_pulp_url }}"
31+
username: "{{ remote_pulp_username }}"
32+
password: "{{ remote_pulp_password }}"
33+
name: "{{ repository_name }}_{{ promotion_tag }}"
34+
base_path: "{{ base_path }}/{{ promotion_tag }}"
35+
content_guard: release
36+
state: present
37+
38+
- name: Print version tag and os
39+
debug:
40+
msg: "Promoted tag: {{ promotion_tag }}"

0 commit comments

Comments
 (0)