🚑 flux workflows

This commit is contained in:
auricom
2023-12-26 01:08:29 +01:00
parent 3693d6efff
commit e73e29a6ce
2 changed files with 6 additions and 78 deletions

View File

@@ -5,54 +5,20 @@ name: "Flux Diff"
on: on:
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths: ["kubernetes/apps/**"] paths: ["kubernetes/**"]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
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 Default Branch
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"
fetch-depth: 0
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: kubernetes/**
dir_names: true
dir_names_max_depth: 2
json: true
escape_json: false
- name: List All Changed Files
run: echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
flux-diff: flux-diff:
name: Flux Diff name: Flux Diff
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: ["changed-files"]
permissions: permissions:
pull-requests: write pull-requests: write
strategy: strategy:
matrix: matrix:
paths: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
resources: ["helmrelease", "kustomization"] resources: ["helmrelease", "kustomization"]
max-parallel: 4 max-parallel: 4
fail-fast: false fail-fast: false
@@ -88,8 +54,8 @@ jobs:
--log-level DEBUG --log-level DEBUG
diff ${{ matrix.resources }} diff ${{ matrix.resources }}
--unified 6 --unified 6
--path-orig /github/workspace/default/${{ matrix.paths }} --path-orig /github/workspace/default/kubernetes
--path /github/workspace/pull/${{ matrix.paths }} --path /github/workspace/pull/kubernetes
--strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart" --strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart"
--limit-bytes 10000 --limit-bytes 10000
--all-namespaces --all-namespaces

View File

@@ -5,56 +5,18 @@ name: "Flux Image Test"
on: on:
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths: ["kubernetes/apps/**"] paths: ["kubernetes/**"]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
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 Default Branch
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"
fetch-depth: 0
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: kubernetes/**
dir_names: true
dir_names_max_depth: 2
json: true
escape_json: false
- name: List All Changed Files
run: echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
extract-images: extract-images:
name: Extract Images name: Extract Images
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: ["changed-files"]
permissions: permissions:
pull-requests: write pull-requests: write
strategy:
matrix:
paths: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
max-parallel: 4
fail-fast: false
outputs: outputs:
matrix: ${{ steps.extract-images.outputs.images }} matrix: ${{ steps.extract-images.outputs.images }}
steps: steps:
@@ -96,7 +58,7 @@ jobs:
with: with:
args: >- args: >-
get cluster get cluster
--path /github/workspace/default/${{ matrix.paths }} --path /github/workspace/default/kubernetes
--enable-images --enable-images
--output yaml --output yaml
--output-file default.yaml --output-file default.yaml
@@ -106,7 +68,7 @@ jobs:
with: with:
args: >- args: >-
get cluster get cluster
--path /github/workspace/pull/${{ matrix.paths }} --path /github/workspace/pull/kubernetes
--enable-images --enable-images
--output yaml --output yaml
--output-file pull.yaml --output-file pull.yaml