More talos bootstrap #2721
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Flux Local | |
on: | |
pull_request: | |
branches: ["main"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changed-clusters: | |
name: Changed Clusters | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.process-changes.outputs.matrix }} | |
any_changed: ${{ steps.changed-clusters.outputs.any_changed }} | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
- name: Get Changed Clusters | |
id: changed-clusters | |
uses: JJGadgets/tj-actions-changed-files@9200e69727eb73eb060652b19946b8a2fdfb654b | |
with: | |
files: kubernetes/** | |
dir_names: true | |
dir_names_max_depth: 2 | |
matrix: true | |
- name: Process Changes | |
id: process-changes | |
run: | | |
changed=$(echo '${{ steps.changed-clusters.outputs.all_changed_and_modified_files }}' | jq -r '. | @json') | |
if echo "$changed" | grep -q "kubernetes/shared"; then | |
echo 'matrix=["kubernetes/main", "kubernetes/network", "kubernetes/registry"]' >> "$GITHUB_OUTPUT" | |
else | |
if [[ "$changed" == "["*"]" ]]; then | |
echo "matrix=$changed" >> "$GITHUB_OUTPUT" | |
else | |
echo "matrix=[\"$changed\"]" >> "$GITHUB_OUTPUT" | |
fi | |
fi | |
echo "changed: $changed" | |
echo "matrix: $(cat $GITHUB_OUTPUT | grep matrix)" | |
test: | |
if: ${{ needs.changed-clusters.outputs.any_changed == 'true' }} | |
needs: changed-clusters | |
name: Flux Local - Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
paths: ${{ fromJSON(needs.changed-clusters.outputs.matrix) }} | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Run flux-local test | |
uses: docker://ghcr.io/allenporter/flux-local:v7.8.0 | |
with: | |
args: >- | |
test | |
--all-namespaces | |
--enable-helm | |
--path /github/workspace/${{ matrix.paths }}/flux/cluster | |
--verbose | |
diff: | |
if: ${{ needs.changed-clusters.outputs.any_changed == 'true' }} | |
needs: changed-clusters | |
name: Flux Local - Diff | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
strategy: | |
matrix: | |
paths: ${{ fromJSON(needs.changed-clusters.outputs.matrix) }} | |
resource: ["helmrelease", "kustomization"] | |
max-parallel: 4 | |
fail-fast: false | |
steps: | |
- name: Checkout Pull Request Branch | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
path: pull | |
- name: Checkout Default Branch | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
ref: "${{ github.event.repository.default_branch }}" | |
path: default | |
- name: Run flux-local diff | |
uses: docker://ghcr.io/allenporter/flux-local:v7.8.0 | |
with: | |
args: >- | |
diff ${{ matrix.resource }} | |
--unified 6 | |
--path /github/workspace/pull/${{ matrix.paths }}/flux/cluster | |
--path-orig /github/workspace/default/${{ matrix.paths }}/flux/cluster | |
--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: | | |
cat diff.patch; | |
{ | |
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: Generate Token | |
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.BOT_APP_ID }} | |
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }} | |
- if: ${{ steps.diff.outputs.diff != '' }} | |
name: Add Comment | |
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 | |
with: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
header: ${{ github.event.pull_request.number }}/${{ matrix.paths }}/${{ matrix.resource }} | |
message: | | |
```diff | |
${{ steps.diff.outputs.diff }} | |
``` | |
success: | |
if: ${{ !cancelled() }} | |
needs: ["test", "diff"] | |
name: Flux Local - Success | |
runs-on: ubuntu-latest | |
permissions: {} | |
steps: | |
- name: Any jobs failed? | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
- name: All jobs passed or skipped? | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: echo "All jobs passed or skipped" && echo "${{ toJSON(needs.*.result) }}" |