docs/TODO_GORELEASER_E2E.md
Path: kubescape/docs/TODO_GORELEASER_E2E.md
This document lists ideas, constraints, and next steps for moving e2e / smoke testing into the goreleaser pipeline via build hooks. The repository already contains a smoke test runner at smoke_testing/init.py. The goal is to provide a robust, configurable, and CI-friendly approach that runs tests only when the environment supports them.
if/fi, variables, and state persist across lines.python3 available on PATH (or adjust to use a virtualenv in CI).kind if running cluster-based tests.kind clusters.Ensure goreleaser hook is a single script
builds[].hooks.post in .goreleaser.yaml to be one multi-line script (YAML literal) so the entire script runs in a single shell.RUN_E2E=true.Add opt-in trigger and documented env flag
RUN_E2E (boolean-like) to decide whether to run post-build tests.RUN_E2E: "true"RELEASE: ${{ inputs.RELEASE }}CLIENT: ${{ inputs.CLIENT }}GORELEASER_E2E_MODE with values smoke|system|none.Artifact discovery
dist/kubescape* and pick the most appropriate artifact (prefer linux binary or the packaged format you want).ARTIFACT="$(ls dist | grep kubescape | grep -v '\.sha256' | head -n1)"ART_PATH="$(pwd)/dist/$ARTIFACT"Decide failure policy
E2E_FAIL_ON_ERROR=true|false. If false, wrap test command with || true.Integrate with existing smoke tests
smoke_testing/init.py to run basic smoke tests.Optional: Run full system-tests (more complex)
GORELEASER_E2E_MODE=system:
armosec/system-tests into a temp directory.pip install -r requirements.txt.kind cluster (requires docker + kind).run-tests job).Secrets and CI environment
CUSTOMER, USERNAME, PASSWORD, CLIENT_ID_PROD, SECRET_KEY_PROD, REGISTRY_USERNAME, REGISTRY_PASSWORD.QUAYIO_REGISTRY_USERNAME and QUAYIO_REGISTRY_PASSWORD (or equivalent) are available.Logging and artifacts
Implement robust teardown / cleanup
kind clusters, ensure proper cleanup of clusters and temporary resources on success or failure.Security considerations
Optional: Containerize test runner
dist/ dir into it. This reduces host dependency issues and makes execution reproducible.docker run --rm -v $(pwd)/dist:/dist my-test-runner:latest /dist/kubescape-...Example hook behaviour (concept)
.goreleaser.yaml:
RUN_E2EE2E_FAIL_ON_ERROR behaviorpython3 smoke_testing/init.py "$ART_PATH"RUN_E2E=true goreleaser release --snapshot --cleanRUN_E2E is unset and when set.CONTRIBUTING.md or docs/ describing:
RUN_E2E, E2E_FAIL_ON_ERROR, and GORELEASER_E2E_MODE.E2E_FAIL_ON_ERROR support.docs/ explaining how to enable the tests and what runner prerequisites exist.GORELEASER_E2E_MODE=system that clones armosec/system-tests and runs the test runner (requires careful gating, secrets and runner capability checks).RUN_E2E=true on a runner that has all required tools, captures test artifacts and test reports, and properly tears down resources.kind and docker-based tests.hooks.post script with artifact discovery and configurable failure behavior.RUN_E2E=true on a runner that has python3, docker, and kind.Pick which of these you'd like me to do next and I will produce the code/snippets (hook script, GitHub Actions job, or Dockerfile).