Skip to content

Commit

Permalink
chore: pepr build custom image (#1401)
Browse files Browse the repository at this point in the history
## Description

Builds a Pepr module and read manifests from known locations to assert
that the custom image was used.

CI test for `npx pepr build --custom-image'

End to End Test:  <!-- if applicable -->  
(See [Pepr Excellent
Examples](https://github.com/defenseunicorns/pepr-excellent-examples))

## Related Issue

Fixes #1370 
<!-- or -->
Relates to #

## 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

---------

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
  • Loading branch information
cmwylie19 authored Nov 7, 2024
1 parent c84043e commit 29d1c8f
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,40 @@ jobs:
RESULT_FILE="stdin-module/package.json"
grep "stdin-module" $RESULT_FILE
grep "Set by flag" $RESULT_FILE
grep "reject" $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

0 comments on commit 29d1c8f

Please # to comment.