Skip to content

Commit

Permalink
fix(actions): fix kubeconform workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
willianpaixao committed Nov 3, 2024
1 parent 5230863 commit 653cd06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/flux-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ jobs:
pull-requests: write
strategy:
matrix:
paths: ["kubernetes"]
paths: ["kubernetes/raspberry", "kubernetes/turing"]
resources: ["helmrelease", "kustomization"]
max-parallel: 4
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -35,17 +37,17 @@ jobs:
path: default

- name: Diff Resources
uses: docker://ghcr.io/allenporter/flux-local:main
uses: docker://ghcr.io/allenporter/flux-local:v6.0.1
with:
args: >-
diff ${{ matrix.resources }}
--unified 6
--path /github/workspace/pull/${{ matrix.paths }}/main/flux
--path-orig /github/workspace/default/${{ matrix.paths }}/main/flux
--path /github/workspace/pull/${{ matrix.paths }}/flux-system
--path-orig /github/workspace/default/${{ matrix.paths }}/flux-system
--strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart"
--limit-bytes 10000
--all-namespaces
--sources "home-kubernetes"
--sources "flux-systems"
--output-file diff.patch
- name: Generate Diff
Expand All @@ -66,3 +68,14 @@ jobs:
```diff
${{ steps.diff.outputs.diff }}
```
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
flux-diff-success:
if: ${{ always() }}
needs: ["flux-diff"]
name: Flux Diff Successful
runs-on: ubuntu-latest
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
name: Check matrix status
run: exit 1
17 changes: 7 additions & 10 deletions .github/workflows/kubeconform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main"]
paths: ["kubernetes/**"]
workflow_dispatch:

env:
KUBERNETES_DIR: ./kubernetes
Expand All @@ -17,13 +18,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Setup Workflow Tools
run: brew install fluxcd/tap/flux kubeconform kustomize

- name: Run kubeconform
shell: bash
run: bash ./scripts/kubeconform.sh ${{ env.KUBERNETES_DIR }}
- name: Login to Github Packages
run: echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- uses: docker://ghcr.io/yannh/kubeconform:latest
with:
entrypoint: "/kubeconform"
args: "-summary -output json -ignore-missing-schemas -ignore-filename-pattern json ${{ env.KUBERNETES_DIR }}"

0 comments on commit 653cd06

Please sign in to comment.