8
8
- master
9
9
- v2.30
10
10
- v2.29
11
+ workflow_dispatch :
11
12
12
13
env :
13
14
IMAGE_REPO : ${{ vars.DOCKERHUB_REPO }}
21
22
jobs :
22
23
23
24
# Migrating workflow causes run number to be reset to 1, offset so our versions don't go back in time.
24
- offset-build-number :
25
+ prepare-workflow :
26
+ if : github.repository_owner == 'open-horizon'
25
27
runs-on : ubuntu-20.04
26
28
outputs :
27
29
BUILD_NUMBER : ${{ steps.offset.outputs.BUILD_NUMBER }}
30
+ ANAX_IMAGE_VERSION : ${{ steps.version.outputs.ANAX_IMAGE_VERSION }}
31
+ CSS_IMAGE_VERSION : ${{ steps.version.outputs.CSS_IMAGE_VERSION }}
32
+ ESS_IMAGE_VERSION : ${{ steps.version.outputs.ESS_IMAGE_VERSION }}
33
+ VERSION_NO_BUILD_NUMBER : ${{ steps.version.outputs.VERSION_NO_BUILD_NUMBER }}
28
34
steps :
29
35
# Ensure that the repo variables and secrets are set before running any other steps
30
36
- name : Check User Set Variables
75
81
run : |
76
82
echo "BUILD_NUMBER=$(($RUN_NUMBER + $RUN_NUMBER_OFFSET))" >> "$GITHUB_OUTPUT"
77
83
84
+ # Checkout our Github repo
85
+ - name : Checkout Github Repo
86
+ uses : actions/checkout@v3
87
+
88
+ # Configure version variables for later steps, stored in our workflow env. variables
89
+ - name : Config Version Variables
90
+ id : version
91
+ run : |
92
+ cd $GITHUB_WORKSPACE
93
+ ./.github/scripts/configure_versions_script.sh
94
+ env :
95
+ BUILD_NUMBER : ${{ steps.offset.outputs.BUILD_NUMBER }}
96
+
97
+ # Prepare files for upload
98
+ - name : Prepare Files for Upload
99
+ run : |
100
+ mkdir $RUNNER_TEMP/files_to_upload
101
+ mkdir $RUNNER_TEMP/files_to_tar && cd $RUNNER_TEMP/files_to_tar
102
+ cp $GITHUB_WORKSPACE/agent-install/agent-uninstall.sh .
103
+ cp $GITHUB_WORKSPACE/agent-install/k8s/* .
104
+ tar -czvf $RUNNER_TEMP/files_to_upload/horizon-agent-edge-cluster-files.tar.gz *.*
105
+ cp $GITHUB_WORKSPACE/agent-install/agent-install.sh $RUNNER_TEMP/files_to_upload
106
+
107
+ # Upload files needed for release management that don't change between runs
108
+ - name : Upload Anax Agent Files
109
+ uses : actions/upload-artifact@v3
110
+ with :
111
+ name : anax-agent-files-v${{ steps.version.outputs.ANAX_IMAGE_VERSION }}
112
+ path : ${{ runner.temp }}/files_to_upload
113
+
78
114
# Builds on Linux: Deb Packages, RPM Packages, Docker images, and pushes to Dockerhub
79
115
linux-build-push :
80
- needs : offset-build-number
116
+ needs : prepare-workflow
81
117
82
118
# The type of runner that the job will run on
83
119
runs-on : ubuntu-20.04
@@ -92,11 +128,11 @@ jobs:
92
128
env :
93
129
arch : ${{ matrix.architecture }}
94
130
os : ${{ matrix.platform }}
95
- BUILD_NUMBER : ${{ needs.offset-build-number .outputs.BUILD_NUMBER }}
96
- ANAX_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
97
- CSS_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
98
- ESS_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
99
- VERSION_NO_BUILD_NUMBER : ' ' # Updated in 'Config Version Variables' step
131
+ BUILD_NUMBER : ${{ needs.prepare-workflow .outputs.BUILD_NUMBER }}
132
+ ANAX_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.ANAX_IMAGE_VERSION }}
133
+ CSS_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.CSS_IMAGE_VERSION }}
134
+ ESS_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.ESS_IMAGE_VERSION }}
135
+ VERSION_NO_BUILD_NUMBER : ${{ needs.prepare-workflow.outputs.VERSION_NO_BUILD_NUMBER }}
100
136
GOPATH : /home/runner/work/anax/anax/go
101
137
102
138
# Steps represent a sequence of tasks that will be executed as part of the job
@@ -155,12 +191,6 @@ jobs:
155
191
run : |
156
192
echo "GO_VERSION=$(go version | awk '{print $3}')" >> $GITHUB_OUTPUT
157
193
158
- # Configure version variables for later steps, stored in our workflow env. variables
159
- - name : Config Version Variables
160
- run : |
161
- cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
162
- ./.github/scripts/configure_versions_script.sh
163
-
164
194
# Increment version, make translation catalogs, build anax binaries for given ARCH and OS
165
195
- name : Build Anax Binaries
166
196
run : |
@@ -298,10 +328,91 @@ jobs:
298
328
cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
299
329
./.github/scripts/docker_push_script.sh
300
330
331
+ # Save Docker Images
332
+ - name : Save Docker Images
333
+ if : (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
334
+ run : |
335
+ mkdir -p $RUNNER_TEMP/images_to_upload && cd $RUNNER_TEMP/images_to_upload
336
+ ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}/.github/scripts/docker_save_script.sh
337
+
338
+ # Upload Agbot Docker Images
339
+ - name : Upload Agbot Docker Images to Artifacts
340
+ if : (matrix.architecture == 'amd64')
341
+ uses : actions/upload-artifact@v3
342
+ with :
343
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_agbot-image-v${{ env.ANAX_IMAGE_VERSION }}
344
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_agbot.tar.gz
345
+
346
+ # Upload Anax Docker Images
347
+ - name : Upload Anax Docker Images to Artifacts
348
+ if : (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
349
+ uses : actions/upload-artifact@v3
350
+ with :
351
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_anax-image-v${{ env.ANAX_IMAGE_VERSION }}
352
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_anax.tar.gz
353
+
354
+ # Upload Anax K8s Docker Images
355
+ - name : Upload Anax K8s Docker Images to Artifacts
356
+ if : (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
357
+ uses : actions/upload-artifact@v3
358
+ with :
359
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_anax_k8s-image-v${{ env.ANAX_IMAGE_VERSION }}
360
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_anax_k8s.tar.gz
361
+
362
+ # Upload Anax K8s Cronjob Docker Images
363
+ - name : Upload Anax K8s Cronjob Docker Images to Artifacts
364
+ if : (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
365
+ uses : actions/upload-artifact@v3
366
+ with :
367
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_auto-upgrade-cronjob_k8s-image-v${{ env.ANAX_IMAGE_VERSION }}
368
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_auto-upgrade-cronjob_k8s.tar.gz
369
+
370
+ # Upload CSS Docker Images
371
+ - name : Upload CSS Docker Images to Artifacts
372
+ if : (matrix.architecture == 'amd64')
373
+ uses : actions/upload-artifact@v3
374
+ with :
375
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_cloud-sync-service-image-v${{ env.CSS_IMAGE_VERSION }}
376
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_cloud-sync-service.tar.gz
377
+
378
+ # Upload ESS Docker Images
379
+ - name : Upload ESS Docker Images to Artifacts
380
+ if : (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
381
+ uses : actions/upload-artifact@v3
382
+ with :
383
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}_edge-sync-service-image-v${{ env.ESS_IMAGE_VERSION }}
384
+ path : ${{ runner.temp }}/images_to_upload/${{ matrix.architecture }}_edge-sync-service.tar.gz
385
+
386
+ # Prep to Upload Packages
387
+ - name : Prepare to Upload Packages
388
+ run : |
389
+ mkdir -p $RUNNER_TEMP/rpm_to_upload
390
+ if [[ ${arch} == 'amd64' ]]; then \
391
+ cp /home/runner/rpmbuild/RPMS/x86_64/*.rpm $RUNNER_TEMP/rpm_to_upload; \
392
+ elif [[ ${arch} == 'ppc64el' || ${arch} == 's390x' ]]; then \
393
+ cp /home/runner/work/anax/anax/RPMS/*.rpm $RUNNER_TEMP/rpm_to_upload; \
394
+ fi
395
+ mkdir -p $RUNNER_TEMP/deb_to_upload
396
+ cp ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}/pkg/deb/debs/*.deb $RUNNER_TEMP/deb_to_upload
397
+
398
+ # Upload RPM Packages
399
+ - name : Upload RPM Packages to Artifacts
400
+ if : (matrix.architecture == 'ppc64el' || matrix.architecture == 'amd64' || matrix.architecture == 's390x')
401
+ uses : actions/upload-artifact@v3
402
+ with :
403
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}-rpm-package-v${{ env.ANAX_IMAGE_VERSION }}
404
+ path : ${{ runner.temp }}/rpm_to_upload/*.rpm
405
+
406
+ # Upload DEB Packages
407
+ - name : Upload DEB Packages to Artifacts
408
+ uses : actions/upload-artifact@v3
409
+ with :
410
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}-deb-package-v${{ env.ANAX_IMAGE_VERSION }}
411
+ path : ${{ runner.temp }}/deb_to_upload/*.deb
301
412
302
413
# Build our mac packages on a macOS runner
303
414
mac-build :
304
- needs : offset-build-number
415
+ needs : prepare-workflow
305
416
306
417
# Do not use any 'xl' version of macos or you will pay (literally)
307
418
# When mac silicon runner comes out we can update this runs-on to ${{ (matrix.architecture == 'amd64') && 'macos-12' || 'macSiliconVersion' }}
@@ -315,17 +426,13 @@ jobs:
315
426
env :
316
427
arch : ${{ matrix.architecture }}
317
428
os : ${{ matrix.platform }}
318
- BUILD_NUMBER : ${{ needs.offset-build-number .outputs.BUILD_NUMBER }}
319
- ANAX_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
320
- CSS_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
321
- ESS_IMAGE_VERSION : ' ' # Updated in 'Config Version Variables' step
322
- VERSION_NO_BUILD_NUMBER : ' ' # Updated in 'Config Version Variables' step
429
+ BUILD_NUMBER : ${{ needs.prepare-workflow .outputs.BUILD_NUMBER }}
430
+ ANAX_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.ANAX_IMAGE_VERSION }}
431
+ CSS_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.CSS_IMAGE_VERSION }}
432
+ ESS_IMAGE_VERSION : ${{ needs.prepare-workflow.outputs.ESS_IMAGE_VERSION }}
433
+ VERSION_NO_BUILD_NUMBER : ${{ needs.prepare-workflow.outputs.VERSION_NO_BUILD_NUMBER }}
323
434
GOPATH : /Users/runner/work/anax/anax/go
324
435
325
- # Specify outputs to be used in our push-macos job
326
- outputs :
327
- ANAX_VERSION : ${{ env.ANAX_IMAGE_VERSION }}
328
-
329
436
steps :
330
437
# Checkout our Github repo
331
438
- name : Checkout Github Repo
@@ -340,12 +447,6 @@ jobs:
340
447
go-version : ' 1.19'
341
448
check-latest : true
342
449
343
- # Configure version variables for later steps, stored in our workflow env. variables
344
- - name : Config Version Variables
345
- run : |
346
- cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
347
- ./.github/scripts/configure_versions_script.sh
348
-
349
450
# Configure the certificates for package signing
350
451
- name : Configure Certificates
351
452
run : |
@@ -399,18 +500,24 @@ jobs:
399
500
env :
400
501
VERSION : ${{ env.VERSION_NO_BUILD_NUMBER }}
401
502
503
+ - name : Add Certificate File to Package Directory
504
+ run : |
505
+ touch ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}/pkg/mac/build/horizon-cli.crt
506
+ echo "$MACPKG_HORIZON_CLI_CRT" >> ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}/pkg/mac/build/horizon-cli.crt
507
+ env :
508
+ MACPKG_HORIZON_CLI_CRT : ${{ secrets.MACPKG_HORIZON_CLI_CRT }}
509
+
402
510
# Upload created package to artifacts to be used in next job
403
511
- name : Upload MacOS Package to Artifacts
404
512
uses : actions/upload-artifact@v3
405
513
with :
406
- name : macos-${{ matrix.architecture }}-package
407
- path : ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/pkg/mac/build/*.pkg
408
-
514
+ name : anax-${{ matrix.platform }}-${{ matrix.architecture }}-mac-package-v${{ env.ANAX_IMAGE_VERSION }}
515
+ path : ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/pkg/mac/build/*
409
516
410
517
# This will push our built mac packages to Dockerhub
411
518
mac-push :
412
519
# Specify that we wait for mac-build to run and create the packages
413
- needs : mac-build
520
+ needs : [prepare-workflow, mac-build]
414
521
415
522
runs-on : ubuntu-20.04
416
523
@@ -456,22 +563,16 @@ jobs:
456
563
password : ${{ secrets.GITHUB_TOKEN }}
457
564
458
565
# Setup a working directory in the temp folder path
459
- - name : Setup Working Directory and add Certificate File
460
- id : workdir_setup
566
+ - name : Setup Working Directory for Mac Package
461
567
run : |
462
568
mkdir $RUNNER_TEMP/macs
463
- touch $RUNNER_TEMP/macs/horizon-cli.crt
464
- echo "$MACPKG_HORIZON_CLI_CRT" >> $RUNNER_TEMP/macs/horizon-cli.crt
465
- echo "PKG_PATH="${RUNNER_TEMP}/macs"" >> $GITHUB_OUTPUT
466
- env :
467
- MACPKG_HORIZON_CLI_CRT : ${{ secrets.MACPKG_HORIZON_CLI_CRT }}
468
569
469
570
# Retrieve artifact from previous job
470
571
- name : Download our MacOS Package Artifact
471
572
uses : actions/download-artifact@v3
472
573
with :
473
- name : macos -${{ matrix.architecture }}-package
474
- path : ${{ steps.workdir_setup.outputs.PKG_PATH }}
574
+ name : anax -${{ matrix.platform }}-${{ matrix. architecture }}-mac- package-v${{ needs.prepare-workflow.outputs.ANAX_IMAGE_VERSION }}
575
+ path : ${{ runner.temp }}/macs
475
576
476
577
# Push our .crt and .pkg to Dockerhub
477
578
- name : Make MacOS Package Tarball and Upload to Dockerhub
@@ -485,10 +586,10 @@ jobs:
485
586
486
587
# Build docker image with only mac tarball
487
588
docker build \
488
- --no-cache \
489
- -t ${IMAGE_REPO}/${{ matrix.architecture }}_anax_macpkg:testing \
490
- -f Dockerfile.macpkg.tarball \
491
- .
589
+ --no-cache \
590
+ -t ${IMAGE_REPO}/${{ matrix.architecture }}_anax_macpkg:testing \
591
+ -f Dockerfile.macpkg.tarball \
592
+ .
492
593
493
594
if [[ "$GITHUB_REF" == 'refs/heads/master' ]]; then
494
595
docker push ${IMAGE_REPO}/${{ matrix.architecture }}_anax_macpkg:testing
@@ -499,4 +600,4 @@ jobs:
499
600
docker push ${IMAGE_REPO}/${{ matrix.architecture }}_anax_macpkg:testing_${GH_BRANCH}
500
601
fi
501
602
env :
502
- ANAX_IMAGE_VERSION : ${{ needs.mac-build .outputs.ANAX_VERSION }}
603
+ ANAX_IMAGE_VERSION : ${{ needs.prepare-workflow .outputs.ANAX_IMAGE_VERSION }}
0 commit comments