From 81f389903a0814a2ae5014afa6913c144f960c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 6 Apr 2021 19:01:18 +0200 Subject: [PATCH 1/3] github: Remove kata-deploy-test action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the action is not running because it's broken, and it was broken by 50fea9f. Sadly, I cannot just test a fix on a PR as every single time we end up triggering what's currently on main, rather than triggering the content of the PR itself. With this in mind, let me just remove the file and re-add it as part of a new PR and, hopefully, have it tested in this way. Sorry for the breakage, by the way. Fixes: #1634 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit 1cce9300716035926cf8586f6b266a48f88674d0) --- .github/workflows/kata-deploy-test.yaml | 53 ------------------------- 1 file changed, 53 deletions(-) delete mode 100644 .github/workflows/kata-deploy-test.yaml diff --git a/.github/workflows/kata-deploy-test.yaml b/.github/workflows/kata-deploy-test.yaml deleted file mode 100644 index 8a21514d1a..0000000000 --- a/.github/workflows/kata-deploy-test.yaml +++ /dev/null @@ -1,53 +0,0 @@ -on: issue_comment -name: test-kata-deploy -jobs: - check_comments: - runs-on: ubuntu-latest - steps: - - name: Check for Command - id: command - uses: kata-containers/slash-command-action@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - command: "test-kata-deploy" - reaction: "true" - reaction-type: "eyes" - allow-edits: "false" - permission-level: admin - - name: verify command arg is kata-deploy - run: | - echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'" - create-and-test-container: - needs: check_comments - runs-on: ubuntu-latest - steps: - - name: get-PR-ref - id: get-PR-ref - run: | - ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#') - echo "reference for PR: " ${ref} - echo "##[set-output name=pr-ref;]${ref}" - - uses: actions/checkout@v2-beta - with: - ref: ${{ steps.get-PR-ref.outputs.pr-ref }} - - name: build-container-image - id: build-container-image - run: | - PR_SHA=$(git log --format=format:%H -n1) - VERSION=$(curl https://raw.githubusercontent.com/kata-containers/kata-containers/main/VERSION) - ARTIFACT_URL="https://github.com/kata-containers/kata-containers/releases/download/${VERSION}/kata-static-${VERSION}-x86_64.tar.xz" - wget "${ARTIFACT_URL}" -O ./kata-deploy/kata-static.tar.xz - docker build --build-arg KATA_ARTIFACTS=kata-static.tar.xz -t katadocker/kata-deploy-ci:${PR_SHA} ./kata-deploy - docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - docker push katadocker/kata-deploy-ci:$PR_SHA - echo "##[set-output name=pr-sha;]${PR_SHA}" - - name: test-kata-deploy-ci-in-aks - uses: ./kata-deploy/action - with: - packaging-sha: ${{ steps.build-container-image.outputs.pr-sha }} - env: - PKG_SHA: ${{ steps.build-container-image.outputs.pr-sha }} - AZ_APPID: ${{ secrets.AZ_APPID }} - AZ_PASSWORD: ${{ secrets.AZ_PASSWORD }} - AZ_SUBSCRIPTION_ID: ${{ secrets.AZ_SUBSCRIPTION_ID }} - AZ_TENANT_ID: ${{ secrets.AZ_TENANT_ID }} From c0ca9f9a9087b8eae0e6932637d86a05b746cb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 6 Apr 2021 21:40:21 +0200 Subject: [PATCH 2/3] github: Revert "github: Remove kata-deploy-test action" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This partially reverts commit 1cce9300716035926cf8586f6b266a48f88674d0. As mentioned in #1635, the malformed yaml wouldn't allow us to actually test changes that were supposed to be test by this action. So, this is now reverted and adapted accordingly. Main differences from what we had before: * As it tests kata-deploy itself, not the statically built binaries, let's just use the binaries from 2.0.0 release; * Adapt download and deploy location to the `kata-containers/kata-containers` repo, as the original action was based on 1.x repos; Fixes: #1640 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit eda8da1ec521cfb31e6d60bc548a157b08bad3f6) --- .github/workflows/kata-deploy-test.yaml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/kata-deploy-test.yaml diff --git a/.github/workflows/kata-deploy-test.yaml b/.github/workflows/kata-deploy-test.yaml new file mode 100644 index 0000000000..46de24f438 --- /dev/null +++ b/.github/workflows/kata-deploy-test.yaml @@ -0,0 +1,63 @@ +on: + issue_comment: + types: [created, edited] + +name: test-kata-deploy + +jobs: + check_comments: + if: ${{ github.event.issue.pull_request }} + runs-on: ubuntu-latest + steps: + - name: Check for Command + id: command + uses: kata-containers/slash-command-action@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + command: "test-kata-deploy" + reaction: "true" + reaction-type: "eyes" + allow-edits: "false" + permission-level: admin + - name: verify command arg is kata-deploy + run: | + echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'" + + create-and-test-container: + needs: check_comments + runs-on: ubuntu-latest + steps: + - name: get-PR-ref + id: get-PR-ref + run: | + ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#') + echo "reference for PR: " ${ref} + echo "##[set-output name=pr-ref;]${ref}" + + - name: check out + uses: actions/checkout@v2 + with: + ref: ${{ steps.get-PR-ref.outputs.pr-ref }} + + - name: build-container-image + id: build-container-image + run: | + PR_SHA=$(git log --format=format:%H -n1) + VERSION="2.0.0" + ARTIFACT_URL="https://github.com/kata-containers/kata-containers/releases/download/${VERSION}/kata-static-${VERSION}-x86_64.tar.xz" + wget "${ARTIFACT_URL}" -O tools/packaging/kata-deploy/kata-static.tar.xz + docker build --build-arg KATA_ARTIFACTS=kata-static.tar.xz -t katadocker/kata-deploy-ci:${PR_SHA} ./tools/packaging/kata-deploy + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker push katadocker/kata-deploy-ci:$PR_SHA + echo "##[set-output name=pr-sha;]${PR_SHA}" + + - name: test-kata-deploy-ci-in-aks + uses: ./tools/packaging/kata-deploy/action + with: + packaging-sha: ${{ steps.build-container-image.outputs.pr-sha }} + env: + PKG_SHA: ${{ steps.build-container-image.outputs.pr-sha }} + AZ_APPID: ${{ secrets.AZ_APPID }} + AZ_PASSWORD: ${{ secrets.AZ_PASSWORD }} + AZ_SUBSCRIPTION_ID: ${{ secrets.AZ_SUBSCRIPTION_ID }} + AZ_TENANT_ID: ${{ secrets.AZ_TENANT_ID }} From e7bdeb49b9464d7318967a2e2242a81d6b93b84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 7 Apr 2021 14:46:21 +0200 Subject: [PATCH 3/3] github: Fix slash-command-action usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `/test-kata-deploy` command does **not** work, and the output returned is: ``` Error: Comment didn't contain a valid slash command ``` So, why does this happen? This is the regex used: `^\/([\w]+)\b *(.*)?$`, being the important part of the command "\/([\w]+)\b", with the rest being arguments to it. Okay, `\w` is the key here, as `\w` means: a-z, A-Z, 0-9, including the _. Our command is `/test-kata-deploy`, and `-` is not present as part of `\w`. Knowing this we need to update the command to something like: `/test_kata_deploy` Fixes: #1645 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit 7873b7a1f9b0cb8554f485e5ee3f6a579692d2dc) --- .github/workflows/kata-deploy-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kata-deploy-test.yaml b/.github/workflows/kata-deploy-test.yaml index 46de24f438..228e2246ec 100644 --- a/.github/workflows/kata-deploy-test.yaml +++ b/.github/workflows/kata-deploy-test.yaml @@ -14,7 +14,7 @@ jobs: uses: kata-containers/slash-command-action@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - command: "test-kata-deploy" + command: "test_kata_deploy" reaction: "true" reaction-type: "eyes" allow-edits: "false"