From f4aa736e678ff0c56f0993d95d200e3b8a2ffb76 Mon Sep 17 00:00:00 2001 From: Barrett <81570928+btlghrants@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:40:47 -0600 Subject: [PATCH] test: run load test nightly (#1434) ## Description Workflow config to run the Pepr Load Tests nightly. ## Related Issue Relates to https://github.com/defenseunicorns/pepr/issues/1431 ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Other (security config, docs update, etc) ## Checklist before merging - [x] Unit, [Journey](https://github.com/defenseunicorns/pepr/tree/main/journey), [E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples), [docs](https://github.com/defenseunicorns/pepr/tree/main/docs), [adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or updated as needed - [x] [Contributor Guide Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request) followed --- .github/workflows/load.yml | 145 +++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 .github/workflows/load.yml diff --git a/.github/workflows/load.yml b/.github/workflows/load.yml new file mode 100644 index 000000000..6ad4a17d2 --- /dev/null +++ b/.github/workflows/load.yml @@ -0,0 +1,145 @@ +name: Pepr Load Test + +permissions: read-all +on: + workflow_dispatch: + schedule: + - cron: '0 5 * * *' # 1AM EST/10PM PST + +jobs: + load: + name: load test + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + + - name: "install k3d" + run: "curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash" + shell: bash + + - name: clone pepr + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: defenseunicorns/pepr + path: pepr + + - name: "set env: PEPR" + run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV" + + - name: clone pepr-excellent-examples + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: defenseunicorns/pepr-excellent-examples + path: pepr-excellent-examples + + - name: "set env: PEXEX" + run: echo "PEXEX=${GITHUB_WORKSPACE}/pepr-excellent-examples" >> "$GITHUB_ENV" + + - name: setup node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 20 + cache: "npm" + cache-dependency-path: pepr + + - name: "load.cli.ts prep" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts prep ./ + + - name: upload pepr package artifact (.tgz) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: tgz + path: pepr-0.0.0-development.tgz + if-no-files-found: error + retention-days: 1 + + - name: upload pepr controller image artifact (.tar) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: tar + path: pepr-dev.tar + if-no-files-found: error + retention-days: 1 + + - name: "load.cli.ts cluster up" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts cluster up + + - name: "load.cli.ts deploy" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts deploy \ + ./pepr-0.0.0-development.tgz \ + ./pepr-dev.tar \ + ${PEXEX}/hello-pepr-load + + - name: "load.cli.ts run" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts run \ + ${PEXEX}/hello-pepr-load \ + capabilities/configmap.yaml + + - name: upload raw test inject log (actress) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: actress.log + path: load/*-actress.log + if-no-files-found: error + retention-days: 1 + + - name: upload raw test sample log (audience) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: audience.log + path: load/*-audience.log + if-no-files-found: error + retention-days: 1 + + - name: "load.cli.ts post" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts post + + - name: upload parsed inject log (actress) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: actress.json + path: load/*-actress.json + if-no-files-found: error + retention-days: 1 + + - name: upload parsed sample log (audience) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: audience.json + path: load/*-audience.json + if-no-files-found: error + retention-days: 1 + + - name: upload load test summary + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: summary.json + path: load/*-summary.json + if-no-files-found: error + retention-days: 1 + + - name: "load.cli.ts graph" + run: | + cd "$PEPR" + npx ts-node hack/load.cli.ts graph + + - name: upload load test result graph (watcher) + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: watcher.png + path: load/*.png + if-no-files-found: error + retention-days: 1 \ No newline at end of file