From 65c41bc5d940f4518913df0ec33bf6b1dcb9cbe9 Mon Sep 17 00:00:00 2001 From: Adam Wolfe Gordon Date: Thu, 25 Jun 2026 09:05:15 -0600 Subject: [PATCH] validate: Use crossplane:stable as the default image Now that the CLI version has diverged from the Crossplane core version, we can't assume there will always be a core Crossplane image with the CLI's version number. Use the `stable` tag, which gets updated with each release, as the default Crossplane image for `validate` so that we always point at the latest. Users can still select a different version using the `--crossplane-image` flag. Fixes #145 Signed-off-by: Adam Wolfe Gordon --- cmd/crossplane/validate/cmd.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/crossplane/validate/cmd.go b/cmd/crossplane/validate/cmd.go index 73b9a896..5eefbfb2 100644 --- a/cmd/crossplane/validate/cmd.go +++ b/cmd/crossplane/validate/cmd.go @@ -19,7 +19,6 @@ package validate import ( "context" - "fmt" "os" "path/filepath" "strings" @@ -29,7 +28,6 @@ import ( "github.com/crossplane/crossplane-runtime/v2/pkg/errors" "github.com/crossplane/crossplane-runtime/v2/pkg/logging" - "github.com/crossplane/crossplane-runtime/v2/pkg/version" "github.com/crossplane/cli/v2/cmd/crossplane/common/load" pkgvalidate "github.com/crossplane/cli/v2/pkg/validate" @@ -78,9 +76,9 @@ type Cmd struct { Resources string `arg:"" help:"Resource sources as a comma-separated list of files, directories, or '-' for standard input."` // Flags. Keep them in alphabetical order. - CacheDir string `default:"~/.crossplane/cache" help:"Absolute path to the cache directory for downloaded schemas." predictor:"directory"` + CacheDir string `default:"~/.crossplane/cache" help:"Absolute path to the cache directory for downloaded schemas." predictor:"directory"` CleanCache bool `help:"Clean the cache directory before downloading package schemas."` - CrossplaneImage string `help:"Specify the Crossplane image for validating built-in schemas."` + CrossplaneImage string `default:"xpkg.crossplane.io/crossplane/crossplane:stable" help:"Specify the Crossplane image for validating built-in schemas."` ErrorOnMissingSchemas bool `default:"false" help:"Return non zero exit code if missing schemas."` // rendererFlag.Decode rejects unknown formats, which is what Kong's // "enum" tag would normally enforce — but enum doesn't apply to @@ -112,10 +110,6 @@ func (c *Cmd) Run(k *kong.Context, _ logging.Logger) error { return errors.New("cannot use stdin for both extensions and resources") } - if len(c.CrossplaneImage) < 1 { - c.CrossplaneImage = fmt.Sprintf("xpkg.crossplane.io/crossplane/crossplane:%s", version.New().GetVersionString()) - } - // Load all extensions extensionLoader, err := load.NewLoader(c.Extensions) if err != nil {