1- name : Build fat image
1+ name : Build nightly image
22on :
33 workflow_dispatch :
44 inputs :
1010 - LEAFCLOUD
1111 - SMS
1212 - ARCUS
13+ schedule :
14+ - cron : ' 0 0 * * *' # Run at midnight
1315
1416jobs :
1517 openstack :
@@ -25,16 +27,16 @@ jobs:
2527 - RL8
2628 - RL9
2729 build :
28- - openstack.openhpc
29- - openstack.openhpc -cuda
30+ - openstack.rocky-latest
31+ - openstack.rocky-latest -cuda
3032 exclude :
3133 - os_version : RL8
32- build : openstack.openhpc -cuda
34+ build : openstack.rocky-latest -cuda
3335
3436 env :
3537 ANSIBLE_FORCE_COLOR : True
3638 OS_CLOUD : openstack
37- CI_CLOUD : ${{ github.event.inputs.ci_cloud }}
39+ CI_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
3840 steps :
3941 - uses : actions/checkout@v2
4042
@@ -77,18 +79,12 @@ jobs:
7779 cd packer/
7880 packer init .
7981
80- if [[ "${{ matrix.build }}" == *"cuda"* ]]; then
81- SOURCE_IMAGE_NAME="rocky-latest-cuda"
82- else
83- SOURCE_IMAGE_NAME="rocky-latest"
84- fi
85-
8682 PACKER_LOG=1 packer build \
8783 -on-error=${{ vars.PACKER_ON_ERROR }} \
8884 -only=${{ matrix.build }} \
8985 -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 }}\"}" \
9186 openstack.pkr.hcl
87+
9288 env :
9389 PKR_VAR_os_version : ${{ matrix.os_version }}
9490
@@ -104,11 +100,23 @@ jobs:
104100 echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
105101 echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
106102
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+
107114 - name : Download image
108115 run : |
109116 . venv/bin/activate
110117 sudo mkdir /mnt/images
111118 sudo chmod 777 /mnt/images
119+ openstack image unset --property signature_verified "${{ steps.manifest.outputs.image-name }}"
112120 openstack image save --file /mnt/images/${{ steps.manifest.outputs.image-name }}.qcow2 ${{ steps.manifest.outputs.image-name }}
113121
114122 - name : Set up QEMU
@@ -151,3 +159,88 @@ jobs:
151159 exit-code : ' 1'
152160 severity : ' CRITICAL'
153161 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