11
11
- SMS
12
12
- ARCUS
13
13
schedule :
14
- - cron : ' 0 0 * * *' # Run at midnight
14
+ - cron : ' 0 0 * * *' # Run at midnight on default branch
15
15
16
16
jobs :
17
17
openstack :
18
18
name : openstack-imagebuild
19
19
concurrency :
20
- group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix. build }} # to branch/PR + OS + build
20
+ group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }} # to branch/PR + OS
21
21
cancel-in-progress : true
22
22
runs-on : ubuntu-22.04
23
23
strategy :
24
24
fail-fast : false # allow other matrix jobs to continue even if one fails
25
25
matrix : # build RL8, RL9
26
- os_version :
27
- - RL8
28
- - RL9
29
26
build :
30
- - openstack.rocky-latest
27
+ - image_name : rocky-latest-RL8
28
+ source_image_name : Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
29
+ inventory_groups : update
30
+ - image_name : rocky-latest-RL9
31
+ source_image_name : Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2
32
+ inventory_groups : update
31
33
env :
32
34
ANSIBLE_FORCE_COLOR : True
33
35
OS_CLOUD : openstack
34
36
CI_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
35
- SOURCE_IMAGES_MAP : |
36
- {
37
- "RL8": "Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2",
38
- "RL9": "Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2"
39
- }
37
+ ARK_PASSWORD : ${{ secrets.ARK_PASSWORD }}
40
38
41
39
steps :
42
40
- uses : actions/checkout@v2
@@ -82,15 +80,13 @@ jobs:
82
80
83
81
PACKER_LOG=1 packer build \
84
82
-on-error=${{ vars.PACKER_ON_ERROR }} \
85
- -only=${{ matrix.build }} \
86
83
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
87
- -var "source_image_name=${{ env.SOURCE_IMAGE }}" \
84
+ -var "source_image_name=${{ matrix.build.source_image_name }}" \
85
+ -var "image_name=${{ matrix.build.image_name }}" \
86
+ -var "image_name_version=" \
87
+ -var "inventory_groups=${{ matrix.build.inventory_groups }}" \
88
88
openstack.pkr.hcl
89
89
90
- env :
91
- PKR_VAR_os_version : ${{ matrix.os_version }}
92
- SOURCE_IMAGE : ${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version] }}
93
-
94
90
- name : Get created image names from manifest
95
91
id : manifest
96
92
run : |
@@ -124,7 +120,7 @@ jobs:
124
120
name : upload-nightly-targets
125
121
needs : openstack
126
122
concurrency :
127
- group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.image }}-${{ matrix.target_cloud }}
123
+ group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }}-${{ matrix.target_cloud }}
128
124
cancel-in-progress : true
129
125
runs-on : ubuntu-22.04
130
126
strategy :
@@ -134,18 +130,15 @@ jobs:
134
130
- LEAFCLOUD
135
131
- SMS
136
132
- ARCUS
137
- os_version :
138
- - RL8
139
- - RL9
140
- image :
141
- - rocky-latest
133
+ build :
134
+ - image_name : rocky-latest-RL8
135
+ - image_name : rocky-latest-RL9
142
136
exclude :
143
137
- target_cloud : LEAFCLOUD
144
138
env :
145
139
OS_CLOUD : openstack
146
140
SOURCE_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
147
141
TARGET_CLOUD : ${{ matrix.target_cloud }}
148
- IMAGE_NAME : " ${{ matrix.image }}-${{ matrix.os_version }}"
149
142
steps :
150
143
- uses : actions/checkout@v2
151
144
@@ -160,42 +153,37 @@ jobs:
160
153
. venv/bin/activate
161
154
pip install -U pip
162
155
pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
163
- shell : bash
164
156
165
157
- name : Write clouds.yaml
166
158
run : |
167
159
mkdir -p ~/.config/openstack/
168
160
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.SOURCE_CLOUD)] }}" > ~/.config/openstack/source_clouds.yaml
169
161
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.TARGET_CLOUD)] }}" > ~/.config/openstack/target_clouds.yaml
170
- shell : bash
171
162
172
163
- name : Download source image
173
164
run : |
174
165
. venv/bin/activate
175
166
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/source_clouds.yaml
176
- openstack image save --file ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}
177
- shell : bash
167
+ openstack image save --file ${{ matrix.build.image_name }} ${{ matrix.build.image_name }}
178
168
179
169
- name : Upload to target cloud
180
170
run : |
181
171
. venv/bin/activate
182
172
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
183
173
184
- openstack image create "${{ env.IMAGE_NAME }}" \
185
- --file "${{ env.IMAGE_NAME }}" \
174
+ openstack image create "${{ matrix.build.image_name }}" \
175
+ --file "${{ matrix.build.image_name }}" \
186
176
--disk-format qcow2 \
187
- shell : bash
188
177
189
178
- name : Delete old latest image from target cloud
190
179
run : |
191
180
. venv/bin/activate
192
181
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
193
182
194
- IMAGE_COUNT=$(openstack image list --name ${{ env.IMAGE_NAME }} -f value -c ID | wc -l)
183
+ IMAGE_COUNT=$(openstack image list --name ${{ matrix.build.image_name }} -f value -c ID | wc -l)
195
184
if [ "$IMAGE_COUNT" -gt 1 ]; then
196
- OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ env.IMAGE_NAME }}" -f value -c ID | head -n 1)
185
+ OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ matrix.build.image_name }}" -f value -c ID | head -n 1)
197
186
openstack image delete "$OLD_IMAGE_ID"
198
187
else
199
188
echo "Only one image exists, skipping deletion."
200
189
fi
201
- shell : bash
0 commit comments