-
Notifications
You must be signed in to change notification settings - Fork 30
627 lines (529 loc) · 23 KB
/
packer.yml
File metadata and controls
627 lines (529 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
name: Build and Push Images
on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
release:
types:
- published
workflow_dispatch:
inputs:
branch:
description: "Branch to use"
required: true
default: "main"
type: string
version:
description: 'Version number (e.g., 1.0.0)'
required: false
type: string
default: ''
short_sha:
description: 'Short commit SHA'
required: false
type: string
default: ''
is_nightly:
description: 'Whether this is a nightly build'
required: false
type: boolean
default: false
env:
PACKER_VERSION: "latest"
QCOW2_IMG: ${{ vars.REGISTRY || 'quay.io' }}/${{ vars.REPO || 'platform9' }}/vjailbreak
UI_IMG: ${{ vars.REGISTRY || 'quay.io' }}/${{ vars.REPO || 'platform9' }}/vjailbreak-ui
V2V_IMG: ${{ vars.REGISTRY || 'quay.io' }}/${{ vars.REPO || 'platform9' }}/vjailbreak-v2v-helper
CONTROLLER_IMG: ${{ vars.REGISTRY || 'quay.io' }}/${{ vars.REPO || 'platform9' }}/vjailbreak-controller
VPWNED_IMG: ${{ vars.REGISTRY || 'quay.io' }}/${{ vars.REPO || 'platform9' }}/vjailbreak-vpwned
NIGHTLY_RELEASE: ${{ github.event.inputs.is_nightly }}
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
jobs:
determine-release:
runs-on: ubuntu-latest
outputs:
is_release: ${{ env.release_found }}
is_nightly: ${{ github.event.inputs.is_nightly }}
tag: ${{ steps.set_env.outputs.tag }}
ui_img: ${{ steps.set_env.outputs.ui_img }}
v2v_img: ${{ steps.set_env.outputs.v2v_img }}
controller_img: ${{ steps.set_env.outputs.controller_img }}
qcow2_img: ${{ steps.set_env.outputs.qcow2_img }}
vpwned_img: ${{ steps.set_env.outputs.vpwned_img }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
fetch-depth: 0
- name: Check PR Title
id: check_pr
run: |
echo "PR message: ${{ github.event.pull_request.title }}"
if [[ "${{ github.event.pull_request.title }}" == *"release"* ]]; then
echo "Release keyword found."
echo "release_found=true" >> $GITHUB_ENV
else
echo "Release keyword not found."
echo "release_found=false" >> $GITHUB_ENV
fi
- name: Check if release event
id: check_release
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "release_found=true" >> $GITHUB_ENV
fi
- name: Check if manual trigger
id: check_manual
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "release_found=true" >> $GITHUB_ENV
fi
- name: Check if nightly build
id: check_nightly
run: |
if [[ "${{ github.event.inputs.is_nightly }}" == "true" ]]; then
echo "is_nightly=true" >> $GITHUB_ENV
echo "is_nightly=true" >> $GITHUB_OUTPUT
fi
- name: Check if PR raised from release branch
id: check_pr_is_from_release_branch
if: github.event.pull_request && startsWith(github.head_ref, 'release-v')
run: |
echo "release_found=true" >> $GITHUB_ENV
- name: Set environment variables for images
id: set_env
run: |
GIT_SHA=$(git rev-parse --short HEAD)
BUILD_VERSION=${{ github.run_number }}
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.short_sha }}" != "" ]]; then
echo "short_sha is provided as ${{ github.event.inputs.short_sha }}"
GIT_SHA=${{ github.event.inputs.short_sha }}
fi
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
echo "version is provided as ${{ github.event.inputs.version }}"
BUILD_VERSION=${{ github.event.inputs.version }}
fi
fi
# Release Event
if [[ "${{ github.event_name }}" == "release" ]]; then
TAG=${{ github.event.release.tag_name }}
# Nightly Build
elif [[ "${{ github.event.inputs.is_nightly }}" == "true" ]]; then
LAST_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
TAG="${LAST_VERSION}-${GIT_SHA}"
# Push and Workflow dispatch
else
TAG="${BUILD_VERSION}-${GIT_SHA}"
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "qcow2_img=${{ env.QCOW2_IMG }}:${TAG}" >> $GITHUB_OUTPUT
echo "ui_img=${{ env.UI_IMG }}:${TAG}" >> $GITHUB_OUTPUT
echo "v2v_img=${{ env.V2V_IMG }}:${TAG}" >> $GITHUB_OUTPUT
echo "controller_img=${{ env.CONTROLLER_IMG }}:${TAG}" >> $GITHUB_OUTPUT
echo "vpwned_img=${{ env.VPWNED_IMG }}:${TAG}" >> $GITHUB_OUTPUT
echo "Final tag generated: ${TAG}"
build-ui:
runs-on: ubuntu-latest
needs: determine-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set environment variables
run: |
echo "UI_IMG=${{ needs.determine-release.outputs.ui_img }}" >> $GITHUB_ENV
- name: Build UI image
run: make ui
- name: Save UI image as tar file
run: |
docker save ${{ env.UI_IMG }} -o ui-image.tar
- name: Upload UI image as artifact
uses: actions/upload-artifact@v4
with:
name: ui-docker-image
path: ui-image.tar
retention-days: 1
build-v2v-helper:
runs-on: ubuntu-latest
needs: determine-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set environment variables
run: |
echo "V2V_IMG=${{ needs.determine-release.outputs.v2v_img }}" >> $GITHUB_ENV
- name: Install libnbd dependencies
run: |
sudo apt-get update
sudo apt-get install -y libguestfs-dev libnbd-dev pkg-config
- name: Build v2v-helper image
run: make v2v-helper
- name: Save v2v-helper image as tar file
run: |
docker save ${{ env.V2V_IMG }} -o v2v-image.tar
- name: Upload v2v-helper image as artifact
uses: actions/upload-artifact@v4
with:
name: v2v-docker-image
path: v2v-image.tar
retention-days: 1
build-controller:
runs-on: ubuntu-latest
needs: determine-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'k8s/migration/go.mod'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set environment variables
run: |
echo "CONTROLLER_IMG=${{ needs.determine-release.outputs.controller_img }}" >> $GITHUB_ENV
echo "V2V_IMG=${{ needs.determine-release.outputs.v2v_img }}" >> $GITHUB_ENV
- name: Build controller image
run: make vjail-controller-only
- name: Save controller image as tar file
run: |
docker save ${{ env.CONTROLLER_IMG }} -o controller-image.tar
- name: Upload controller image as artifact
uses: actions/upload-artifact@v4
with:
name: controller-docker-image
path: controller-image.tar
retention-days: 1
build-vpwned:
runs-on: ubuntu-latest
needs: determine-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set environment variables
run: |
echo "VPWNED_IMG=${{ needs.determine-release.outputs.vpwned_img }}" >> $GITHUB_ENV
- name: Build vpwned image
run: make build-vpwned
- name: Save vpwned image as tar file
run: |
docker save ${{ env.VPWNED_IMG }} -o vpwned-image.tar
- name: Upload vpwned image as artifact
uses: actions/upload-artifact@v4
with:
name: vpwned-docker-image
path: vpwned-image.tar
retention-days: 1
push-images:
runs-on: ubuntu-latest
needs: [determine-release, build-ui, build-v2v-helper, build-controller, build-vpwned]
if: |
always() &&
(needs.build-ui.result == 'success' || needs.build-ui.result == 'skipped') &&
(needs.build-v2v-helper.result == 'success' || needs.build-v2v-helper.result == 'skipped') &&
(needs.build-controller.result == 'success' || needs.build-controller.result == 'skipped') &&
(needs.build-vpwned.result == 'success' || needs.build-vpwned.result == 'skipped') &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Login to Docker Hub
if: ${{ !env.ACT }}
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_PASSWORD }}
- name: Set environment variables
run: |
echo "TAG=${{ needs.determine-release.outputs.tag }}" >> $GITHUB_ENV
echo "UI_IMG=${{ needs.determine-release.outputs.ui_img }}" >> $GITHUB_ENV
echo "V2V_IMG=${{ needs.determine-release.outputs.v2v_img }}" >> $GITHUB_ENV
echo "CONTROLLER_IMG=${{ needs.determine-release.outputs.controller_img }}" >> $GITHUB_ENV
echo "QCOW2_IMG=${{ needs.determine-release.outputs.qcow2_img }}" >> $GITHUB_ENV
echo "VPWNED_IMG=${{ needs.determine-release.outputs.vpwned_img }}" >> $GITHUB_ENV
- name: Download UI image artifact
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: ui-docker-image
path: ./docker-images
- name: Download V2V Helper image artifact
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: v2v-docker-image
path: ./docker-images
- name: Download Controller image artifact
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: controller-docker-image
path: ./docker-images
- name: Download VPWNED image artifact
if: ${{ !env.ACT }}
uses: actions/download-artifact@v4
with:
name: vpwned-docker-image
path: ./docker-images
- name: Load Docker images
if: ${{ !env.ACT }}
run: |
docker load -i ./docker-images/ui-image.tar
docker load -i ./docker-images/v2v-image.tar
docker load -i ./docker-images/controller-image.tar
docker load -i ./docker-images/vpwned-image.tar
- name: Push UI Image
if: ${{ !env.ACT }}
run: docker push ${{ env.UI_IMG }}
- name: Push V2V Helper Image
if: ${{ !env.ACT }}
run: docker push ${{ env.V2V_IMG }}
- name: Push Controller Image
if: ${{ !env.ACT }}
run: docker push ${{ env.CONTROLLER_IMG }}
- name: Push VPWNED Image
if: ${{ !env.ACT }}
run: docker push ${{ env.VPWNED_IMG }}
post-build:
runs-on: ubuntu-latest
needs: [determine-release, build-ui, build-v2v-helper, build-controller, build-vpwned, push-images]
if: |
always() &&
(needs.build-ui.result == 'success' || needs.build-ui.result == 'skipped') &&
(needs.build-v2v-helper.result == 'success' || needs.build-v2v-helper.result == 'skipped') &&
(needs.build-controller.result == 'success' || needs.build-controller.result == 'skipped') &&
(needs.build-vpwned.result == 'success' || needs.build-vpwned.result == 'skipped') &&
(needs.push-images.result == 'success')
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_PASSWORD }}
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Create deploy folder
run: mkdir -p image_builder/deploy
- name: Set environment variables
run: |
echo "TAG=${{ needs.determine-release.outputs.tag }}" >> $GITHUB_ENV
echo "UI_IMG=${{ needs.determine-release.outputs.ui_img }}" >> $GITHUB_ENV
echo "V2V_IMG=${{ needs.determine-release.outputs.v2v_img }}" >> $GITHUB_ENV
echo "CONTROLLER_IMG=${{ needs.determine-release.outputs.controller_img }}" >> $GITHUB_ENV
echo "QCOW2_IMG=${{ needs.determine-release.outputs.qcow2_img }}" >> $GITHUB_ENV
echo "VPWNED_IMG=${{ needs.determine-release.outputs.vpwned_img }}" >> $GITHUB_ENV
if [[ "${{ needs.determine-release.outputs.is_release }}" == "true" ]]; then
echo "release_found=true" >> $GITHUB_ENV
else
echo "release_found=false" >> $GITHUB_ENV
fi
if [[ "${{ needs.determine-release.outputs.is_nightly }}" == "true" ]]; then
echo "is_nightly=true" >> $GITHUB_ENV
else
echo "is_nightly=false" >> $GITHUB_ENV
fi
- name: Substitue image tags in manifests
uses: danielr1996/envsubst-action@1.0.0
with:
input: ./ui/deploy/ui.yaml
output: ./image_builder/deploy/01ui.yaml
- name: Substitue image tags in version config
uses: danielr1996/envsubst-action@1.0.0
with:
input: ./image_builder/configs/version-config.yaml
output: ./image_builder/deploy/version-config.yaml
- name: Set base64-encoded environment variables
run: |
echo "AMPLITUDE_API_KEY=$(echo -n ${{ secrets.AMPLITUDE_API_KEY }} | base64 -w 0)" >> $GITHUB_ENV
echo "BUGSNAG_API_KEY=$(echo -n ${{ secrets.BUGSNAG_API_KEY }} | base64 -w 0)" >> $GITHUB_ENV
echo "VJB_VERSION_TAG=$(echo -n ${{ needs.determine-release.outputs.tag }}| base64 -w 0)" >> $GITHUB_ENV
- name: Substitute image tags in analytics secret
uses: danielr1996/envsubst-action@1.0.0
with:
input: ./image_builder/configs/analytics-keys.yaml
output: ./image_builder/deploy/analytics-keys.yaml
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ">=1.22.5"
- name: Generate Controller Manifests
run: |
make -C ./k8s/migration/ build-installer
cp ./k8s/migration/dist/install.yaml image_builder/deploy/00controller.yaml
cp -r ./k8s/kube-prometheus image_builder/deploy/
- name: setup-oras
uses: oras-project/setup-oras@v1.2.1
- name: Download ubuntu base image
if: env.release_found == 'true' || env.is_nightly == 'true'
run: oras pull quay.io/platform9/vjailbreak:ubuntu-base-prebaked
- name: Configure AWS credentials for S3 download
if: env.release_found == 'true' || env.is_nightly == 'true'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION || 'us-west-2' }}
- name: Download ubuntu base image from S3
if: env.release_found == 'true' || env.is_nightly == 'true'
env:
S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }}
BASE_IMAGE_PATH: "base-image/ubuntu-base-prebaked.qcow2"
run: |
if aws s3 ls "s3://$S3_BUCKET/$BASE_IMAGE_PATH"; then
echo "Base image found in S3. Proceeding to download."
else
echo "Base image not found in S3. Pulling from Quay and uploading..."
oras pull quay.io/platform9/vjailbreak:ubuntu-base-prebaked
aws s3 cp vjailbreak-image.qcow2 "s3://$S3_BUCKET/$BASE_IMAGE_PATH"
echo "Base image successfully uploaded to S3."
fi
echo "Downloading base image for build..."
mkdir -p ./image_builder/images
aws s3 cp "s3://$S3_BUCKET/$BASE_IMAGE_PATH" ./image_builder/images/ubuntu-base-prebaked.qcow2
if [ ! -f "./image_builder/images/ubuntu-base-prebaked.qcow2" ]; then
echo "Error: Failed to download base image from S3"
exit 1
fi
- name: Download images and export as tar
if: env.release_found == 'true' || env.is_nightly == 'true'
run: |
sudo apt-get update && sudo apt-get install -y containerd.
sudo mkdir -p ./image_builder/images
sudo chmod +x ./image_builder/scripts/download_images.sh
sudo ./image_builder/scripts/download_images.sh ${{ env.TAG }}
- name: Copy opensource.txt to image_builder
if: env.release_found == 'true' || env.is_nightly == 'true'
run: cp ./opensource.txt ./image_builder/opensource.txt
- name: Enable KVM group perms
if: env.release_found == 'true' || env.is_nightly == 'true'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up QEMU
if: env.release_found == 'true' || env.is_nightly == 'true'
run: sudo apt-get install qemu-system qemu-utils -y
- name: Setup packer
if: env.release_found == 'true' || env.is_nightly == 'true'
uses: hashicorp/setup-packer@main
id: setup
with:
version: ${{ env.PACKER_VERSION }}
- name: Run packer init
if: env.release_found == 'true' || env.is_nightly == 'true'
id: init
run: "packer init ./image_builder/vjailbreak-image.pkr.hcl"
- name: Run packer validate
if: env.release_found == 'true' || env.is_nightly == 'true'
id: validate
run: "packer validate ./image_builder/vjailbreak-image.pkr.hcl"
- name: setup-oras
if: env.release_found == 'true' || env.is_nightly == 'true'
uses: oras-project/setup-oras@v1.2.1
- name: Run packer build for normal image
if: env.release_found == 'true' || env.is_nightly == 'true'
id: build-1
run: "PACKER_LOG=1 packer build ./image_builder/vjailbreak-image.pkr.hcl"
- name: Upload vjailbreak qcow2 to quay
if: env.release_found == 'true' || env.is_nightly == 'true'
run: |
oras push ${{ env.QCOW2_IMG }} \
--artifact-type="application/qcow2" \
./vjailbreak_qcow2/vjailbreak-image.qcow2
- name: Upload QCOW2 image artifact
if: env.release_found == 'true' || env.is_nightly == 'true'
uses: actions/upload-artifact@v4
with:
name: vjailbreak-qcow2
path: ./vjailbreak_qcow2/vjailbreak-image.qcow2
- name: Set AWS credentials based on build type
id: set-creds
run: |
if [[ "${{ github.event_name }}" == "release" || "${{ github.event.inputs.is_nightly }}" == "true" ]]; then
echo "Using production AWS keys."
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_OUTPUT
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_OUTPUT
else
echo "Using development AWS keys."
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID_DEV }}" >> $GITHUB_OUTPUT
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}" >> $GITHUB_OUTPUT
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ steps.set-creds.outputs.aws_access_key_id }}
aws-secret-access-key: ${{ steps.set-creds.outputs.aws_secret_access_key }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION || 'us-west-2' }}
- name: Determine S3 path and upload artifacts
if: env.release_found == 'true' || env.is_nightly == 'true'
env:
S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_NAME }}
S3_BUCKET_DEV: ${{ secrets.S3_BUCKET_NAME_DEV }}
TAG: ${{ needs.determine-release.outputs.tag }}
run: |
set -e
DATE_FOLDER=$(date -u +"%d-%m-%Y")
if [[ "${{ github.event_name }}" == "release" ]]; then
S3_BUCKET=${S3_BUCKET_PROD}
S3_PATH_PREFIX="releases/${DATE_FOLDER}"
S3_LATEST_PATH_PREFIX="releases/latest"
QCOW2_FILENAME="vjailbreak.qcow2"
CREATE_TAG_FILE=true
elif [[ "${{ github.event.inputs.is_nightly }}" == "true" ]]; then
S3_BUCKET=${S3_BUCKET_PROD}
S3_PATH_PREFIX="nightly_builds/${DATE_FOLDER}"
S3_LATEST_PATH_PREFIX="nightly_builds/latest"
QCOW2_FILENAME="vjailbreak.qcow2"
CREATE_TAG_FILE=true
else
S3_BUCKET=${S3_BUCKET_DEV}
S3_PATH_PREFIX="dev/${DATE_FOLDER}"
QCOW2_FILENAME="${TAG}-vjailbreak.qcow2"
CREATE_TAG_FILE=false
fi
echo "Uploading artifacts to s3://${S3_BUCKET}/${S3_PATH_PREFIX}/"
aws s3 cp ./vjailbreak_qcow2/vjailbreak-image.qcow2 "s3://${S3_BUCKET}/${S3_PATH_PREFIX}/${QCOW2_FILENAME}"
if [[ "$CREATE_TAG_FILE" == "true" ]]; then
TAG_FILENAME="${TAG}.tag"
echo "${TAG}" > ${TAG_FILENAME}
echo "Uploading tag file: ${TAG_FILENAME}"
aws s3 cp ${TAG_FILENAME} "s3://${S3_BUCKET}/${S3_PATH_PREFIX}/${TAG_FILENAME}"
echo "Updating 'latest' folder..."
aws s3 cp ./vjailbreak_qcow2/vjailbreak-image.qcow2 "s3://${S3_BUCKET}/${S3_LATEST_PATH_PREFIX}/${QCOW2_FILENAME}"
aws s3 cp ${TAG_FILENAME} "s3://${S3_BUCKET}/${S3_LATEST_PATH_PREFIX}/${TAG_FILENAME}"
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: vjailbreak-yamls
path: |
image_builder/deploy/00controller.yaml
image_builder/deploy/01ui.yaml
image_builder/deploy/version-config.yaml
image_builder/deploy/vjailbreak-settings.yaml