Skip to content

Crossplane Validation Action

A GitHub Action that automatically validates Crossplane XRD (CompositeResourceDefinition) and Composition files in pull requests using the Crossplane CLI's beta validate command.

The Problem

When building Crossplane XRDs and Compositions, validation is crucial to catch schema errors before they reach your clusters. Manual validation is error-prone, and running crossplane beta validate locally for every change is tedious.

I was doing this across multiple Crossplane repositories. Each time I made changes, I'd have to remember to run validation locally. Sometimes I'd forget, and issues would only surface after deployment. Without automated validation, teams discover issues only after deployment, requiring rollbacks and fixes.

The Solution

This action automatically validates Crossplane files in pull requests using the Crossplane CLI's offline validation capabilities. It detects changed files, runs validation, caches provider schemas for faster runs, and provides clear error reporting.

The real value is catching errors early. Invalid XRDs or Compositions fail the PR check, preventing bad configurations from reaching clusters. Teams get immediate feedback without manual validation steps.

Quick Example

yaml
- name: Validate Crossplane Files
  uses: michielvha/crossplane-validation-action@v1
  with:
    fail-on-error: true

The action automatically detects which Crossplane files changed in your PR, installs the Crossplane CLI, and validates them against their schemas using offline validation.

Why This Matters

Crossplane validation catches errors before they reach your clusters. By integrating validation into CI/CD pipelines, teams prevent invalid configurations from being deployed, get immediate feedback on PRs, and reduce debugging time in production.

For detailed usage, configuration options, and examples, see the GitHub repository.