1
- name : Build fat image
1
+ name : Build nightly image
2
2
on :
3
3
workflow_dispatch :
4
4
inputs :
10
10
- LEAFCLOUD
11
11
- SMS
12
12
- ARCUS
13
+ schedule :
14
+ - cron : ' 0 0 * * *' # Run at midnight
13
15
14
16
jobs :
15
17
openstack :
@@ -25,16 +27,16 @@ jobs:
25
27
- RL8
26
28
- RL9
27
29
build :
28
- - openstack.openhpc
29
- - openstack.openhpc -cuda
30
+ - openstack.rocky-latest
31
+ - openstack.rocky-latest -cuda
30
32
exclude :
31
33
- os_version : RL8
32
- build : openstack.openhpc -cuda
34
+ build : openstack.rocky-latest -cuda
33
35
34
36
env :
35
37
ANSIBLE_FORCE_COLOR : True
36
38
OS_CLOUD : openstack
37
- CI_CLOUD : ${{ github.event.inputs.ci_cloud }}
39
+ CI_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
38
40
steps :
39
41
- uses : actions/checkout@v2
40
42
@@ -77,18 +79,12 @@ jobs:
77
79
cd packer/
78
80
packer init .
79
81
80
- if [[ "${{ matrix.build }}" == *"cuda"* ]]; then
81
- SOURCE_IMAGE_NAME="rocky-latest-cuda"
82
- else
83
- SOURCE_IMAGE_NAME="rocky-latest"
84
- fi
85
-
86
82
PACKER_LOG=1 packer build \
87
83
-on-error=${{ vars.PACKER_ON_ERROR }} \
88
84
-only=${{ matrix.build }} \
89
85
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
90
- -var "source_image_name={\"${{ matrix.os_version }}\":\"${SOURCE_IMAGE_NAME}-${{ matrix.os_version }}\"}" \
91
86
openstack.pkr.hcl
87
+
92
88
env :
93
89
PKR_VAR_os_version : ${{ matrix.os_version }}
94
90
@@ -104,11 +100,23 @@ jobs:
104
100
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
105
101
echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
106
102
103
+ - name : Delete old latest image
104
+ run : |
105
+ . venv/bin/activate
106
+ IMAGE_COUNT=$(openstack image list --name ${{ steps.manifest.outputs.image-name }} -f value -c ID | wc -l)
107
+ if [ "$IMAGE_COUNT" -gt 1 ]; then
108
+ OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ steps.manifest.outputs.image-name }}" -f value -c ID | head -n 1)
109
+ openstack image delete "$OLD_IMAGE_ID"
110
+ else
111
+ echo "Only one image exists, skipping deletion."
112
+ fi
113
+
107
114
- name : Download image
108
115
run : |
109
116
. venv/bin/activate
110
117
sudo mkdir /mnt/images
111
118
sudo chmod 777 /mnt/images
119
+ openstack image unset --property signature_verified "${{ steps.manifest.outputs.image-name }}"
112
120
openstack image save --file /mnt/images/${{ steps.manifest.outputs.image-name }}.qcow2 ${{ steps.manifest.outputs.image-name }}
113
121
114
122
- name : Set up QEMU
@@ -151,3 +159,88 @@ jobs:
151
159
exit-code : ' 1'
152
160
severity : ' CRITICAL'
153
161
ignore-unfixed : true
162
+
163
+ upload :
164
+ name : upload-nightly-targets
165
+ needs : openstack
166
+ concurrency :
167
+ group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.image }}-${{ matrix.target_cloud }}
168
+ cancel-in-progress : true
169
+ runs-on : ubuntu-22.04
170
+ strategy :
171
+ fail-fast : false
172
+ matrix :
173
+ target_cloud :
174
+ - LEAFCLOUD
175
+ - SMS
176
+ - ARCUS
177
+ os_version :
178
+ - RL8
179
+ - RL9
180
+ image :
181
+ - rocky-latest
182
+ - rocky-latest-cuda
183
+ exclude :
184
+ - os_version : RL8
185
+ image : rocky-latest-cuda
186
+ - target_cloud : LEAFCLOUD
187
+ env :
188
+ OS_CLOUD : openstack
189
+ SOURCE_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
190
+ TARGET_CLOUD : ${{ matrix.target_cloud }}
191
+ IMAGE_NAME : " ${{ matrix.image }}-${{ matrix.os_version }}"
192
+ steps :
193
+ - uses : actions/checkout@v2
194
+
195
+ - name : Record settings for CI cloud
196
+ run : |
197
+ echo SOURCE_CLOUD: ${{ env.SOURCE_CLOUD }}
198
+ echo TARGET_CLOUD: ${{ env.TARGET_CLOUD }}
199
+
200
+ - name : Install openstackclient
201
+ run : |
202
+ python3 -m venv venv
203
+ . venv/bin/activate
204
+ pip install -U pip
205
+ pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
206
+ shell : bash
207
+
208
+ - name : Write clouds.yaml
209
+ run : |
210
+ mkdir -p ~/.config/openstack/
211
+ echo "${{ secrets[format('{0}_CLOUDS_YAML', env.SOURCE_CLOUD)] }}" > ~/.config/openstack/source_clouds.yaml
212
+ echo "${{ secrets[format('{0}_CLOUDS_YAML', env.TARGET_CLOUD)] }}" > ~/.config/openstack/target_clouds.yaml
213
+ shell : bash
214
+
215
+ - name : Download source image
216
+ run :
217
+ . venv/bin/activate
218
+ export OS_CLIENT_CONFIG_FILE=~/.config/openstack/source_clouds.yaml
219
+ openstack image save --file ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}
220
+ shell : bash
221
+
222
+ - name : Upload to target cloud
223
+ run : |
224
+ . venv/bin/activate
225
+ export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
226
+
227
+ openstack image create "${{ env.IMAGE_NAME }}" \
228
+ --file "${{ env.IMAGE_NAME }}" \
229
+ --disk-format qcow2 \
230
+ --container-format bare \
231
+ --public
232
+ shell : bash
233
+
234
+ - name : Delete old latest image from target cloud
235
+ run : |
236
+ . venv/bin/activate
237
+ export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
238
+
239
+ IMAGE_COUNT=$(openstack image list --name ${{ env.IMAGE_NAME }} -f value -c ID | wc -l)
240
+ if [ "$IMAGE_COUNT" -gt 1 ]; then
241
+ OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ env.IMAGE_NAME }}" -f value -c ID | head -n 1)
242
+ openstack image delete "$OLD_IMAGE_ID"
243
+ else
244
+ echo "Only one image exists, skipping deletion."
245
+ fi
246
+ shell : bash
0 commit comments