Skip to content

ci: cache kubeconform schemas instead of re-fetching every run - #22

Merged
jonathandieu merged 3 commits into
mainfrom
cache-kubeconform-schemas
Jul 9, 2026
Merged

ci: cache kubeconform schemas instead of re-fetching every run#22
jonathandieu merged 3 commits into
mainfrom
cache-kubeconform-schemas

Conversation

@jonathandieu

Copy link
Copy Markdown
Owner

Found while debugging PR #21's CI failures - both the helm and argocd-validate jobs were failing with giving up after 3 attempt(s) fetching schemas from raw.githubusercontent.com/yannh/kubernetes-json-schema. Confirmed directly (curl against the exact failing URLs returned HTTP 429) - GitHub Actions' shared runner IP range is rate-limited there, and it's independent of anything in these PRs' actual changes.

-schema-location default isn't bundled/offline like the name suggests - it's a remote URL pattern, fetched fresh per resource kind on every single run with zero caching. A chart like cert-manager alone needs ~15 distinct schema files (ServiceAccount, ClusterRole, Deployment, Job, webhooks, etc.), and argocd-validate fetches more per ApplicationSet. That's a lot of requests per PR, against an IP range shared with every other repo's CI on GitHub.

Fix: kubeconform -cache <dir>, paired with actions/cache to persist that directory across runs. Schemas only need to come from the network once per kubernetes-version (1.36.0 here) - every run after that reuses the cache.

-schema-location default isn't bundled/offline - it's a remote URL
pattern (raw.githubusercontent.com/yannh/kubernetes-json-schema),
fetched fresh per resource kind on every single CI run, no caching.
That's dozens of requests per run against a shared, heavily-used GitHub
Actions IP range, and it's been hitting HTTP 429 rate limits often
enough to fail both the helm and argocd-validate jobs outright.

kubeconform has a -cache flag built in for exactly this. Paired with
actions/cache to persist the directory across runs, schemas only need
to be fetched from the network once (per kubernetes-version), not on
every PR.
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Helm template diff

diff -u --recursive --label base --label head base head
--- base
+++ head
@@ -218,7 +218,7 @@
     app.kubernetes.io/managed-by: Helm
 type: Opaque
 data:
-  SECRET_KEY_BASE: cXBFVUJwOWVMb0RKVWtqQ3JrUWZZV1REN3pyTXBEaml1RmtWaW10R3JlQ1BxQ1BRNGplNnFrSUlaVXZLOEdzWUF0N0tBeDJ6eXE3d3lMVERMMDhlWDFqZDZy
+  SECRET_KEY_BASE: UFVDWUtuZEtKME1XUU1Idk9JMTQ3OFIxdGV1dWRwWTNzVXVrM01PN1plam0wTTFmbUE4OUNHV0JwajFvd2F1SVVJN0toTGRMSG5tenVGTEplWHdBVENwbXEz
   TOTP_VAULT_KEY: ZHN4dmJuM2p4RGQxNmF6MlFwc1g1QjhPK2xseGpRMlNKRTJpNUJ6eDM4ST0=
   DATABASE_URL: cG9zdGdyZXM6Ly9wb3N0Z3Jlczpwb3N0Z3Jlc0BwbGF1c2libGUtYW5hbHl0aWNzLXBvc3RncmVzcWw6NTQzMi9wbGF1c2libGVfZGI=
   CLICKHOUSE_DATABASE_URL: aHR0cDovL2NsaWNraG91c2U6cGFzc3dvcmRAcGxhdXNpYmxlLWFuYWx5dGljcy1jbGlja2hvdXNlOjgxMjMvcGxhdXNpYmxlX2V2ZW50c19kYg==

…he hit

actions/cache only creates the restored directory on a hit. On the
first run for a given key it's a miss, so the dir never exists and
-cache fails immediately with 'no such file or directory'.
@jonathandieu
jonathandieu requested a review from Copilot July 9, 2026 02:12
@jonathandieu
jonathandieu marked this pull request as ready for review July 9, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI workflow to reduce kubeconform schema fetch failures (HTTP 429 rate limiting) by persisting kubeconform’s downloaded JSON schemas across workflow runs using kubeconform -cache plus actions/cache.

Changes:

  • Add actions/cache steps to persist /tmp/kubeconform-cache across runs.
  • Create the cache directory before running kubeconform in both helm and argocd-validate jobs.
  • Add -cache /tmp/kubeconform-cache to kubeconform invocations to reuse previously fetched schemas.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +37 to +41
- name: Cache kubeconform schemas
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: /tmp/kubeconform-cache
key: kubeconform-schemas-v1.36.0
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +94 to +98
- name: Cache kubeconform schemas
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: /tmp/kubeconform-cache
key: kubeconform-schemas-v1.36.0
@jonathandieu jonathandieu self-assigned this Jul 9, 2026
actions/cache caches are immutable per key - the fixed key only ever
captured whatever schemas the first run needed, so any resource kind
added later would hit the network on every run forever without ever
getting persisted, contradicting the whole point of caching them.

A per-run key (github.run_id) plus a restore-keys prefix lets each run
start from the most recent cache and save its own snapshot forward, so
the cache can actually grow as new resource kinds show up.
@jonathandieu
jonathandieu merged commit d3bd3e0 into main Jul 9, 2026
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants