Skip to content

Commit

Permalink
Merge pull request #1882 from estroz/feature/stabilize-go-v3
Browse files Browse the repository at this point in the history
⚠️ (go/v3) stabilize and default the plugin
  • Loading branch information
k8s-ci-robot committed Dec 14, 2020
2 parents 6e1f8d0 + dab613d commit 0a807f4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
8 changes: 2 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ func main() {
&pluginv2.Plugin{},
&pluginv3.Plugin{},
),
cli.WithDefaultPlugins(config.Version2,
&pluginv2.Plugin{},
),
cli.WithDefaultPlugins(config.Version3Alpha,
&pluginv2.Plugin{},
),
cli.WithDefaultPlugins(config.Version2, &pluginv2.Plugin{}),
cli.WithDefaultPlugins(config.Version3Alpha, &pluginv3.Plugin{}),
cli.WithCompletion,
)
if err != nil {
Expand Down
14 changes: 8 additions & 6 deletions generate_testdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ scaffold_test_project() {
cd testdata/$project
local kb=$testdata_dir/../bin/kubebuilder

# Remove tool binaries for non-plugin projects, which don't have locally-configured binaries,
# Remove tool binaries for projects of version 2, which don't have locally-configured binaries,
# so the correct versions are used.
if [[ ! $init_flags =~ --plugins ]]; then
if [[ $init_flags =~ --project-version=2 ]]; then
rm -f "$(command -v controller-gen)"
rm -f "$(command -v kustomize)"
fi
Expand Down Expand Up @@ -106,10 +106,12 @@ export GO111MODULE=on
export PATH="$PATH:$(go env GOPATH)/bin"

build_kb
# Project version 2 uses plugin go/v2 (default).
scaffold_test_project project-v2 --project-version=2
scaffold_test_project project-v2-multigroup --project-version=2
scaffold_test_project project-v2-addon --project-version=2
scaffold_test_project project-v3 --project-version=3-alpha --plugins=go/v3-alpha
scaffold_test_project project-v3-multigroup --project-version=3-alpha --plugins=go/v3-alpha
scaffold_test_project project-v3-addon --project-version=3-alpha --plugins=go/v3-alpha
scaffold_test_project project-v3-config --project-version=3-alpha --plugins=go/v3-alpha --component-config
# Project version 3 (default) uses plugin go/v3 (default).
scaffold_test_project project-v3
scaffold_test_project project-v3-multigroup
scaffold_test_project project-v3-addon
scaffold_test_project project-v3-config --component-config
2 changes: 1 addition & 1 deletion pkg/plugins/golang/v3/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const pluginName = "go" + plugins.DefaultNameQualifier

var (
supportedProjectVersions = []string{config.Version3Alpha}
pluginVersion = plugin.Version{Number: 3, Stage: plugin.AlphaStage}
pluginVersion = plugin.Version{Number: 3}
)

var _ plugin.Full = Plugin{}
Expand Down
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,6 @@ test_project project-v2-addon 2
test_project project-v3 3-alpha
test_project project-v3-multigroup 3-alpha
test_project project-v3-addon 3-alpha
test_project project-v3-config 3-alpha

exit $rc
7 changes: 4 additions & 3 deletions test/e2e/v3/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import (
func GenerateV2(kbc *utils.TestContext) {
var err error

By("initializing a v3 project")
By("initializing a project")
err = kbc.Init(
"--project-version", "3-alpha",
"--plugins", "go/v2",
"--domain", kbc.Domain,
"--fetch-deps=false",
)
Expand Down Expand Up @@ -126,10 +127,10 @@ Count int `+"`"+`json:"count,omitempty"`+"`"+`
func GenerateV3(kbc *utils.TestContext, crdAndWebhookVersion string) {
var err error

By("initializing a v3 project")
By("initializing a project")
err = kbc.Init(
"--plugins", "go/v3-alpha",
"--project-version", "3-alpha",
"--plugins", "go/v3",
"--domain", kbc.Domain,
"--fetch-deps=false",
)
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3-addon/PROJECT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
domain: testproject.org
layout: go.kubebuilder.io/v3-alpha
layout: go.kubebuilder.io/v3
projectName: project-v3-addon
repo: sigs.k8s.io/kubebuilder/testdata/project-v3-addon
resources:
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3-config/PROJECT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
componentConfig: true
domain: testproject.org
layout: go.kubebuilder.io/v3-alpha
layout: go.kubebuilder.io/v3
projectName: project-v3-config
repo: sigs.k8s.io/kubebuilder/testdata/project-v3-config
resources:
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3-multigroup/PROJECT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
domain: testproject.org
layout: go.kubebuilder.io/v3-alpha
layout: go.kubebuilder.io/v3
multigroup: true
projectName: project-v3-multigroup
repo: sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3/PROJECT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
domain: testproject.org
layout: go.kubebuilder.io/v3-alpha
layout: go.kubebuilder.io/v3
projectName: project-v3
repo: sigs.k8s.io/kubebuilder/testdata/project-v3
resources:
Expand Down

0 comments on commit 0a807f4

Please sign in to comment.