2020 unit-tests :
2121 strategy :
2222 matrix :
23- os : [ ubuntu-latest, macos-11 ]
23+ os : [ ubuntu-latest ]
2424 runs-on : ${{ matrix.os }}
2525 steps :
2626 - uses : actions/checkout@v3
@@ -255,92 +255,6 @@ jobs:
255255 path : |
256256 .github/hosted-runner/arm64/terraform.tfstate
257257 retention-days : 1
258-
259- spinup-amd64-runner :
260- needs : [ prebuild-package ]
261- runs-on : ubuntu-latest
262- outputs :
263- runner_token : ${{ steps.token.outputs.runner }}
264- runner_label : ${{ env.RUNNER_LABEL }}
265- if : github.event_name != 'pull_request'
266- steps :
267- - name : Checkout
268- uses : actions/checkout@v3
269-
270- - name : Generate runner token
271- id : token
272- run : |
273- curl -X POST -H "authorization: Bearer ${{ secrets.BOT_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/orb-community/pktvisor/actions/runners/registration-token -o token.json
274- echo "::set-output name=runner::$(cat token.json | jq .token --raw-output )"
275- cat token.json
276-
277- - name : Get short commit hash to a variable
278- id : commit_hash
279- run : |
280- echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
281-
282- - name : Inject runner token in user_data.sh
283- run : |
284- cd .github/hosted-runner/amd64/
285- ESCAPED_REPLACE_RUNNER_TOKEN=$(printf '%s\n' "${{ steps.token.outputs.runner }}" | sed -e 's/[\/&]/\\&/g')
286- sed -i -e "s/RUNNER_TOKEN/$ESCAPED_REPLACE_RUNNER_TOKEN/g" user_data.sh
287- ESCAPED_REPLACE_RUNNER_NAME=$(printf '%s\n' "${{ steps.commit_hash.outputs.sha_short }}-amd64" | sed -e 's/[\/&]/\\&/g')
288- sed -i -e "s/AMD64_RUNNER/$ESCAPED_REPLACE_RUNNER_NAME/g" user_data.sh
289- ESCAPED_REPLACE_RUNNER_LABEL=$(printf '%s\n' "${{ steps.commit_hash.outputs.sha_short }}-amd64" | sed -e 's/[\/&]/\\&/g')
290- sed -i -e "s/RUNNER_LABEL/$ESCAPED_REPLACE_RUNNER_LABEL/g" user_data.sh
291- echo "RUNNER_LABEL=${{ steps.commit_hash.outputs.sha_short }}-amd64" >> $GITHUB_ENV
292-
293- - name : Inject AWS key
294- run : |
295- cd .github/hosted-runner/amd64/
296- ESCAPED_REPLACE_KEY_ID=$(printf '%s\n' "${{ secrets.AWS_ACCESS_KEY_ID }}" | sed -e 's/[\/&]/\\&/g')
297- sed -i -e "s/AWSID/$ESCAPED_REPLACE_KEY_ID/g" vars.tf
298- ESCAPED_REPLACE_ACCESS_KEY=$(printf '%s\n' "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | sed -e 's/[\/&]/\\&/g')
299- sed -i -e "s/AWSSECRET/$ESCAPED_REPLACE_ACCESS_KEY/g" vars.tf
300- ESCAPED_REPLACE_ENVIRONMENT=$(printf '%s\n' "${{ needs.prebuild-package.outputs.branch_name }}-${{ steps.commit_hash.outputs.sha_short }}-release" | sed -e 's/[\/&]/\\&/g')
301- sed -i -e "s/ENVIRONMENT/$ESCAPED_REPLACE_ENVIRONMENT/g" vars.tf
302-
303- - name : setup terraform
304- uses : hashicorp/setup-terraform@v2
305- with :
306- terraform_version : 1.1.7
307- terraform_wrapper : false
308-
309- - name : Terraform Init
310- run : |
311- cd .github/hosted-runner/amd64/
312- terraform init -input=false
313-
314- - name : Terraform plan
315- run : |
316- cd .github/hosted-runner/amd64/
317- terraform plan -out=tfplan
318-
319- - name : Terraform apply
320- run : |
321- cd .github/hosted-runner/amd64/
322- terraform apply -auto-approve tfplan
323-
324- - name : Terraform output
325- run : |
326- cd .github/hosted-runner/amd64/
327- terraform output -raw ip > ip.txt
328-
329- - name : Persist IP to workspace
330- uses : actions/upload-artifact@v2
331- with :
332- name : ip
333- path : |
334- .github/hosted-runner/amd64/ip.txt
335- retention-days : 1
336-
337- - name : Persist to workspace
338- uses : actions/upload-artifact@v2
339- with :
340- name : terraform2
341- path : |
342- .github/hosted-runner/amd64/terraform.tfstate
343- retention-days : 1
344258
345259 build-win64 :
346260 # The CMake configure and build commands are platform agnostic and should work equally
@@ -428,7 +342,7 @@ jobs:
428342 retention-days : 1
429343
430344 build-cli-win64 :
431- needs : [ build-win64 ]
345+ needs : [ build-win64, release ]
432346 runs-on : ubuntu-latest
433347 steps :
434348 - name : Checkout code
@@ -592,80 +506,6 @@ jobs:
592506 docker image ls -a
593507 docker push ${{ env.IMAGE_NAME }}:release-arm64
594508
595- package-armv7 :
596- needs : [ spinup-amd64-runner ]
597- runs-on : ${{ needs.spinup-amd64-runner.outputs.runner_label }}
598- if : github.event_name != 'pull_request'
599- steps :
600- - name : Attach to workspace
601- uses : actions/download-artifact@v2
602- with :
603- name : workspace
604-
605- - name : Get branch name
606- shell : bash
607- run : echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
608-
609- - name : Debug branch name
610- run : echo ${{ env.BRANCH_NAME }}
611-
612- - name : Get VERSION
613- run : |
614- echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
615- - name : Debug version
616- run : echo ${{ env.VERSION }}
617-
618- - name : Generate ref tag (master)
619- if : ${{ env.BRANCH_NAME == 'master' }}
620- run : |
621- echo "REF_TAG=latest" >> $GITHUB_ENV
622- echo "PRERELEASE=false" >> $GITHUB_ENV
623- echo "DRAFT=true" >> $GITHUB_ENV
624- - name : Debug ref tag
625- run : echo ${{ env.REF_TAG }}
626-
627- - name : Login to GitHub Container Registry
628- uses : docker/login-action@v1
629- with :
630- registry : ghcr.io
631- username : ${{ github.repository_owner }}
632- password : ${{ secrets.GITHUB_TOKEN }}
633-
634- - name : Replace token
635- run : |
636- sed -i -e "s/CP_TOKEN/${{ secrets.CRASHPAD_TOKEN }}/g" docker/run.sh
637- - name : Replace escape url
638- run : |
639- REPLACE=${{ secrets.BUGSPLAT_CP_URL }}
640- ESCAPED_REPLACE=$(printf '%s\n' "$REPLACE" | sed -e 's/[\/&]/\\&/g')
641- sed -i -e "s/CP_URL/$ESCAPED_REPLACE/g" docker/run.sh
642-
643- - name : Set up QEMU
644- uses : docker/setup-qemu-action@v2
645-
646- - name : Set up Docker Buildx
647- id : buildx
648- uses : docker/setup-buildx-action@v2
649-
650- - name : Build + push - pktvisor (multi-arch)
651- env :
652- IMAGE_NAME : ghcr.io/orb-community/pktvisor
653- uses : docker/build-push-action@v3
654- with :
655- builder : ${{ steps.buildx.outputs.name }}
656- context : .
657- file : ./docker/Dockerfile
658- platforms : linux/arm/v7
659- tags : ${{ env.IMAGE_NAME }}:release-armv7
660- outputs : type=docker,dest=/tmp/armv7.tar
661-
662- - name : Load image
663- env :
664- IMAGE_NAME : ghcr.io/orb-community/pktvisor
665- run : |
666- docker load --input /tmp/armv7.tar
667- docker image ls -a
668- docker push ${{ env.IMAGE_NAME }}:release-armv7
669509
670510 package-amd64 :
671511 needs : [ prebuild-package ]
@@ -866,88 +706,8 @@ jobs:
866706 cd .github/hosted-runner/arm64/
867707 terraform destroy -auto-approve
868708
869- remove-github-runner-amd64 :
870- continue-on-error : true
871- needs : [ package-armv7 ]
872- runs-on : ubuntu-latest
873- if : github.event_name != 'pull_request'
874- steps :
875- - name : Attach to workspace
876- uses : actions/download-artifact@v2
877- with :
878- name : ip
879-
880- - name : Get runner ip
881- id : address
882- run : |
883- ls -lha
884- echo "::set-output name=ip::$(cat ip.txt)"
885-
886- - name : Generate remove runner token
887- id : remove-token-amd64
888- run : |
889- curl -X POST -H "authorization: Bearer ${{ secrets.BOT_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/orb-community/pktvisor/actions/runners/remove-token -o token.json
890- echo "::set-output name=remove-runner::$(cat token.json | jq .token --raw-output )"
891- cat token.json
892- echo "TOKEN_RUNNER_AMD64=$(cat token.json | jq .token --raw-output )" >> $GITHUB_ENV
893-
894- - name : Executing remote ssh commands on runner
895- uses : appleboy/ssh-action@master
896- with :
897- host : ${{ steps.address.outputs.ip }}
898- username : ubuntu
899- key : ${{ secrets.RUNNER_SSH_KEY }}
900- port : 22
901- script : |
902- cd /actions-runner
903- sudo chmod 777 . -R
904- ./config.sh remove --token ${{ env.TOKEN_RUNNER_AMD64 }}
905-
906- remove-amd64-runner :
907- needs : [ remove-github-runner-amd64 ]
908- runs-on : ubuntu-latest
909- if : github.event_name != 'pull_request'
910- steps :
911- - name : Checkout
912- uses : actions/checkout@v3
913-
914- - name : Attach to workspace
915- uses : actions/download-artifact@v2
916- with :
917- name : terraform2
918- path : .github/hosted-runner/amd64/
919-
920- - name : Inject AWS key
921- run : |
922- cd .github/hosted-runner/amd64/
923- ESCAPED_REPLACE_KEY_ID=$(printf '%s\n' "${{ secrets.AWS_ACCESS_KEY_ID }}" | sed -e 's/[\/&]/\\&/g')
924- sed -i -e "s/AWSID/$ESCAPED_REPLACE_KEY_ID/g" vars.tf
925- ESCAPED_REPLACE_ACCESS_KEY=$(printf '%s\n' "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | sed -e 's/[\/&]/\\&/g')
926- sed -i -e "s/AWSSECRET/$ESCAPED_REPLACE_ACCESS_KEY/g" vars.tf
927-
928- - name : setup terraform
929- uses : hashicorp/setup-terraform@v2
930- with :
931- terraform_version : 1.1.7
932-
933- - name : Terraform Init
934- run : |
935- cd .github/hosted-runner/amd64/
936- terraform init -input=false
937-
938- - name : Terraform plan destroy
939- run : |
940- cd .github/hosted-runner/amd64/
941- terraform plan -destroy
942- continue-on-error : true
943-
944- - name : Terraform destroy
945- run : |
946- cd .github/hosted-runner/amd64/
947- terraform destroy -auto-approve
948-
949709 pushing-manifests :
950- needs : [ package-amd64 , package-arm64 , package-armv7 ]
710+ needs : [ package-amd64 , package-arm64 ]
951711 runs-on : ubuntu-latest
952712 if : github.event_name != 'pull_request'
953713 steps :
@@ -962,7 +722,6 @@ jobs:
962722 run : |
963723 docker manifest create ghcr.io/orb-community/pktvisor:latest \
964724 ghcr.io/orb-community/pktvisor:release-amd64 \
965- ghcr.io/orb-community/pktvisor:release-armv7 \
966725 ghcr.io/orb-community/pktvisor:release-arm64
967726
968727 - name : Push manifest to ghcr.io
0 commit comments