17
17
openstack :
18
18
name : openstack-imagebuild
19
19
concurrency :
20
- group : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.label }} # to branch/PR + OS
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 :
@@ -130,15 +130,14 @@ jobs:
130
130
- SMS
131
131
- ARCUS
132
132
build :
133
- - label : RL8
134
- - label : RL9
133
+ - image_name : rocky-latest- RL8
134
+ - image_name : rocky-latest- RL9
135
135
exclude :
136
136
- target_cloud : LEAFCLOUD
137
137
env :
138
138
OS_CLOUD : openstack
139
139
SOURCE_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
140
140
TARGET_CLOUD : ${{ matrix.target_cloud }}
141
- IMAGE_NAME : " rocky-latest-${{ matrix.build.label }}"
142
141
steps :
143
142
- uses : actions/checkout@v2
144
143
@@ -153,42 +152,37 @@ jobs:
153
152
. venv/bin/activate
154
153
pip install -U pip
155
154
pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
156
- shell : bash
157
155
158
156
- name : Write clouds.yaml
159
157
run : |
160
158
mkdir -p ~/.config/openstack/
161
159
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.SOURCE_CLOUD)] }}" > ~/.config/openstack/source_clouds.yaml
162
160
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.TARGET_CLOUD)] }}" > ~/.config/openstack/target_clouds.yaml
163
- shell : bash
164
161
165
162
- name : Download source image
166
163
run : |
167
164
. venv/bin/activate
168
165
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/source_clouds.yaml
169
- openstack image save --file ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}
170
- shell : bash
166
+ openstack image save --file ${{ matrix.build.image_name }} ${{ matrix.build.image_name }}
171
167
172
168
- name : Upload to target cloud
173
169
run : |
174
170
. venv/bin/activate
175
171
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
176
172
177
- openstack image create "${{ env.IMAGE_NAME }}" \
178
- --file "${{ env.IMAGE_NAME }}" \
173
+ openstack image create "${{ matrix.build.image_name }}" \
174
+ --file "${{ matrix.build.image_name }}" \
179
175
--disk-format qcow2 \
180
- shell : bash
181
176
182
177
- name : Delete old latest image from target cloud
183
178
run : |
184
179
. venv/bin/activate
185
180
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
186
181
187
- IMAGE_COUNT=$(openstack image list --name ${{ env.IMAGE_NAME }} -f value -c ID | wc -l)
182
+ IMAGE_COUNT=$(openstack image list --name ${{ matrix.build.image_name }} -f value -c ID | wc -l)
188
183
if [ "$IMAGE_COUNT" -gt 1 ]; then
189
- OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ env.IMAGE_NAME }}" -f value -c ID | head -n 1)
184
+ OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ matrix.build.image_name }}" -f value -c ID | head -n 1)
190
185
openstack image delete "$OLD_IMAGE_ID"
191
186
else
192
187
echo "Only one image exists, skipping deletion."
193
188
fi
194
- shell : bash
0 commit comments