chore(testing): verify pepr can be deployed with zarf #49
Workflow file for this run
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: Deploy Test - Helm | |
permissions: read-all | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
helm: | |
name: deploy test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Set up Kubernetes | |
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0 | |
with: | |
version: 'latest' | |
- 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: setup node | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 22 | |
cache: "npm" | |
cache-dependency-path: pepr | |
- name: "set env: PEPR" | |
run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV" | |
- name: install pepr deps | |
run: | | |
cd "$PEPR" | |
npm ci | |
- name: build pepr package + image | |
run: | | |
cd "$PEPR" | |
npm run build:image | |
- name: "set env: MOD_NAME" | |
run: | | |
echo "MOD_NAME=pepr-test-helm" >> "$GITHUB_ENV" | |
- name: "set env: MOD_PATH" | |
run: | | |
echo "MOD_PATH=${PEPR}/${MOD_NAME}" >> "$GITHUB_ENV" | |
- name: init pepr module | |
run: | | |
cd "$PEPR" | |
npx pepr init --name "$MOD_NAME" --description "$MOD_NAME" --skip-post-init --confirm | |
sed -i 's/uuid": ".*",/uuid": "'$MOD_NAME'",/g' "$MOD_PATH/package.json" | |
- name: build pepr module | |
run: | | |
cd "$MOD_PATH" | |
npm install "${PEPR}/pepr-0.0.0-development.tgz" | |
npx pepr build --custom-image pepr:dev | |
- name: "set env: CLUSTER" | |
run: echo "CLUSTER=$MOD_NAME" >> "$GITHUB_ENV" | |
- name: prep test cluster | |
run: | | |
k3d cluster create "$CLUSTER" | |
k3d image import pepr:dev --cluster "$CLUSTER" | |
- name: "set env: KUBECONFIG" | |
run: echo "KUBECONFIG=$(k3d kubeconfig write "$CLUSTER")" >> "$GITHUB_ENV" | |
- name: deploy pepr module | |
run: | | |
cd "$MOD_PATH" | |
helm install "$MOD_NAME" "./dist/${MOD_NAME}-chart" --kubeconfig "$KUBECONFIG" | |
- name: wait to win | |
timeout-minutes: 5 | |
run: | | |
while : ; do | |
kubectl get deploy -n pepr-system | |
ready=$( | |
kubectl get deploy pepr-${MOD_NAME} -n pepr-system -o jsonpath='{.status.readyReplicas}' | |
) | |
if [ "$ready" = "2" ] ; then break ; fi | |
sleep 5 | |
done | |
while : ; do | |
kubectl get deploy -n pepr-system | |
ready=$( | |
kubectl get deploy pepr-${MOD_NAME}-watcher -n pepr-system -o jsonpath='{.status.readyReplicas}' | |
) | |
if [ "$ready" = "1" ] ; then break ; fi | |
sleep 5 | |
done |