Skip to content

chore: Verify diff in manifests #22

chore: Verify diff in manifests

chore: Verify diff in manifests #22

name: "Check for diff in manifests"
env:
CACHE_KEY: manifests-${{ GITHUB_RUN_ID }}-${{ GITHUB_RUN_ATTEMPT }}

Check failure on line 4 in .github/workflows/check-manifest-diffs.yaml

View workflow run for this annotation

GitHub Actions / Check for diff in manifests

Invalid workflow file

The workflow is not valid. .github/workflows/check-manifest-diffs.yaml (Line: 4, Col: 14): Unrecognized named-value: 'GITHUB_RUN_ID'. Located at position 1 within expression: GITHUB_RUN_ID .github/workflows/check-manifest-diffs.yaml (Line: 37, Col: 16): Unrecognized named-value: 'CACHE_KEY'. Located at position 1 within expression: CACHE_KEY
on:
pull_request:
branches: [ "main" ]
types:
- "opened"
- "synchronize"
- "reopened"
- "labeled"
- "unlabeled"
jobs:
create-pr-manifests:
if: ${{ contains(github.event.pull_request.labels.*.name, 'confirm/helm-update') == false }}
name: Create PR manifests
runs-on: ubuntu-latest
steps:
- name: Checkout lifecycle-manager
uses: actions/checkout@v4
- name: Run 'make dry-run-control-plane'
id: make-pr-manifests
run: |
sudo mkdir -p /cache/pr
make dry-run-control-plane
sudo mv ./dry-run/manifests.yaml /cache/pr/manifests.yaml
- name: Save PR manifests in cache
id: cache-pr-manifests
uses: actions/cache/save@v3
with:
path: /cache
key: ${{ CACHE_KEY }}
create-main-manifests:
if: ${{ contains(github.event.pull_request.labels.*.name, 'confirm/helm-update') == false }}
name: Create 'main' manifests
runs-on: ubuntu-latest
steps:
- name: Checkout lifecycle-manager
uses: actions/checkout@v4
with:
ref: main
- name: Run 'make dry-run-control-plane'
id: make-main-manifests
run: |
sudo mkdir -p /cache/main
make dry-run-control-plane
sudo mv ./dry-run/manifests.yaml /cache/main/manifests.yaml
- name: Save 'main' manifests in cache
id: cache-main-manifests
uses: actions/cache/save@v3
with:
path: /cache
key: ${{ CACHE_KEY }}
diff-manifests:
needs:
- create-pr-manifests
- create-main-manifests
name: Diff manifests
runs-on: ubuntu-latest
steps:
- name: Restore manifests cache
uses: actions/cache/restore@v3
id: restore-cache
with:
path: /cache
key: ${{ CACHE_KEY }}
- name: Diff
run: |
ls /cache
set +e
SCRIPT_OUTPUT=$(diff ./cache/pr/manifests.yaml ./cache/main/manifests.yaml)
SCRIPT_EXIT_CODE=$?
if [[ $SCRIPT_EXIT_CODE != 0 ]]; then
echo "Detected diff in manifests. Make sure to update Helm charts accordingly and add the'confirm/helm-update' label to the PR when okay."
echo "$SCRIPT_OUTPUT"
exit $SCRIPT_EXIT_CODE
fi
set -e
echo "No diff in manifests, all good."