An open-source, faster Devin alternative
TypeScript
fix(cli): canonicalize Flue builder version
Igor Zalutski205ce408a475
diff --git a/cmd/oc/internal/fluebuild/fluebuild.go b/cmd/oc/internal/fluebuild/fluebuild.goindex 7aa260ad..3d9b287f 100644--- a/cmd/oc/internal/fluebuild/fluebuild.go+++ b/cmd/oc/internal/fluebuild/fluebuild.go@@ -177,6 +177,9 @@ func Build(ctx context.Context, opts Options) (Result, error) {if opts.BuilderVersion == "" {opts.BuilderVersion = "dev"}+ if !strings.HasPrefix(opts.BuilderVersion, "oc@") {+ opts.BuilderVersion = "oc@" + opts.BuilderVersion+ }projection, err := inspect(ctx, opts.Dir, opts.BuilderVersion, opts.NodeVersion)if err != nil {@@ -270,8 +273,8 @@ func ValidateDeployment(deployment Deployment, requireArtifact bool) error {if deployment.Runtime.Family != "flue" || deployment.Runtime.Type == "" {return fmt.Errorf("deployment runtime must contain family=flue and a type")}- if strings.TrimSpace(deployment.Builder.Version) == "" {- return fmt.Errorf("deployment builder.version is required")+ if !strings.HasPrefix(deployment.Builder.Version, "oc@") || strings.TrimPrefix(deployment.Builder.Version, "oc@") == "" {+ return fmt.Errorf("deployment builder.version must use oc@<version>")}if !requireArtifact {if deployment.Flue.Wrangler != nil || deployment.Bundle != nil {diff --git a/cmd/oc/internal/fluebuild/testdata/check-only.json b/cmd/oc/internal/fluebuild/testdata/check-only.jsonindex c4f40411..cef0d14f 100644--- a/cmd/oc/internal/fluebuild/testdata/check-only.json+++ b/cmd/oc/internal/fluebuild/testdata/check-only.json@@ -13,6 +13,6 @@"type": "default"},"builder": {- "version": "0.6.0.9-test"+ "version": "[email protected]"}}diff --git a/cmd/oc/internal/fluebuild/testdata/deployment.json b/cmd/oc/internal/fluebuild/testdata/deployment.jsonindex 312cbdff..5590f96f 100644--- a/cmd/oc/internal/fluebuild/testdata/deployment.json+++ b/cmd/oc/internal/fluebuild/testdata/deployment.json@@ -37,6 +37,6 @@"size_bytes": 202},"builder": {- "version": "0.6.0.9-test"+ "version": "[email protected]"}}