Skip to content

Commit 08f1d15

Browse files
committed
just use workflow_dispatch
1 parent 0b9a219 commit 08f1d15

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

.github/bin/get-s3-image.sh

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,23 @@ set -x
44

55
# Variables (adjust these paths as necessary)
66
S3_BUCKET="s3://openhpc-images"
7-
APPLIANCES_ENVIRONMENT_ROOT="$APPLIANCES_ENVIRONMENT_ROOT"
8-
MAIN_TF="$APPLIANCES_ENVIRONMENT_ROOT/terraform/main.tf"
97

108
for IMAGE_OS in $IMAGE_LIST; do
11-
echo "Extracting CI image name from $MAIN_TF"
12-
ci_image=$(grep -oP 'openhpc-[0-9a-zA-Z-]+' "$MAIN_TF" | grep $IMAGE_OS)
9+
10+
image_name=$1
11+
echo "Checking if image $image_name exists in OpenStack"
12+
image_exists=$(openstack image list --name "$image_name" -f value -c Name)
1313

14-
echo "Checking if image $ci_image exists in OpenStack"
15-
image_exists=$(openstack image list --name "$ci_image" -f value -c Name)
16-
17-
if [ "$image_exists" == "$ci_image" ]; then
18-
echo "Image $ci_image already exists in OpenStack."
14+
if [ "$image_exists" == "$image_name" ]; then
15+
echo "Image $image_name already exists in OpenStack."
1916
else
20-
echo "Image $ci_image not found in OpenStack. Getting it from S3."
17+
echo "Image $image_name not found in OpenStack. Getting it from S3."
2118

22-
wget https://object.arcus.openstack.hpc.cam.ac.uk/swift/v1/AUTH_3a06571936a0424bb40bc5c672c4ccb1/openhpc-images/$ci_image
19+
wget https://object.arcus.openstack.hpc.cam.ac.uk/swift/v1/AUTH_3a06571936a0424bb40bc5c672c4ccb1/openhpc-images/$image_name
2320

24-
echo "Uploading image $ci_image to OpenStack..."
25-
openstack image create --file "$ci_image.qcow2" --disk-format qcow2 "$ci_image"
21+
echo "Uploading image $image_name to OpenStack..."
22+
openstack image create --file "$image_name.qcow2" --disk-format qcow2 "$image_name"
2623

27-
echo "Image $ci_image has been uploaded to OpenStack."
24+
echo "Image $image_name has been uploaded to OpenStack."
2825
fi
2926
done

.github/workflows/upload-release-image.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22
name: Upload release images to client sites from s3
33
on:
44
workflow_dispatch:
5-
push:
6-
branches:
7-
- main
8-
- master
9-
- feat/fatimage-auto-upload
5+
inputs:
6+
image_name:
7+
type: string
8+
description: Image name from https://object.arcus.openstack.hpc.cam.ac.uk/swift/v1/AUTH_3a06571936a0424bb40bc5c672c4ccb1/openhpc-images/
9+
required: true
10+
11+
# push:
12+
# branches:
13+
# - main
14+
# - master
15+
# - feat/fatimage-auto-upload
1016

1117
jobs:
1218
image_upload:
1319
runs-on: ubuntu-22.04
1420
concurrency: ${{ github.ref }}
1521
env:
1622
OS_CLOUD: openstack
17-
CI_CLOUD: ${{ vars.CI_CLOUD }}
1823
IMAGE_LIST: "RL8 RL9"
1924
steps:
20-
- uses: actions/checkout@v2
21-
22-
- name: Record which cloud CI is running on
23-
run: |
24-
echo CI_CLOUD: ${{ vars.CI_CLOUD }}
25+
- uses: actions/checkout@v4
2526

2627
- name: Write clouds.yaml
2728
run: |
@@ -31,11 +32,9 @@ jobs:
3132

3233
- name: Upload latest image if missing
3334
run: |
34-
/usr/bin/python3.10 -m venv venv
35+
python3 -m venv venv
3536
. venv/bin/activate
3637
pip install -U pip
37-
pip install -r requirements.txt
38-
ansible --version
38+
pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
3939
. environments/.stackhpc/activate
40-
ansible-galaxy collection install openstack.cloud
41-
. .github/bin/get-s3-image.sh -o
40+
bash .github/bin/get-s3-image.sh ${{ inputs.image_name }}

0 commit comments

Comments
 (0)