From 450fedbbf24106cd9074e19bb8e2815dcfdb8811 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Tue, 21 Nov 2023 16:40:40 +0800 Subject: [PATCH] test: add test case Signed-off-by: Junjie Gao --- .github/e2e/action.yml | 39 ++++++++++++++++++++------------------ .github/workflows/test.yml | 20 +++++++++++++++++-- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/e2e/action.yml b/.github/e2e/action.yml index 56031419..802b6dc8 100644 --- a/.github/e2e/action.yml +++ b/.github/e2e/action.yml @@ -1,23 +1,26 @@ -name: 'Hello World' -description: 'Greet someone' +name: 'notation-azure-kv E2E testing' +description: 'This is a test action for testing the notation-azure-kv plugin on mltiple platforms.' inputs: - who-to-greet: # id of input - description: 'Who to greet' + pluginDownloadURL: + description: 'Where to download the plugin' + required: true + pluginChecksum: + description: 'The checksum of the plugin' required: true - default: 'World' -outputs: - random-number: - description: "Random number" - value: ${{ steps.random-number-generator.outputs.random-number }} runs: using: "composite" steps: - - run: echo Hello ${{ inputs.who-to-greet }}. - shell: bash - - id: random-number-generator - run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT - shell: bash - - run: echo "${{ github.action_path }}" >> $GITHUB_PATH - shell: bash - - run: goodbye.sh - shell: bash \ No newline at end of file + - name: setup Notation CLI + uses: notaryproject/notation-action/setup@v1 + with: + version: 1.0.1 + - name: self-signed certificate + uses: notaryproject/notation-action/sign@v1 + with: + plugin_name: azure-kv + plugin_url: ${{ inputs.plginDownloadURL }} + plugin_checksum: ${{ inputs.pluginChecksum }} + key_id: https://acrci-test-kv.vault.azure.net/keys/self-signed-pkcs12/70747b2064c0488e936eba7a29acc4c6 + target_artifact_reference: localhost:5000/hello-world:v1 + signature_format: cose + plugin_config: 'self_signed=true' \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24b67fed..4afc74f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,7 +69,23 @@ jobs: - name: Build bianry run: ./scripts/build.sh v0.0.1 linux-x64 - name: Run download server locally - run: nohup python3 ./.github/e2e/e2e-server.py & + run: | + # start the server + nohup python3 ./.github/e2e/e2e-server.py & + + # prepare the environment variables for E2E + artifactName=notation-azure-kv_0.0.1_linux_amd64.tar.gz + checksum=$(shasum -a 256 "./bin/artifacts/$artifactName" | awk '{print $1}') + echo "pluginChecksum=$checksum" >> $GITHUB_ENV + echo "pluginDownloadURL=http://localhost:8080/$artifactName" >> $GITHUB_ENV + + - name: Prepare container registry + run: | + docker run --name registry --rm -d -p 5000:5000 registry:2 + docker pull hello-world:latest + docker tag hello-world:latest localhost:5000/hello-world:v1 + docker push localhost:5000/hello-world:v1 - uses: ./.github/e2e with: - who-to-greet: 'Mona the Octocat' \ No newline at end of file + pluginDownloadURL: ${{ env.pluginDownloadURL }} + pluginChecksum: ${{ env.pluginChecksum }} \ No newline at end of file