-
Notifications
You must be signed in to change notification settings - Fork 6
FLPATH-4770 - bump control-plane and add check-website-fixtures workflow #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
testetson22
wants to merge
3
commits into
dcm-project:main
Choose a base branch
from
testetson22:FLPATH-4770-fix-user-journey
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
1c89c40
fix(deps): bump control-plane and add website fixture validation (FLP…
testetson22 f34b21c
test(contract): use typed control-plane structs in website fixture tests
testetson22 7d9a1f1
test(contract): align website fixture test IDs and harden drift check
testetson22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Check website fixtures | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - testdata/website/** | ||
| - hack/check-website-fixtures.sh | ||
| schedule: | ||
| - cron: "0 8 * * 1" # Weekly Monday 08:00 UTC — hard-fails on fetch errors | ||
|
|
||
| jobs: | ||
| check-fixtures: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Verify testdata/website/ matches upstream docs | ||
| run: hack/check-website-fixtures.sh |
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Verifies that testdata/website/ fixtures match the YAML examples | ||
| # published in the dcm-project.github.io Getting Started guides. | ||
| # | ||
| # Usage: hack/check-website-fixtures.sh [--update] | ||
| # --update Overwrite local fixtures with upstream content (for refresh) | ||
| # | ||
| # Exit codes: 0 = success, 1 = runtime/drift error, 2 = usage error | ||
|
|
||
| usage() { | ||
| echo "Usage: ${0##*/} [--update]" | ||
| echo " --update Overwrite local fixtures with upstream content" | ||
| } | ||
|
|
||
| REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| FIXTURE_DIR="${REPO_ROOT}/testdata/website" | ||
| WEBSITE_REPO="dcm-project/dcm-project.github.io" | ||
| WEBSITE_BRANCH="main" | ||
| BASE_URL="https://raw.githubusercontent.com/${WEBSITE_REPO}/${WEBSITE_BRANCH}/content/docs/getting-started" | ||
|
|
||
| UPDATE=false | ||
| case "${1:-}" in | ||
| "") ;; | ||
| --update) UPDATE=true ;; | ||
| *) | ||
| echo "Error: unknown argument: $1" >&2 | ||
| usage >&2 | ||
| exit 2 | ||
| ;; | ||
| esac | ||
| if [[ $# -gt 1 ]]; then | ||
| echo "Error: too many arguments" >&2 | ||
| usage >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| # Maps local fixture filenames to their source markdown files. | ||
| declare -A FIXTURE_SOURCES=( | ||
| ["small-vm.yaml"]="create-small-vm-catalog-item.md" | ||
| ["my-vm.yaml"]="create-small-vm-instance.md" | ||
| ) | ||
|
|
||
| extract_yaml_block() { | ||
| # Extracts the first ```yaml ... ``` fenced block from markdown on stdin. | ||
| awk ' | ||
| /^```yaml/ { capture=1; next } | ||
| /^```/ && capture { capture=0; next } | ||
| capture { print } | ||
| ' | ||
| } | ||
|
|
||
| errors=0 | ||
| fetch_failures=0 | ||
| compared=0 | ||
|
|
||
| for fixture in "${!FIXTURE_SOURCES[@]}"; do | ||
| source_file="${FIXTURE_SOURCES[$fixture]}" | ||
| local_path="${FIXTURE_DIR}/${fixture}" | ||
| url="${BASE_URL}/${source_file}" | ||
|
|
||
| echo "Checking ${fixture} ← ${source_file}" | ||
|
|
||
| if ! markdown=$(curl -sf --connect-timeout 10 --max-time 30 --retry 3 --retry-delay 2 --retry-all-errors "${url}"); then | ||
| echo " WARNING: Could not fetch ${url} (network error, 404, or rate limiting)" | ||
| fetch_failures=$((fetch_failures + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| upstream_yaml=$(echo "${markdown}" | extract_yaml_block) | ||
| if [[ -z "${upstream_yaml}" ]]; then | ||
| echo " ERROR: No YAML code block found in ${source_file}" | ||
| errors=$((errors + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| if [[ "${UPDATE}" == "true" ]]; then | ||
| echo "${upstream_yaml}" > "${local_path}" | ||
| echo " Updated ${local_path}" | ||
| continue | ||
| fi | ||
|
|
||
| if [[ ! -f "${local_path}" ]]; then | ||
| echo " ERROR: Local fixture missing: ${local_path}" | ||
| echo " Run: hack/check-website-fixtures.sh --update" | ||
| errors=$((errors + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| if ! diff_output=$(diff -u "${local_path}" <(echo "${upstream_yaml}")); then | ||
| echo " DRIFT DETECTED: ${fixture} differs from upstream" | ||
| echo "${diff_output}" | ||
| echo "" | ||
| echo " To update: hack/check-website-fixtures.sh --update" | ||
| errors=$((errors + 1)) | ||
| else | ||
| echo " OK" | ||
| fi | ||
| compared=$((compared + 1)) | ||
| done | ||
|
|
||
| if [[ ${errors} -gt 0 ]]; then | ||
| echo "" | ||
| echo "FAIL: ${errors} fixture(s) out of sync with ${WEBSITE_REPO}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ${fetch_failures} -gt 0 ]]; then | ||
| echo "" | ||
| if [[ "${GITHUB_EVENT_NAME:-}" == "schedule" ]] || [[ ${compared} -eq 0 ]]; then | ||
| echo "FAIL: ${fetch_failures} fixture(s) could not be fetched — no fixtures were checked" | ||
| exit 1 | ||
| fi | ||
| echo "WARNING: ${fetch_failures} fixture(s) could not be fetched (skipped; network issue or rate limiting)" | ||
| echo "Re-run or check manually: hack/check-website-fixtures.sh" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "All fixtures match upstream." | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.