Skip to content

Commit

Permalink
Check the Crossplane version constraint
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed Jun 14, 2023
1 parent 680e93e commit e43e144
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/linter/lint-provider-family/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
streamFile = "package.yaml"
labelFamily = "pkg.crossplane.io/provider-family"
annotationAuthConfig = "auth.upbound.io/config"
constraintXPVersion = ">=v1.12.1-0"
)

var (
Expand Down Expand Up @@ -112,8 +113,8 @@ func lint(config *ssopLinterConfig) error { //nolint:gocyclo // sequential flow
repoName = familyConfigPackageName
}

packageURL := fmt.Sprintf(packageURLFormatTagged, repoName, *config.providerVersion)
if _, ok := metaMap[group]; !ok {
packageURL := fmt.Sprintf(packageURLFormatTagged, repoName, *config.providerVersion)
xpkg, err := getPackageMetadata(context.TODO(), packageURL)
if err != nil {
return errors.Wrapf(err, "failed to get package metadata for provider package: %s", packageURL)
Expand Down Expand Up @@ -169,6 +170,10 @@ func lint(config *ssopLinterConfig) error { //nolint:gocyclo // sequential flow
if group != *config.providerName && (len(m.Spec.DependsOn) != 1 || m.Spec.DependsOn[0].Provider == nil || *m.Spec.DependsOn[0].Provider != familyConfigPackageRef) {
log.Fatalln("Missing dependency to family config package: ", e.Name())
}
// check the version constraint on Crossplane version
if m.Spec.Crossplane == nil || m.Spec.Crossplane.Version != constraintXPVersion {
log.Fatalf("Package metadata must declare a Crossplane version constraint to %q: %s\n", constraintXPVersion, packageURL)
}
break
}
if !foundMeta {
Expand Down

0 comments on commit e43e144

Please sign in to comment.