From 198137e2650ba79820a61b06e03481335da3b435 Mon Sep 17 00:00:00 2001 From: Hector Cao <122458375+hector-cao@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:55:27 +0200 Subject: [PATCH] gh action to publish the provider snap (#241) * gh action to publish the provider snap * rename checkbox provider from checkbox-tdx-classic to checkbox-tdx --- .github/workflows/create-snap-action.yml | 22 +++++++++++++++++++ tests/README.md | 16 +++++++------- tests/checkbox/bin/checkbox-cli-wrapper | 2 +- tests/checkbox/bin/checkbox-cli-wrapper-image | 2 +- tests/checkbox/bin/checkbox-cli-wrapper-local | 2 +- tests/snap/hooks/configure | 4 ++-- tests/snap/snapcraft.yaml | 6 ++--- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/.github/workflows/create-snap-action.yml b/.github/workflows/create-snap-action.yml index b0fa1038..090c86b1 100644 --- a/.github/workflows/create-snap-action.yml +++ b/.github/workflows/create-snap-action.yml @@ -17,8 +17,21 @@ on: jobs: + check-secret: + runs-on: ubuntu-22.04 + outputs: + snap-key: ${{ steps.snap-key.outputs.defined }} + steps: + - id: snap-key + name: Set defined=true if SNAPCRAFT7_CREDS is defined + if: "${{ env.SNAPSTORE_KEY != '' }}" + run: echo "defined=true" >> $GITHUB_OUTPUT + env: + SNAPSTORE_KEY: ${{ secrets.SNAPCRAFT7_CREDS }} + build: runs-on: ubuntu-22.04 + needs: [check-secret] steps: - uses: actions/checkout@v4 name: Checkout @@ -34,3 +47,12 @@ jobs: run: | sudo snap install checkbox22 sudo snap install --dangerous --classic ${{ steps.build.outputs.snap }} + + - if: needs.check-secret.outputs.snap-key == 'true' && (github.ref_name == 'noble-24.04') + name: Publish snap to edge channel + uses: snapcore/action-publish@v1.2.0 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }} + with: + snap: ${{ steps.build.outputs.snap }} + release: edge diff --git a/tests/README.md b/tests/README.md index 9aa54270..dbb0b4fe 100644 --- a/tests/README.md +++ b/tests/README.md @@ -72,43 +72,43 @@ Go to the `tests` folder. ``` $ snapcraft -$ sudo snap install ./checkbox-tdx-classic_2.0_amd64.snap --dangerous --classic +$ sudo snap install ./checkbox-tdx_1.0.0_amd64.snap --dangerous --classic ``` - Run sanity tests to check the host setup: ``` -$ checkbox-tdx-classic.test-runner-automated-host +$ checkbox-tdx.test-runner-automated-host ``` - Run guest tests: ``` -$ checkbox-tdx-classic.test-runner-automated-guest +$ checkbox-tdx.test-runner-automated-guest ``` - Run boot tests: ``` -$ checkbox-tdx-classic.test-runner-automated-boot +$ checkbox-tdx.test-runner-automated-boot ``` - Run perf tests: ``` -$ checkbox-tdx-classic.test-runner-automated-perf +$ checkbox-tdx.test-runner-automated-perf ``` - Run quote tests: ``` -$ checkbox-tdx-classic.test-runner-automated-quote +$ checkbox-tdx.test-runner-automated-quote ``` - Run stress tests: ``` -$ checkbox-tdx-classic.test-runner-automated-stress +$ checkbox-tdx.test-runner-automated-stress ``` - Run all tests: @@ -116,7 +116,7 @@ $ checkbox-tdx-classic.test-runner-automated-stress Please note that the performance tests can take a long time to run. ``` -$ checkbox-tdx-classic.test-runner-automated +$ checkbox-tdx.test-runner-automated ``` diff --git a/tests/checkbox/bin/checkbox-cli-wrapper b/tests/checkbox/bin/checkbox-cli-wrapper index 8afa9e75..372b91ec 100755 --- a/tests/checkbox/bin/checkbox-cli-wrapper +++ b/tests/checkbox/bin/checkbox-cli-wrapper @@ -1,7 +1,7 @@ #!/bin/sh # Remove temporary folder and rebuild in setup-env-and-run -TMP_FOLDER=/tmp/snap/checkbox-tdx-classic +TMP_FOLDER=/tmp/snap/checkbox-tdx rm -rf ${TMP_FOLDER} # wrapper around the checkbox-cli diff --git a/tests/checkbox/bin/checkbox-cli-wrapper-image b/tests/checkbox/bin/checkbox-cli-wrapper-image index fef56353..4c326f77 100755 --- a/tests/checkbox/bin/checkbox-cli-wrapper-image +++ b/tests/checkbox/bin/checkbox-cli-wrapper-image @@ -14,7 +14,7 @@ if ! test -f $TDXTEST_GUEST_IMG; then fi # Remove temporary folder and rebuild in setup-env-and-run -TMP_FOLDER=/tmp/snap/checkbox-tdx-classic +TMP_FOLDER=/tmp/snap/checkbox-tdx rm -rf ${TMP_FOLDER} # wrapper around the checkbox-cli diff --git a/tests/checkbox/bin/checkbox-cli-wrapper-local b/tests/checkbox/bin/checkbox-cli-wrapper-local index 375182ef..8cbe5007 100755 --- a/tests/checkbox/bin/checkbox-cli-wrapper-local +++ b/tests/checkbox/bin/checkbox-cli-wrapper-local @@ -1,7 +1,7 @@ #!/bin/sh # Remove temporary folder and rebuild in setup-env-and-run -TMP_FOLDER=/tmp/snap/checkbox-tdx-classic +TMP_FOLDER=/tmp/snap/checkbox-tdx rm -rf ${TMP_FOLDER} # wrapper around the checkbox-cli diff --git a/tests/snap/hooks/configure b/tests/snap/hooks/configure index 0c66cba4..6478efe2 100755 --- a/tests/snap/hooks/configure +++ b/tests/snap/hooks/configure @@ -18,13 +18,13 @@ STRESS_S3_WAIT_DELAY=60 To change those values use the configure launcher. E.g. - $ checkbox-kivu-classic.configure OPEN_N_SSID=my-wifi + $ checkbox-tdx.configure OPEN_N_SSID=my-wifi If you __really__ need to change those values using `snap set` command, you need to change CAPS to lowercase and underscores to dashes (-). E.g. - $ snap set checkbox-kivu-classic open-n-ssid=my-wifi + $ snap set checkbox-tdx open-n-ssid=my-wifi """ import os diff --git a/tests/snap/snapcraft.yaml b/tests/snap/snapcraft.yaml index dc723d3e..cf8718b1 100644 --- a/tests/snap/snapcraft.yaml +++ b/tests/snap/snapcraft.yaml @@ -1,15 +1,15 @@ -name: checkbox-tdx-classic +name: checkbox-tdx summary: Checkbox tests for TDX description: | Collection of tests for Intel TDX (Trusted Domain eXtension) -version: '2.0' +version: '1.0.0' confinement: classic grade: stable base: core22 # Here are the available applications of the TDX checkbox provider snap -# To run : snap run checkbox-tdx-classic. +# To run : snap run checkbox-tdx. # # checkbox-cli: # - checkbox client, can be used to talk to the checkbox daemon