Skip to content

chore: [Policy Assistant] rename Cyclonus to pola #28

chore: [Policy Assistant] rename Cyclonus to pola

chore: [Policy Assistant] rename Cyclonus to pola #28

name: policy-assistant
on:
push:
branches:
- 'main'
- 'release*'
tags:
- 'v*'
paths:
- 'cmd/policy-assistant/**'
- '.github/workflows/policy-assistant.yml'
pull_request:
branches:
- 'main'
- 'release*'
paths:
- 'cmd/policy-assistant/**'
- '.github/workflows/policy-assistant.yml'
workflow_dispatch:
env:
GO_VERSION: "1.22.0"
permissions: write-all
jobs:
go-tests:
name: Go Tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Unit Tests
run: |
cd cmd/policy-assistant/
go test ./...
- name: Run Go Vet
run: |
cd cmd/policy-assistant/
go vet ./...
- name: Run Go Fmt
shell: bash
run: |
cd cmd/policy-assistant/
go fmt ./... | grep "\.go"
exitCode=$?
echo $exitCode
if [ $exitCode == 0 ]; then
echo "please run 'make fmt' in the cmd/policy-assistant/ directory"
exit 1
else
echo "files are properly formatted"
fi
build:
name: Build Policy Assistant
runs-on: ubuntu-22.04
needs: go-tests
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build pola Binary
run: |
cd cmd/policy-assistant/
make pola
- name: Save pola Binary
run: |
mkdir -p artifacts
cp cmd/policy-assistant/cmd/pola/pola artifacts/
- name: Upload pola Binary
uses: actions/upload-artifact@v4
with:
name: pola-binary
path: artifacts/pola
integration-tests:
name: Integration Tests
runs-on: ubuntu-22.04
needs: build
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download pola Binary
uses: actions/download-artifact@v4
with:
name: pola-binary
path: artifacts
- name: Set pola Binary Permissions
run: chmod u+x artifacts/pola
- name: Run Integration Test - Explain Mode
run: |
artifacts/pola analyze --mode explain --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/
- name: Run Integration Test - Probe Mode
run: |
artifacts/pola analyze --mode probe --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/ --probe-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/demo-probe.json
- name: Run Integration Test - Walkthrough Mode
run: |
artifacts/pola analyze --mode walkthrough --policy-path cmd/policy-assistant/examples/demos/kubecon-eu-2024/policies/