Skip to content

Fix nodetool execution #243

Fix nodetool execution

Fix nodetool execution #243

Workflow file for this run

name: Run e2e tests
on:
workflow_dispatch:
issue_comment:
types:
- created
env:
KUTTL_VERSION: 0.11.0
jobs:
casskop-image:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' || (
github.event.issue.pull_request &&
github.event.comment.user.login == github.repository_owner &&
contains(github.event.comment.body, '/kuttl-tests')
)
permissions:
packages: write
steps:
- id: lower-repo
shell: pwsh
run: |
"::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())"
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get PR branch name
id: get-branch
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]
then
echo ::set-output name=branch::$(gh pr view ${{ github.event.issue.number }} --repo $REPO --json headRefName --jq '.headRefName')
else
echo ::set-output name=branch::${{ github.ref_name }}
fi
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/casskop/Dockerfile
tags: ghcr.io/${{ steps.lower-repo.outputs.repository }}:${{ steps.get-branch.outputs.branch }}
push: true
install-kuttl:
needs: casskop-image
runs-on: ubuntu-latest
steps:
- name: Cache Kuttl
id: cache-kuttl
uses: actions/[email protected]
with:
path: kuttl
key: ${{ runner.os }}-kuttl-${{ env.KUTTL_VERSION }}
- name: download-kuttl
if: steps.cache-kuttl.outputs.cache-hit != 'true'
run: |
curl -L https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_i386 -o kuttl
kuttl-casskop:
needs: install-kuttl
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
test-name: [operations, sidecars, scaling, multi-dcs, backup-restore]
steps:
- id: lower-repo
shell: pwsh
run: |
"::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())"
- name: Get PR branch name
id: get-branch
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]
then
echo ::set-output name=branch::$(gh pr view ${{ github.event.issue.number }} --repo $REPO --json headRefName --jq '.headRefName')
else
echo ::set-output name=branch::${{ github.ref_name }}
fi
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ steps.get-branch.outputs.branch }}
- uses: rinx/[email protected]
with:
version: v5.4.0
options: --image rancher/k3s:v1.24.13-k3s1
- uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Restore Kuttl
id: cache-kuttl
uses: actions/[email protected]
with:
path: kuttl
key: ${{ runner.os }}-kuttl-${{ env.KUTTL_VERSION }}
- name: Add aws-backup-secrets with S3
if: matrix.test-name == 'backup-restore'
working-directory: test/kuttl
run: |
cat <<EOF >> backup-restore/00-createCluster.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: aws-backup-secrets
type: Opaque
stringData:
awsaccesskeyid: ${{ secrets.AWS_ACCESS_KEY_ID }}
awssecretaccesskey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
awsregion: us-west-2
EOF
cat <<EOF >> backup-restore/00-assert.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: aws-backup-secrets
EOF
- name: Run kuttl tests
run: |
chmod u+x kuttl
PATH=$PWD:$PATH
helm install casskop charts/casskop --set image.tag=${{ steps.get-branch.outputs.branch }} --set image.repository=ghcr.io/${{ steps.lower-repo.outputs.repository }}
cd test/kuttl/
kuttl test --test ${{ matrix.test-name }} --namespace default --skip-delete