|
44 | 44 | echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
|
45 | 45 | shell: bash
|
46 | 46 |
|
47 |
| - - name: Create EC2 credentials if not present |
48 |
| - id: check_creds |
49 |
| - run: | |
50 |
| - . venv/bin/activate |
51 |
| - # List existing EC2 credentials |
52 |
| - existing_creds=$(openstack ec2 credentials list --format json) |
53 |
| -
|
54 |
| - # Check if the list is empty |
55 |
| - if [ "$(echo "$existing_creds" | jq 'length')" -eq 0 ]; then |
56 |
| - echo "No existing EC2 credentials found." |
57 |
| - new_creds=$(openstack ec2 credentials create --format json) |
58 |
| - access_key=$(echo "$new_creds" | jq -r '.Access') |
59 |
| - secret_key=$(echo "$new_creds" | jq -r '.Secret') |
60 |
| - echo "Created new EC2 credentials." |
61 |
| - else |
62 |
| - echo "Existing EC2 credentials found." |
63 |
| - access_key=$(echo "$existing_creds" | jq -r '.[0].Access') |
64 |
| - secret_key=$(echo "$existing_creds" | jq -r '.[0].Secret') |
65 |
| - fi |
66 |
| -
|
67 |
| - # Save access and secret keys for the next step |
68 |
| - echo "access_key=${access_key}" >> $GITHUB_ENV |
69 |
| - echo "secret_key=${secret_key}" >> $GITHUB_ENV |
70 |
| - shell: bash |
71 |
| - |
72 | 47 | - name: Write s3cmd configuration
|
73 | 48 | run: |
|
74 |
| - cat <<EOF > ~/.s3cfg |
75 |
| - [default] |
76 |
| - host_base = https://object.arcus.openstack.hpc.cam.ac.uk |
77 |
| - host_bucket = https://object.arcus.openstack.hpc.cam.ac.uk |
78 |
| - access_key = ${{ env.access_key }} |
79 |
| - secret_key = ${{ env.secret_key }} |
80 |
| - use_https = True |
81 |
| - signurl_use_https = True |
82 |
| - EOF |
| 49 | + echo "${{ secrets['ARCUS_S3_CFG'] }}" > ~/.s3cfg |
83 | 50 | shell: bash
|
84 | 51 |
|
85 | 52 | - name: Install s3cmd
|
|
94 | 61 | echo "TARGET_IMAGE=${TARGET_IMAGE}" >> "$GITHUB_ENV"
|
95 | 62 | echo "target-image-${{ matrix.build }}=${TARGET_IMAGE}" >> "$GITHUB_OUTPUT"
|
96 | 63 |
|
97 |
| - S3_IMAGES=$(s3cmd ls s3://openhpc-images) |
98 |
| - |
| 64 | + S3_IMAGES=$(s3cmd ls s3://openhpc-images-prerelease) |
| 65 | +
|
99 | 66 | if echo "$S3_IMAGES" | grep -q "$TARGET_IMAGE"; then
|
100 | 67 | echo "Image ${TARGET_IMAGE} is already present in S3."
|
101 | 68 | echo "IMAGE_EXISTS=true" >> $GITHUB_ENV
|
|
116 | 83 | if: env.IMAGE_EXISTS == 'false'
|
117 | 84 | run: |
|
118 | 85 | echo "Uploading Image: ${{ env.TARGET_IMAGE }} to S3..."
|
119 |
| - s3cmd put ${{ env.TARGET_IMAGE }}.qcow2 s3://openhpc-images |
| 86 | + s3cmd put ${{ env.TARGET_IMAGE }}.qcow2 s3://openhpc-images-prerelease |
120 | 87 | shell: bash
|
121 | 88 |
|
122 | 89 | image_sync:
|
@@ -168,10 +135,10 @@ jobs:
|
168 | 135 | TARGET_IMAGE=$(jq --arg version "${{ matrix.build }}" -r '.cluster_image[$version]' "${{ env.IMAGE_PATH }}")
|
169 | 136 | echo "TARGET_IMAGE=${TARGET_IMAGE}" >> "$GITHUB_ENV"
|
170 | 137 |
|
171 |
| - - name: Upload latest image if missing |
| 138 | + - name: Download latest image if missing |
172 | 139 | run: |
|
173 | 140 | . venv/bin/activate
|
174 |
| - bash .github/bin/get-s3-image.sh ${{ env.TARGET_IMAGE }} openhpc-images |
| 141 | + bash .github/bin/get-s3-image.sh ${{ env.TARGET_IMAGE }} openhpc-images-prerelease |
175 | 142 |
|
176 | 143 | - name: Cleanup OpenStack Image (on error or cancellation)
|
177 | 144 | if: cancelled()
|
|
0 commit comments