mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-31 04:54:21 +01:00
There is a problem with slash-command-action which is on absence of a slash command the job fails (instead of simply ignore, i.e., skip). This is documented on https://github.com/xt0rted/slash-command-action/issues/124. There is a workaround also documented on that issue, but here instead let's get rid of the action. In this new implementation all comments sent to the pull request are parsed, if any starts with "/test_kata-deploy" then the job is triggered. Fixes #2836 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
52 lines
2.2 KiB
YAML
52 lines
2.2 KiB
YAML
on:
|
|
issue_comment:
|
|
types: [created, edited]
|
|
|
|
name: test-kata-deploy
|
|
|
|
jobs:
|
|
create-and-test-container:
|
|
if: |
|
|
github.event.issue.pull_request
|
|
&& github.event_name == 'issue_comment'
|
|
&& github.event.action == 'created'
|
|
&& startsWith(github.event.comment.body, '/test_kata_deploy')
|
|
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} -t quay.io/kata-containers/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
|
|
docker login -u ${{ secrets.QUAY_DEPLOYER_USERNAME }} -p ${{ secrets.QUAY_DEPLOYER_PASSWORD }} quay.io
|
|
docker push quay.io/kata-containers/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 }}
|