-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add integration test with dagger and docs
Signed-off-by: Ross Fairbanks <[email protected]>
- Loading branch information
Showing
10 changed files
with
393 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Benchmark Pipeline Test | ||
|
||
on: | ||
push: | ||
|
||
concurrency: | ||
group: benchmark | ||
|
||
jobs: | ||
pipeline: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dagger/dagger-for-github@v7 | ||
with: | ||
module: "." | ||
version: "0.15.1" | ||
args: benchmark-pipeline-test | ||
--source='.' | ||
--cncf-project='falco' | ||
--config='modern-ebpf' | ||
--version='0.39.2' | ||
--benchmark-job-url='https://raw.githubusercontent.com/falcosecurity/cncf-green-review-testing/e93136094735c1a52cbbef3d7e362839f26f4944/benchmark-tests/falco-benchmark-tests.yaml' | ||
--benchmark-job-duration-mins=2 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
FROM alpine:3.21 | ||
|
||
RUN apk add ca-certificates kubectl --no-cache | ||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ | ||
apk update | ||
|
||
RUN apk add ca-certificates flux kubectl --no-cache |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Dagger | ||
|
||
Run benchmark pipeline locally using [dagger](https://docs.dagger.io/). | ||
|
||
Docs use `kind` other tooling like minikube or k3d should also work but is untested. | ||
|
||
## Tools | ||
|
||
These CLIs are needed | ||
|
||
- `dagger` https://docs.dagger.io/install | ||
- `helm` https://helm.sh/docs/helm/helm_install/ | ||
- `kind` https://kind.sigs.k8s.io/docs/user/quick-start/ | ||
- `yq` https://github.com/mikefarah/yq/#install | ||
|
||
## Setup | ||
|
||
- Create kind cluster | ||
|
||
```sh | ||
kind create cluster | ||
kind get kubeconfig | yq e '.clusters[0].cluster.server = "https://kubernetes.default"' - > kind-in-cluster | ||
``` | ||
|
||
- Install Dagger engine and configure CLI https://docs.dagger.io/integrations/kubernetes | ||
|
||
```sh | ||
helm upgrade --install --namespace=dagger --create-namespace \ | ||
dagger oci://registry.dagger.io/dagger-helm | ||
|
||
kubectl wait --for condition=Ready --timeout=60s pod \ | ||
--selector=name=dagger-dagger-helm-engine --namespace=dagger | ||
|
||
DAGGER_ENGINE_POD_NAME="$(kubectl get pod \ | ||
--selector=name=dagger-dagger-helm-engine --namespace=dagger \ | ||
--output=jsonpath='{.items[0].metadata.name}')" | ||
export DAGGER_ENGINE_POD_NAME | ||
|
||
_EXPERIMENTAL_DAGGER_RUNNER_HOST="kube-pod://$DAGGER_ENGINE_POD_NAME?namespace=dagger" | ||
export _EXPERIMENTAL_DAGGER_RUNNER_HOST | ||
``` | ||
|
||
## Run pipeline | ||
|
||
- Bootstrap flux and install manifests from [/clusters/base/](/clusters/base/) | ||
|
||
```sh | ||
dagger call setup-cluster --source=. --kubeconfig=/src/kind-in-cluster | ||
``` | ||
|
||
- Run the pipeline and execute tests on completion | ||
|
||
```sh | ||
dagger call benchmark-pipeline-test --source=. --kubeconfig=/src/kind-in-cluster | ||
--cncf-project='falco' | ||
--config='modern-ebpf' | ||
--version='0.39.2' | ||
--benchmark-job-url='https://raw.githubusercontent.com/falcosecurity/cncf-green-review-testing/e93136094735c1a52cbbef3d7e362839f26f4944/benchmark-tests/falco-benchmark-tests.yaml' | ||
--benchmark-job-duration-mins=2 | ||
``` | ||
|
||
## Debugging | ||
|
||
- Get an interactive terminal for trouble shooting | ||
|
||
```sh | ||
dagger call terminal --source=. --kubeconfig=/src/kind-in-cluster | ||
``` |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package pipeline | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/cncf-tags/green-reviews-tooling/internal/dagger" | ||
) | ||
|
||
// BenchmarkTest runs the pipeline and executes tests on completion. | ||
func (p *Pipeline) BenchmarkTest(ctx context.Context, | ||
cncfProject, | ||
config, | ||
version, | ||
benchmarkJobURL string, | ||
benchmarkJobDurationMins int) (*dagger.Container, error) { | ||
_, err := p.Benchmark(ctx, cncfProject, config, version, benchmarkJobURL, benchmarkJobDurationMins) | ||
if err != nil { | ||
log.Printf("benchmark failed: %v", err) | ||
} | ||
|
||
// TODO Add tests. | ||
return p.container, nil | ||
} |
Oops, something went wrong.