Skip to content

Commit

Permalink
ci: github action for chainsaw
Browse files Browse the repository at this point in the history
  • Loading branch information
camaeel committed Jan 13, 2025
1 parent d641a49 commit 2475636
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/chaisnaw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# $schema: https://json.schemastore.org/github-workflow.json

name: chainsaw E2E test
on:
workflow_call:

jobs:
chainsaw-e2e-tests:
name: Chainsaw E2E test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Chainsaw
uses: kyverno/action-install-chainsaw@v0.2.12

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
id: go

- name: extract kubernetes version
if: k8s_version
run: echo "k8s_version=$(go list -m -f '{{.Version}}' k8s.io/kubernetes)" >> $GITHUB_OUTPUT

- name: Create kind cluster
uses: helm/kind-action@v1
with:
version: ${{ steps.k8s_version.outputs.k8s_version }}

- name: Install helm
uses: azure/setup-helm@v4

- name: Check chainsaw install
run: chainsaw version

- name: Check kind cluster install
run: |
kubectl version
K8S_VERSION
kubectl wait --for=jsonpath='{.status.phase}'=Running pod --all -A --timeout 120s
kubectl get pods -A
kubectl get nodes
- name: Check helm version
run: helm version

- name: run chainsaw
run: chainsaw test chainsaw/*
16 changes: 14 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
docker-build:

runs-on: ubuntu-latest
permissions:
Expand All @@ -30,7 +30,8 @@ jobs:
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

outputs:
dockerTag: ${{ steps.docker-tag.outputs.dockerTag }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -76,4 +77,15 @@ jobs:
build-args: ${{ github.event_name == 'push' && github.ref_type == 'tag' && format('RELEASE_VERSION={0}', github.ref_name) || '' }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: ${{ github.event_name != 'pull_request' && format( 'type=registry,ref={0}/{1}:buildcache,mode=max', env.REGISTRY, env.IMAGE_NAME ) || '' }}
- name: output tag
id: docker-tag
run: |
echo "dockerTag=$( echo "${{ steps.meta.outputs.tags }}" | cut -d ',' -f 1 | cut -d ':' -f 2 )" >> $GITHUB_OUTPUT
chainsaw-e2e:
uses: ./.github/workflows/chainsaw.yaml
needs:
- docker-build
strategy:
matrix:
IMAGE_TAG: ${{ needs.docker-build.outputs.dockerTag }}

0 comments on commit 2475636

Please sign in to comment.