chore: different periods between send and receive #1430
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: CLI tests | |
permissions: read-all | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
merge_group: | |
paths-ignore: | |
- "**.md" | |
- "**.yml" | |
- "**.yaml" | |
- "**.toml" | |
- "docs/**" | |
- "hack/**" | |
- "journey/**" | |
- "LICENSE" | |
- "CODEOWNERS" | |
- "Dockerfile" | |
- "Dockerfile.controller" | |
- "Dockerfile.kfc" | |
jobs: | |
pepr-build: | |
name: controller image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- 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: setup node | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 20 | |
cache-dependency-path: pepr | |
- name: Prep for CLI tests | |
run: | | |
cd "$PEPR" | |
npm ci | |
- name: pepr init - displays the help menu | |
run: | | |
cd "$PEPR" | |
npm run gen-data-json | |
npx ts-node src/cli.ts init --help > result.log | |
grep " \-\-name" result.log | |
grep " \-\-description" result.log | |
grep " \-\-errorBehavior" result.log | |
grep " \-\-confirm" result.log | |
- name: pepr init - creates a module with input from flags | |
run: | | |
cd "$PEPR" | |
npm run gen-data-json | |
npx ts-node src/cli.ts init \ | |
--name my-flagged-module \ | |
--description "Set by flag" \ | |
--errorBehavior reject \ | |
--confirm \ | |
--skip-post-init | |
RESULT_FILE="my-flagged-module/package.json" | |
grep "my-flagged-module" $RESULT_FILE | |
grep "Set by flag" $RESULT_FILE | |
grep "reject" $RESULT_FILE | |
- name: pepr init - creates a module with input from stdin | |
run: | | |
cd "$PEPR" | |
npm run gen-data-json | |
echo "stdin-module" | npx ts-node src/cli.ts init \ | |
--description "Set by flag" \ | |
--errorBehavior reject \ | |
--confirm \ | |
--skip-post-init | |
RESULT_FILE="stdin-module/package.json" | |
grep "stdin-module" $RESULT_FILE | |
grep "Set by flag" $RESULT_FILE | |
grep "reject" $RESULT_FILE | |
- name: pepr build --custom-image - generates Kubernetes manifest with a custom image | |
run: | | |
cd "${GITHUB_WORKSPACE}" | |
npx pepr@latest init \ | |
--name=custom-image \ | |
--description="custom image test" \ | |
--errorBehavior=reject \ | |
--skip-post-init \ | |
--confirm | |
cd custom-image | |
npm i | |
npx ts-node ../pepr/src/cli.ts build --custom-image pepr:dev | |
UUID=$(cat package.json | jq -r .pepr.uuid) | |
count=$(cat dist/$UUID-chart/values.yaml | egrep "image: 'pepr:dev'" | wc -l) | |
if [ "$count" -eq 2 ]; then | |
echo "✅ Generated correct image for helm values." | |
else | |
echo "❌ Generated incorrect image for helm values." | |
exit 1 | |
fi | |
count=$(cat dist/pepr-module-$UUID.yaml | egrep "pepr:dev" | wc -l) | |
if [ "$count" -eq 2 ]; then | |
echo "✅ Generated correct image for Pepr manifest." | |
else | |
echo "❌ Generated incorrect image for Pepr manifest." | |
exit 1 | |
fi | |
count=$(cat dist/zarf.yaml | egrep "pepr:dev" | wc -l) | |
if [ "$count" -eq 1 ]; then | |
echo "✅ Generated correct image for Zarf manifest." | |
else | |
echo "❌ Generated incorrect image for Zarf manifest." | |
exit 1 | |
fi | |