Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
move back to build flag edition specification (#1800)
Browse files Browse the repository at this point in the history
This commit returns framework to setting the edition based on a build
flag. Due to v0.11.2 cherry-picking many commits, its picked up new
edition detection features that are missing ancillary commits. In
summary, setting an edition is entirely broken.

This reintroduces the edition build flag and still defaults builds to be
tkg, yet allows the TCE team to build a TCE version.

Signed-off-by: joshrosso <[email protected]>
  • Loading branch information
Josh Rosso authored Mar 8, 2022
1 parent 2017509 commit 6431d1d
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions apis/cli/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apis/config/v1alpha1/clientconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ type CLIOptions struct {
DiscoverySources []PluginDiscovery `json:"discoverySources,omitempty" yaml:"discoverySources"`
// UnstableVersionSelector determined which version tags are allowed
UnstableVersionSelector VersionSelectorLevel `json:"unstableVersionSelector,omitempty" yaml:"unstableVersionSelector"`
// Edition determines which editions plugins are running as
Edition string `json:"edition,omitempty" yaml:"edition"`
}

// PluginDiscovery contains a specific distribution mechanism. Only one of the
Expand Down
1 change: 1 addition & 0 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apis/run/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apis/run/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ BUILD_EDITION = tkg
endif

LD_FLAGS = -s -w
LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-framework/pkg/v1/buildinfo.Edition=$(BUILD_EDITION)'
LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-framework/pkg/v1/buildinfo.Date=$(BUILD_DATE)'
LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-framework/pkg/v1/buildinfo.SHA=$(BUILD_SHA)'
LD_FLAGS += -X 'github.com/vmware-tanzu/tanzu-framework/pkg/v1/buildinfo.Version=$(BUILD_VERSION)'
Expand Down
4 changes: 4 additions & 0 deletions pkg/v1/buildinfo/buildvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ var (
// Version is the version the binary was built with.
// Set by go build -ldflags "-X" flag
Version string

// Edition is the edition the binary was built for.
// Set by go build -ldflags "-X" flag
Edition string
)
6 changes: 6 additions & 0 deletions pkg/v1/config/clientconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer/json"

configv1alpha1 "github.com/vmware-tanzu/tanzu-framework/apis/config/v1alpha1"
"github.com/vmware-tanzu/tanzu-framework/pkg/v1/buildinfo"
"github.com/vmware-tanzu/tanzu-framework/pkg/v1/cli/common"
)

Expand Down Expand Up @@ -147,6 +148,7 @@ func NewClientConfig() (*configv1alpha1.ClientConfig, error) {
CLI: &configv1alpha1.CLIOptions{
Repositories: DefaultRepositories,
UnstableVersionSelector: DefaultVersionSelector,
Edition: buildinfo.Edition,
},
},
}
Expand Down Expand Up @@ -180,6 +182,10 @@ func addFeatureFlag(c *configv1alpha1.ClientConfig, plugin, flag string, flagVal
if c.ClientOptions == nil {
c.ClientOptions = &configv1alpha1.ClientOptions{}
}
// if edition is not set, set it to what was specified at build time
if c.ClientOptions.CLI.Edition == "" {
c.ClientOptions.CLI.Edition = buildinfo.Edition
}
if c.ClientOptions.Features == nil {
c.ClientOptions.Features = make(map[string]configv1alpha1.FeatureMap)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/v1/providers/client/manifest/providers_embeded.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build embedproviders
// +build embedproviders

// Package manifest...
Expand Down
1 change: 1 addition & 0 deletions pkg/v1/providers/client/manifest/providers_skipped.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build !embedproviders
// +build !embedproviders

// Package manifest ...
Expand Down
1 change: 1 addition & 0 deletions pkg/v1/sdk/capabilities/controllers/suite_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build envtest
// +build envtest

// Copyright 2021 VMware, Inc. All Rights Reserved.
Expand Down
1 change: 1 addition & 0 deletions pkg/v1/sdk/features/controllers/suite_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build envtest
// +build envtest

// Copyright 2021 VMware, Inc. All Rights Reserved.
Expand Down
1 change: 1 addition & 0 deletions pkg/v1/tkg/aws/ini/fuzz.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build gofuzz
// +build gofuzz

package ini
Expand Down

0 comments on commit 6431d1d

Please sign in to comment.