feat: add chainsaw based e2e tests #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Action - Build and Test | |
description: "Build and test the operator (with optional e2e tests)" | |
inputs: | |
run-e2e: | |
description: "Run e2e tests" | |
required: false | |
default: false | |
go-version: | |
description: "Go version to use" | |
required: false | |
default: "${{ env.GO_VERSION }}" | |
runs: | |
using: "composite" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: debianmaster/actions-k3s@master | |
id: k3s | |
with: | |
version: 'latest' | |
- run: | | |
kubectl get nodes | |
kubectl get pods -A | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ inputs.go-version }} | |
- name: Build | |
run: make build | |
- name: Lint | |
run: make lint | |
- name: Setup Envtest | |
run: make envtest | |
- name: Test | |
run: make test | |
- name: Build the Docker image | |
run: make docker-build | |
- name: Deploy controller to local cluster | |
env: | |
# deploy with 1-click demo mode when not running e2e tests | |
DEPLOY_ONE_CLICK_DEMO_MODE: ${{ inputs.run-e2e && 'false' || 'true' }} | |
NGROK_API_KEY: ${{ github.repository == 'ngrok/ngrok-operator' && secrets.NGROK_CI_API_KEY || 'fake-api-key' }} | |
NGROK_AUTHTOKEN: ${{ github.repository == 'ngrok/ngrok-operator' && secrets.NGROK_CI_AUTHTOKEN || 'fake-authtoken' }} | |
E2E_BINDING_NAME: k8s/e2e-${{ github.run_id }} | |
run: | | |
# create some namespaces for bindings tests | |
kubectl create ns e2e || true | |
# deploy ngrok-op for e2e tests | |
make deploy_for_e2e | |
- name: Check if controller is up | |
run: | | |
kubectl get nodes | |
kubectl get pods -A | |
- name: Install cosign | |
if: inputs.run-e2e | |
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- name: Install chainsaw | |
if: inputs.run-e2e | |
uses: kyverno/action-install-chainsaw@d311eacde764f806c9658574ff64c9c3b21f8397 # v0.2.11 | |
with: | |
verify: true | |
- name: Run e2e tests | |
if: inputs.run-e2e | |
run: | | |
make e2e-tests | |
# best effort to remove ngrok k8s resources from cluster | |
# this allows our finalizers to delete upstream ngrok API resources too | |
# that hopefully helps not pollute our ngrok-operator-ci account | |
- name: Cleanup e2e tests | |
if: inputs.run-e2e | |
run: | | |
make e2e-clean |