ci: add static validation pipeline and v1 JSON schemas (Phase 1+1A)#2
Open
ci: add static validation pipeline and v1 JSON schemas (Phase 1+1A)#2
Conversation
Without 'declare -A', SECTION_TITLES=([feat]=...) is parsed as an indexed array, so bash evaluates the keys as arithmetic expressions. Under 'set -u' the lookup of unset names like 'feat' fails with 'unbound variable' and the workflow exits 1 before generating release notes. Also collapse 'declare -A SECTIONS' + reassignment into a single 'declare -A SECTIONS=(...)' for symmetry with SECTION_TITLES. Verified locally on bash 5.3.9 (homebrew): - Original form: 'feat: unbound variable' under set -euo pipefail. - Fixed form: parses sample 'feat(plugin): ...' commit and emits '### Features' with the formatted bullet line. Repro of the failure: https://github.com/Azure/git-ape/actions/runs/25362438095
On workflow_dispatch with versions already aligned, the prior
'Commit version bump' step is skipped and the tag is never created
locally. The release-notes step then ran 'git log v0.0.1' against a
non-existent ref, silently producing an empty changelog.
Verified locally with act:
act workflow_dispatch -W .github/workflows/git-ape-release.yml \
-e event.json -s GITHUB_TOKEN=... \
-P ubuntu-latest=catthehacker/ubuntu:act-latest
After the fix, the release notes step emits the full conventional-
commit-grouped changelog walking from the first commit through HEAD.
…itles fix(release): declare SECTION_TITLES as associative array
Introduces a parallel static-validation CI workflow and the first set of strict JSON Schemas (draft 2020-12) for every artifact Git-Ape emits per deployment. Schemas under schemas/git-ape/<artifact>/v1.json: - _defs/v1.json (canonical shared types) - state/v1.json - metadata/v1.json - security-gate/v1.json (count form only; boolean form rejected at v1.0) - requirements/v1.json - cost-estimate/v1.json - policy-recommendations/v1.json - plugin/v1.json (validates the chat-agents-plugin manifest at repo root) Tooling: - scripts/validate-schemas.sh — bulk validator selecting schema by base filename for every JSON under .azure/deployments/ and tests/fixtures/ - .yamllint.yml — repo-wide YAML lint config (advisory in this PR) - .github/workflows/git-ape-ci.yml — new workflow with five parallel jobs (shellcheck, yamllint, markdownlint, validate-schemas, bats) all pinned to specific tool versions Tests: - tests/fixtures/ — valid samples for every artifact + two negative fixtures asserting the migration contract (state.json missing required fields; security-gate.json boolean form) - tests/bash/schema-validation.bats — 13 positive + negative assertions Phase 2 reduced: bash<->PowerShell emitter parity tests are deferred to a follow-up PR after Azure#44 (deploy-stack scripts) lands on main. Existing CI (actionlint, docs-check, plugin-version-check) is intentionally left in place; this workflow extends rather than duplicates them. Refs: Azure#55
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements Phase 1 (static lint pipeline) and Phase 1A (strict JSON schemas) from the broader maximize-E2E-coverage plan. Tracked at Azure#55.
What lands here
Schemas (
schemas/git-ape/<artifact>/v1.json)JSON Schema draft 2020-12, one major.minor per artifact:
_defs/v1.json— canonical shared types (deploymentId,azureSubscription,armResourceId,iso8601DateTime,cafAbbreviation,environmentTier,deploymentStatus,softDeletableType)state/v1.json— runtime deployment state (matcheswebsite/docs/deployment/state.md)metadata/v1.json— planning-time deployment metadatasecurity-gate/v1.json— count form only; the legacy boolean form (criticalPassed: true) is rejected at v1.0requirements/v1.json,cost-estimate/v1.json,policy-recommendations/v1.jsonplugin/v1.json— validatesplugin.json(the chat-agents-plugin manifest)schemas/README.mddocuments the registry layout, versioning policy (per-artifactschemaVersion, shared$defsas a release train), strictness rules (additionalProperties: falseon top level only, transition window for nested objects), and a known-follow-ups list.Tooling
scripts/validate-schemas.sh— bulk validator. Walks.azure/deployments/**/*.jsonandtests/fixtures/**/*.json, picks the schema by base filename, surfaces per-file pass/fail. Skips_invalid/paths (covered by negative bats tests)..yamllint.yml— repo-wide config; advisory in this PR.CI workflow (
.github/workflows/git-ape-ci.yml)Five parallel jobs, all tools pinned to specific versions:
lint-shell0.10.0scripts/+tests/; error-only on.github/(legacy)lint-yaml1.38.0lint-markdown0.45.0validate-schemas0.37.2bats-tests1.11.1Existing workflows (
git-ape-actionlint.yml,git-ape-docs-check.yml,git-ape-plugin-version-check.yml) are deliberately left untouched.Tests
tests/fixtures/— valid sample per artifact + two negative samples in_invalid/tests/bash/schema-validation.bats— 13 assertions, including:state.jsonmissing required field → MUST be rejectedsecurity-gate.jsonboolean form → MUST be rejected at v1.0tests/README.mdandtests/fixtures/README.mddocument how to extendLocal verification (all passing)
actionlint,yamllint, andshellcheck --severity=styleare clean on every file added or modified.Out of scope (deliberate)
state.json/metadata.jsonemission paths indeploy-stack.sh/deploy-stack.ps1— those scripts arrive in Leverage Deployment Stacks for idempotent operations Azure/git-ape#44 on upstreammain. Phase 2 emitter parity tests are deferred until that lands.Acceptance criteria from Azure#55
git-ape-ci.ymlruns jobs in parallel and gates the PRschemas/git-ape/$defsregistry exists at_defs/v1.json(cross-file$refdeduplication is a documented follow-up)scripts/validate-schemas.shinvokable locally and from CIplugin.jsonitself validates againstschemas/git-ape/plugin/v1.jsontests/fixtures/README.mddocuments how to add a new fixture