diff --git a/changelog/fragments/scorecard-move-alpha.yaml b/changelog/fragments/scorecard-move-alpha.yaml new file mode 100644 index 00000000000..38dc322a4ef --- /dev/null +++ b/changelog/fragments/scorecard-move-alpha.yaml @@ -0,0 +1,27 @@ +entries: + - description: > + Changes the alpha scorecard command to become the standard scorecard + command. + + kind: "change" + + # Is this a breaking change? + breaking: true + + # NOTE: ONLY USE `pull_request_override` WHEN ADDING THIS + # FILE FOR A PREVIOUSLY MERGED PULL_REQUEST! + # + # The generator auto-detects the PR number from the commit + # message in which this file was originally added. + # + # What is the pull request number (without the "#")? + # pull_request_override: 0 + + + # Migration can be defined to automatically add a section to + # the migration guide. This is required for breaking changes. + migration: + header: Move scorecard/alpha to scorecard + body: | + If you referenced 'operator-sdk alpha scorecard', you will + need to update them to use 'operator-sdk scorecard'. diff --git a/cmd/operator-sdk/alpha/alpha_suite_test.go b/cmd/operator-sdk/alpha/alpha_suite_test.go deleted file mode 100644 index 9a5314206d1..00000000000 --- a/cmd/operator-sdk/alpha/alpha_suite_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package alpha - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestAlpha(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Alpha Suite") -} diff --git a/cmd/operator-sdk/alpha/cmd.go b/cmd/operator-sdk/alpha/cmd.go deleted file mode 100644 index b8f607abada..00000000000 --- a/cmd/operator-sdk/alpha/cmd.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package alpha - -import ( - "github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/scorecard" - - "github.com/spf13/cobra" -) - -func NewCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "alpha", - Short: "Run an alpha subcommand", - } - - cmd.AddCommand( - scorecard.NewCmd(), - ) - return cmd -} diff --git a/cmd/operator-sdk/alpha/cmd_test.go b/cmd/operator-sdk/alpha/cmd_test.go deleted file mode 100644 index d171886a150..00000000000 --- a/cmd/operator-sdk/alpha/cmd_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package alpha - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Running an alpha command", func() { - Describe("NewCmd", func() { - It("builds and returns a cobra command with the correct subcommand", func() { - cmd := NewCmd() - Expect(cmd).NotTo(BeNil()) - - subcommands := cmd.Commands() - Expect(len(subcommands)).To(Equal(1)) - Expect(subcommands[0].Use).To(Equal("scorecard")) - }) - }) -}) diff --git a/cmd/operator-sdk/bundle/create.go b/cmd/operator-sdk/bundle/create.go index aad17e160ae..9ca5488c0a4 100644 --- a/cmd/operator-sdk/bundle/create.go +++ b/cmd/operator-sdk/bundle/create.go @@ -28,7 +28,7 @@ import ( "github.com/blang/semver" "github.com/operator-framework/operator-registry/pkg/lib/bundle" - scorecard "github.com/operator-framework/operator-sdk/internal/scorecard/alpha" + "github.com/operator-framework/operator-sdk/internal/scorecard" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" diff --git a/cmd/operator-sdk/cli/cli.go b/cmd/operator-sdk/cli/cli.go index f1bca30451d..ce7f98b3605 100644 --- a/cmd/operator-sdk/cli/cli.go +++ b/cmd/operator-sdk/cli/cli.go @@ -15,7 +15,6 @@ package cli import ( - "github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/build" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/bundle" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/cleanup" @@ -24,6 +23,7 @@ import ( "github.com/operator-framework/operator-sdk/cmd/operator-sdk/new" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/olm" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/run" + "github.com/operator-framework/operator-sdk/cmd/operator-sdk/scorecard" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/version" "github.com/operator-framework/operator-sdk/internal/flags" golangv2 "github.com/operator-framework/operator-sdk/internal/plugins/golang/v2" @@ -40,8 +40,7 @@ var commands = []*cobra.Command{ // The "new" cmd provides a way to scaffold Helm/Ansible projects // from the new CLI. new.NewCmd(), - - alpha.NewCmd(), + scorecard.NewCmd(), build.NewCmd(), bundle.NewCmd(), cleanup.NewCmd(), diff --git a/cmd/operator-sdk/cli/legacy.go b/cmd/operator-sdk/cli/legacy.go index 344b9cc537b..f21031569ae 100644 --- a/cmd/operator-sdk/cli/legacy.go +++ b/cmd/operator-sdk/cli/legacy.go @@ -20,13 +20,13 @@ import ( "github.com/spf13/viper" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/add" - "github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/build" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/bundle" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/completion" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/generate" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/new" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/olm" + "github.com/operator-framework/operator-sdk/cmd/operator-sdk/scorecard" "github.com/operator-framework/operator-sdk/cmd/operator-sdk/version" "github.com/operator-framework/operator-sdk/internal/flags" "github.com/operator-framework/operator-sdk/internal/util/projutil" @@ -64,9 +64,9 @@ func GetCLIRoot() *cobra.Command { root.AddCommand( add.NewCmd(), - alpha.NewCmd(), build.NewCmd(), bundle.NewCmdLegacy(), + scorecard.NewCmd(), completion.NewCmd(), generate.NewCmdLegacy(), new.NewCmd(), diff --git a/cmd/operator-sdk/alpha/scorecard/cmd.go b/cmd/operator-sdk/scorecard/cmd.go similarity index 98% rename from cmd/operator-sdk/alpha/scorecard/cmd.go rename to cmd/operator-sdk/scorecard/cmd.go index 8a7ba4d9ad0..0cf3b951bd8 100644 --- a/cmd/operator-sdk/alpha/scorecard/cmd.go +++ b/cmd/operator-sdk/scorecard/cmd.go @@ -31,7 +31,7 @@ import ( "github.com/operator-framework/operator-sdk/internal/flags" registryutil "github.com/operator-framework/operator-sdk/internal/registry" - scorecard "github.com/operator-framework/operator-sdk/internal/scorecard/alpha" + "github.com/operator-framework/operator-sdk/internal/scorecard" "github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha3" ) diff --git a/cmd/operator-sdk/alpha/scorecard/cmd_test.go b/cmd/operator-sdk/scorecard/cmd_test.go similarity index 97% rename from cmd/operator-sdk/alpha/scorecard/cmd_test.go rename to cmd/operator-sdk/scorecard/cmd_test.go index 9a0edc64e1b..b4a48602222 100644 --- a/cmd/operator-sdk/alpha/scorecard/cmd_test.go +++ b/cmd/operator-sdk/scorecard/cmd_test.go @@ -19,7 +19,7 @@ import ( . "github.com/onsi/gomega" ) -var _ = Describe("Running an alpha scorecard command", func() { +var _ = Describe("Running the scorecard command", func() { Describe("NewCmd", func() { It("builds and returns a cobra command", func() { cmd := NewCmd() diff --git a/cmd/operator-sdk/alpha/scorecard/scorecard_suite_test.go b/cmd/operator-sdk/scorecard/scorecard_suite_test.go similarity index 100% rename from cmd/operator-sdk/alpha/scorecard/scorecard_suite_test.go rename to cmd/operator-sdk/scorecard/scorecard_suite_test.go diff --git a/images/scorecard-test/cmd/test/main.go b/images/scorecard-test/cmd/test/main.go index a25cfca7f98..17a3ad5e9cb 100644 --- a/images/scorecard-test/cmd/test/main.go +++ b/images/scorecard-test/cmd/test/main.go @@ -23,8 +23,8 @@ import ( apimanifests "github.com/operator-framework/api/pkg/manifests" registryutil "github.com/operator-framework/operator-sdk/internal/registry" - scorecard "github.com/operator-framework/operator-sdk/internal/scorecard/alpha" - "github.com/operator-framework/operator-sdk/internal/scorecard/alpha/tests" + "github.com/operator-framework/operator-sdk/internal/scorecard" + "github.com/operator-framework/operator-sdk/internal/scorecard/tests" scapiv1alpha3 "github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha3" ) diff --git a/internal/scorecard/alpha/bundle.go b/internal/scorecard/bundle.go similarity index 99% rename from internal/scorecard/alpha/bundle.go rename to internal/scorecard/bundle.go index 6480201883f..2626a3f5093 100644 --- a/internal/scorecard/alpha/bundle.go +++ b/internal/scorecard/bundle.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "archive/tar" diff --git a/internal/scorecard/alpha/bundle_test.go b/internal/scorecard/bundle_test.go similarity index 99% rename from internal/scorecard/alpha/bundle_test.go rename to internal/scorecard/bundle_test.go index 30739e74622..a546fbe3e95 100644 --- a/internal/scorecard/alpha/bundle_test.go +++ b/internal/scorecard/bundle_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "archive/tar" diff --git a/internal/scorecard/alpha/config.go b/internal/scorecard/config.go similarity index 99% rename from internal/scorecard/alpha/config.go rename to internal/scorecard/config.go index 2eef8a60453..5e4791dca78 100644 --- a/internal/scorecard/alpha/config.go +++ b/internal/scorecard/config.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "io/ioutil" diff --git a/internal/scorecard/alpha/config_test.go b/internal/scorecard/config_test.go similarity index 98% rename from internal/scorecard/alpha/config_test.go rename to internal/scorecard/config_test.go index 80a4471736a..5efa64814b0 100644 --- a/internal/scorecard/alpha/config_test.go +++ b/internal/scorecard/config_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "testing" diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/Makefile b/internal/scorecard/examples/custom-scorecard-tests/Makefile similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/Makefile rename to internal/scorecard/examples/custom-scorecard-tests/Makefile diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/manifests/cache.example.com_memcacheds_crd.yaml b/internal/scorecard/examples/custom-scorecard-tests/bundle/manifests/cache.example.com_memcacheds_crd.yaml similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/manifests/cache.example.com_memcacheds_crd.yaml rename to internal/scorecard/examples/custom-scorecard-tests/bundle/manifests/cache.example.com_memcacheds_crd.yaml diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/internal/scorecard/examples/custom-scorecard-tests/bundle/manifests/memcached-operator.clusterserviceversion.yaml similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/manifests/memcached-operator.clusterserviceversion.yaml rename to internal/scorecard/examples/custom-scorecard-tests/bundle/manifests/memcached-operator.clusterserviceversion.yaml diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/metadata/annotations.yaml b/internal/scorecard/examples/custom-scorecard-tests/bundle/metadata/annotations.yaml similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/metadata/annotations.yaml rename to internal/scorecard/examples/custom-scorecard-tests/bundle/metadata/annotations.yaml diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/tests/scorecard/config.yaml b/internal/scorecard/examples/custom-scorecard-tests/bundle/tests/scorecard/config.yaml similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/bundle/tests/scorecard/config.yaml rename to internal/scorecard/examples/custom-scorecard-tests/bundle/tests/scorecard/config.yaml diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/go.mod b/internal/scorecard/examples/custom-scorecard-tests/go.mod similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/go.mod rename to internal/scorecard/examples/custom-scorecard-tests/go.mod diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/Dockerfile b/internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/Dockerfile similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/Dockerfile rename to internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/Dockerfile diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/entrypoint b/internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/entrypoint similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/entrypoint rename to internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/entrypoint diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/user_setup b/internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/user_setup similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/user_setup rename to internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/bin/user_setup diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go b/internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go similarity index 94% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go rename to internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go index a187d9fe94f..01f3ef4d755 100644 --- a/internal/scorecard/alpha/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go +++ b/internal/scorecard/examples/custom-scorecard-tests/images/custom-scorecard-tests/cmd/test/main.go @@ -20,8 +20,8 @@ import ( "log" "os" - scorecard "github.com/operator-framework/operator-sdk/internal/scorecard/alpha" - "github.com/operator-framework/operator-sdk/internal/scorecard/alpha/examples/custom-scorecard-tests/internal/tests" + "github.com/operator-framework/operator-sdk/internal/scorecard" + "github.com/operator-framework/operator-sdk/internal/scorecard/examples/custom-scorecard-tests/internal/tests" apimanifests "github.com/operator-framework/api/pkg/manifests" scapiv1alpha3 "github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha3" @@ -51,7 +51,7 @@ func main() { var result scapiv1alpha3.TestStatus // Names of the custom tests which would be passed in the - // `operator-sdk alpha` command. + // `operator-sdk` command. switch entrypoint[0] { case tests.CustomTest1Name: result = tests.CustomTest1(cfg) diff --git a/internal/scorecard/alpha/examples/custom-scorecard-tests/internal/tests/tests.go b/internal/scorecard/examples/custom-scorecard-tests/internal/tests/tests.go similarity index 100% rename from internal/scorecard/alpha/examples/custom-scorecard-tests/internal/tests/tests.go rename to internal/scorecard/examples/custom-scorecard-tests/internal/tests/tests.go diff --git a/internal/scorecard/alpha/formatting.go b/internal/scorecard/formatting.go similarity index 98% rename from internal/scorecard/alpha/formatting.go rename to internal/scorecard/formatting.go index 389a3698a6b..a6b7c0622a3 100644 --- a/internal/scorecard/alpha/formatting.go +++ b/internal/scorecard/formatting.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "context" diff --git a/internal/scorecard/alpha/formatting_test.go b/internal/scorecard/formatting_test.go similarity index 98% rename from internal/scorecard/alpha/formatting_test.go rename to internal/scorecard/formatting_test.go index 02b482987e7..a1d60523bb4 100644 --- a/internal/scorecard/alpha/formatting_test.go +++ b/internal/scorecard/formatting_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "path/filepath" diff --git a/internal/scorecard/alpha/kubeclient.go b/internal/scorecard/kubeclient.go similarity index 98% rename from internal/scorecard/alpha/kubeclient.go rename to internal/scorecard/kubeclient.go index 8164c970ccd..5ac83e99241 100644 --- a/internal/scorecard/alpha/kubeclient.go +++ b/internal/scorecard/kubeclient.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "os" diff --git a/internal/scorecard/alpha/labels_test.go b/internal/scorecard/labels_test.go similarity index 99% rename from internal/scorecard/alpha/labels_test.go rename to internal/scorecard/labels_test.go index 8bd4d2d6055..bbdf7050720 100644 --- a/internal/scorecard/alpha/labels_test.go +++ b/internal/scorecard/labels_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "testing" diff --git a/internal/scorecard/alpha/run_test.go b/internal/scorecard/run_test.go similarity index 99% rename from internal/scorecard/alpha/run_test.go rename to internal/scorecard/run_test.go index 84a5d8032a8..5a92aa16ce4 100644 --- a/internal/scorecard/alpha/run_test.go +++ b/internal/scorecard/run_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "context" diff --git a/internal/scorecard/alpha/scorecard.go b/internal/scorecard/scorecard.go similarity index 99% rename from internal/scorecard/alpha/scorecard.go rename to internal/scorecard/scorecard.go index 623e35bf78f..42faed87d78 100644 --- a/internal/scorecard/alpha/scorecard.go +++ b/internal/scorecard/scorecard.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "context" diff --git a/internal/scorecard/alpha/tar.go b/internal/scorecard/tar.go similarity index 99% rename from internal/scorecard/alpha/tar.go rename to internal/scorecard/tar.go index 2e7dcae60a0..e71cfa66e55 100644 --- a/internal/scorecard/alpha/tar.go +++ b/internal/scorecard/tar.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "archive/tar" diff --git a/internal/scorecard/alpha/testconfigmap.go b/internal/scorecard/testconfigmap.go similarity index 99% rename from internal/scorecard/alpha/testconfigmap.go rename to internal/scorecard/testconfigmap.go index a27aa227b32..f0e48cbcba8 100644 --- a/internal/scorecard/alpha/testconfigmap.go +++ b/internal/scorecard/testconfigmap.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "context" diff --git a/internal/scorecard/alpha/testdata/bundle.tar.gz b/internal/scorecard/testdata/bundle.tar.gz similarity index 100% rename from internal/scorecard/alpha/testdata/bundle.tar.gz rename to internal/scorecard/testdata/bundle.tar.gz diff --git a/internal/scorecard/alpha/testdata/bundle/manifests/cache.example.com_memcacheds_crd.yaml b/internal/scorecard/testdata/bundle/manifests/cache.example.com_memcacheds_crd.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/manifests/cache.example.com_memcacheds_crd.yaml rename to internal/scorecard/testdata/bundle/manifests/cache.example.com_memcacheds_crd.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/internal/scorecard/testdata/bundle/manifests/memcached-operator.clusterserviceversion.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/manifests/memcached-operator.clusterserviceversion.yaml rename to internal/scorecard/testdata/bundle/manifests/memcached-operator.clusterserviceversion.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/metadata/annotations.yaml b/internal/scorecard/testdata/bundle/metadata/annotations.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/metadata/annotations.yaml rename to internal/scorecard/testdata/bundle/metadata/annotations.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/tests/scorecard/config.yaml b/internal/scorecard/testdata/bundle/tests/scorecard/config.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/tests/scorecard/config.yaml rename to internal/scorecard/testdata/bundle/tests/scorecard/config.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/kuttl-test.yaml b/internal/scorecard/testdata/bundle/tests/scorecard/kuttl/kuttl-test.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/kuttl-test.yaml rename to internal/scorecard/testdata/bundle/tests/scorecard/kuttl/kuttl-test.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/list-pods/00-assert.yaml b/internal/scorecard/testdata/bundle/tests/scorecard/kuttl/list-pods/00-assert.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/list-pods/00-assert.yaml rename to internal/scorecard/testdata/bundle/tests/scorecard/kuttl/list-pods/00-assert.yaml diff --git a/internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/list-pods/00-pod.yaml b/internal/scorecard/testdata/bundle/tests/scorecard/kuttl/list-pods/00-pod.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/bundle/tests/scorecard/kuttl/list-pods/00-pod.yaml rename to internal/scorecard/testdata/bundle/tests/scorecard/kuttl/list-pods/00-pod.yaml diff --git a/internal/scorecard/alpha/testdata/pod.yaml b/internal/scorecard/testdata/pod.yaml similarity index 100% rename from internal/scorecard/alpha/testdata/pod.yaml rename to internal/scorecard/testdata/pod.yaml diff --git a/internal/scorecard/alpha/testpod.go b/internal/scorecard/testpod.go similarity index 99% rename from internal/scorecard/alpha/testpod.go rename to internal/scorecard/testpod.go index c1abc96315d..1f990f3a47e 100644 --- a/internal/scorecard/alpha/testpod.go +++ b/internal/scorecard/testpod.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package alpha +package scorecard import ( "bytes" diff --git a/internal/scorecard/alpha/tests/basic.go b/internal/scorecard/tests/basic.go similarity index 100% rename from internal/scorecard/alpha/tests/basic.go rename to internal/scorecard/tests/basic.go diff --git a/internal/scorecard/alpha/tests/bundle_test.go b/internal/scorecard/tests/bundle_test.go similarity index 100% rename from internal/scorecard/alpha/tests/bundle_test.go rename to internal/scorecard/tests/bundle_test.go diff --git a/internal/scorecard/alpha/tests/crhelper.go b/internal/scorecard/tests/crhelper.go similarity index 100% rename from internal/scorecard/alpha/tests/crhelper.go rename to internal/scorecard/tests/crhelper.go diff --git a/internal/scorecard/alpha/tests/olm.go b/internal/scorecard/tests/olm.go similarity index 100% rename from internal/scorecard/alpha/tests/olm.go rename to internal/scorecard/tests/olm.go diff --git a/website/content/en/docs/cli/operator-sdk.md b/website/content/en/docs/cli/operator-sdk.md index c4f8c49d0ca..58b6921157f 100644 --- a/website/content/en/docs/cli/operator-sdk.md +++ b/website/content/en/docs/cli/operator-sdk.md @@ -18,12 +18,12 @@ An SDK for building operators with ease ### SEE ALSO * [operator-sdk add](../operator-sdk_add) - Adds a controller or resource to the project -* [operator-sdk alpha](../operator-sdk_alpha) - Run an alpha subcommand * [operator-sdk build](../operator-sdk_build) - Compiles code and builds artifacts * [operator-sdk bundle](../operator-sdk_bundle) - Manage operator bundle metadata * [operator-sdk completion](../operator-sdk_completion) - Generators for shell completions * [operator-sdk generate](../operator-sdk_generate) - Invokes a specific generator * [operator-sdk new](../operator-sdk_new) - Creates a new operator application * [operator-sdk olm](../operator-sdk_olm) - Manage the Operator Lifecycle Manager installation in your cluster +* [operator-sdk scorecard](../operator-sdk_scorecard) - Runs scorecard * [operator-sdk version](../operator-sdk_version) - Prints the version of operator-sdk diff --git a/website/content/en/docs/cli/operator-sdk_alpha.md b/website/content/en/docs/cli/operator-sdk_alpha.md deleted file mode 100644 index 4cf5b5a6dbb..00000000000 --- a/website/content/en/docs/cli/operator-sdk_alpha.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "operator-sdk alpha" ---- -## operator-sdk alpha - -Run an alpha subcommand - -### Synopsis - -Run an alpha subcommand - -### Options - -``` - -h, --help help for alpha -``` - -### SEE ALSO - -* [operator-sdk](../operator-sdk) - An SDK for building operators with ease -* [operator-sdk alpha scorecard](../operator-sdk_alpha_scorecard) - Runs scorecard - diff --git a/website/content/en/docs/cli/operator-sdk_alpha_scorecard.md b/website/content/en/docs/cli/operator-sdk_scorecard.md similarity index 85% rename from website/content/en/docs/cli/operator-sdk_alpha_scorecard.md rename to website/content/en/docs/cli/operator-sdk_scorecard.md index 49582e992e0..c5df090c3fe 100644 --- a/website/content/en/docs/cli/operator-sdk_alpha_scorecard.md +++ b/website/content/en/docs/cli/operator-sdk_scorecard.md @@ -1,7 +1,7 @@ --- -title: "operator-sdk alpha scorecard" +title: "operator-sdk scorecard" --- -## operator-sdk alpha scorecard +## operator-sdk scorecard Runs scorecard @@ -12,7 +12,7 @@ one argument, either a bundle image or directory containing manifests and metada If the argument holds an image tag, it must be present remotely. ``` -operator-sdk alpha scorecard [flags] +operator-sdk scorecard [flags] ``` ### Options @@ -32,5 +32,5 @@ operator-sdk alpha scorecard [flags] ### SEE ALSO -* [operator-sdk alpha](../operator-sdk_alpha) - Run an alpha subcommand +* [operator-sdk](../operator-sdk) - An SDK for building operators with ease diff --git a/website/content/en/docs/new-cli/operator-sdk.md b/website/content/en/docs/new-cli/operator-sdk.md index 9642679c8e6..cceac4a438c 100644 --- a/website/content/en/docs/new-cli/operator-sdk.md +++ b/website/content/en/docs/new-cli/operator-sdk.md @@ -66,7 +66,6 @@ operator-sdk [flags] ### SEE ALSO -* [operator-sdk alpha](../operator-sdk_alpha) - Run an alpha subcommand * [operator-sdk build](../operator-sdk_build) - Compiles code and builds artifacts * [operator-sdk bundle](../operator-sdk_bundle) - Manage operator bundle metadata * [operator-sdk cleanup](../operator-sdk_cleanup) - Clean up an Operator deployed with the 'run' subcommand @@ -77,5 +76,6 @@ operator-sdk [flags] * [operator-sdk new](../operator-sdk_new) - Creates a new operator application * [operator-sdk olm](../operator-sdk_olm) - Manage the Operator Lifecycle Manager installation in your cluster * [operator-sdk run](../operator-sdk_run) - Run an Operator in a variety of environments +* [operator-sdk scorecard](../operator-sdk_scorecard) - Runs scorecard * [operator-sdk version](../operator-sdk_version) - Prints the version of operator-sdk diff --git a/website/content/en/docs/new-cli/operator-sdk_alpha.md b/website/content/en/docs/new-cli/operator-sdk_alpha.md deleted file mode 100644 index 5ea6b57a3db..00000000000 --- a/website/content/en/docs/new-cli/operator-sdk_alpha.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "operator-sdk alpha" ---- -## operator-sdk alpha - -Run an alpha subcommand - -### Synopsis - -Run an alpha subcommand - -### Options - -``` - -h, --help help for alpha -``` - -### Options inherited from parent commands - -``` - --verbose Enable verbose logging -``` - -### SEE ALSO - -* [operator-sdk](../operator-sdk) - Development kit for building Kubernetes extensions and tools. -* [operator-sdk alpha scorecard](../operator-sdk_alpha_scorecard) - Runs scorecard - diff --git a/website/content/en/docs/new-cli/operator-sdk_alpha_scorecard.md b/website/content/en/docs/new-cli/operator-sdk_scorecard.md similarity index 86% rename from website/content/en/docs/new-cli/operator-sdk_alpha_scorecard.md rename to website/content/en/docs/new-cli/operator-sdk_scorecard.md index d6e097cd119..abaf9c63519 100644 --- a/website/content/en/docs/new-cli/operator-sdk_alpha_scorecard.md +++ b/website/content/en/docs/new-cli/operator-sdk_scorecard.md @@ -1,7 +1,7 @@ --- -title: "operator-sdk alpha scorecard" +title: "operator-sdk scorecard" --- -## operator-sdk alpha scorecard +## operator-sdk scorecard Runs scorecard @@ -12,7 +12,7 @@ one argument, either a bundle image or directory containing manifests and metada If the argument holds an image tag, it must be present remotely. ``` -operator-sdk alpha scorecard [flags] +operator-sdk scorecard [flags] ``` ### Options @@ -38,5 +38,5 @@ operator-sdk alpha scorecard [flags] ### SEE ALSO -* [operator-sdk alpha](../operator-sdk_alpha) - Run an alpha subcommand +* [operator-sdk](../operator-sdk) - Development kit for building Kubernetes extensions and tools. diff --git a/website/content/en/docs/scorecard/custom-tests.md b/website/content/en/docs/scorecard/custom-tests.md index bf02b761837..7b909d6d579 100644 --- a/website/content/en/docs/scorecard/custom-tests.md +++ b/website/content/en/docs/scorecard/custom-tests.md @@ -3,8 +3,6 @@ title: Writing Custom Scorecard Tests weight: 50 --- -# Custom Tests using Operator SDK Scorecard - This guide outlines the steps which can be followed to extend the existing scorecard tests and implement operator specific custom tests. ## Run scorecard with custom tests: @@ -52,14 +50,14 @@ The sample test image repository present [here][custom_scorecard_repo] has the f Scorecard currently implements a few [basic][basic_tests] and [olm][olm_tests] tests for the image bundle, custom resources and custom resource definitions. Additional tests specific to the operator can also be included in the test suite of scorecard. -The `tests.go` file is where the custom tests are implemented in the sample test image project. These tests use `scapiv1alpha2.ScorecardTestResult` struct to populate the result, which is then converted to json format for the output. For example, the format of a simple custom sample test can be as follows: +The `tests.go` file is where the custom tests are implemented in the sample test image project. These tests use `scapiv1alpha3.TestResult` struct to populate the result, which is then converted to json format for the output. For example, the format of a simple custom sample test can be as follows: ```Go package tests import ( "github.com/operator-framework/operator-registry/pkg/registry" - scapiv1alpha2 "github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha2" + scapiv1alpha3 "github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha3" ) const ( @@ -67,17 +65,17 @@ const ( ) // CustomTest1 -func CustomTest1(bundle registry.Bundle) scapiv1alpha2.ScorecardTestResult { - r := scapiv1alpha2.ScorecardTestResult{} +func CustomTest1(bundle registry.Bundle) scapiv1alpha3.TestStatus { + r := scapiv1alpha3.TestResult{} r.Name = CustomTest1Name r.Description = "Custom Test 1" - r.State = scapiv1alpha2.PassState + r.State = scapiv1alpha3.PassState r.Errors = make([]string, 0) r.Suggestions = make([]string, 0) // Implement relevant custom test logic here - return r + return wrapResult(r) } ``` @@ -99,16 +97,16 @@ stages: The important fields to note here are: 1. `image` - name and tag of the test image which was specified in the Makefile. -2. `labels` - the name of the `test` and `suite` the test function belongs to. This can be specified in the `operator-sdk alpha scorecard` command to run the desired test. +2. `labels` - the name of the `test` and `suite` the test function belongs to. This can be specified in the `operator-sdk scorecard` command to run the desired test. **Note**: The default location of `config.yaml` inside the bundle is `/tests/scorecard/config.yaml`. It can be overridden using the `--config` flag. For more details regarding the configuration file refer to [user docs][user_doc]. ### Scorecard binary: -The scorecard test image implementation requires the bundle under test to be present in the test image. The `GetBundle()` function reads the pod's bundle to fetch the manifests and scorecard configuration from desired path. +The scorecard test image implementation requires the bundle under test to be present in the test image. The `apimanifests.GetBundleFromDir()` function reads the pod's bundle to fetch the manifests and scorecard configuration from desired path. ```Go - cfg, err := GetBundle("/bundle") + cfg, err := apimanifests.GetBundleFromDir(scorecard.PodBundleRoot) if err != nil { log.Fatal(err.Error()) } @@ -123,13 +121,13 @@ The names with which the tests are identified in `config.yaml` and would be pass ... switch entrypoint[0] { case tests.CustomTest1Name: - result = tests.CustomTest1(*cfg) + result = tests.CustomTest1(cfg) ... } ... ``` -The result of the custom tests which is in `scapiv1alpha2.ScorecardTestResult` format, is converted to json for output. +The result of the custom tests which is in `scapiv1alpha3.TestResult` format, is converted to json for output. ```Go prettyJSON, err := json.MarshalIndent(result, "", " ") @@ -142,7 +140,7 @@ fmt.Printf("%s\n", string(prettyJSON)) The names of the custom tests are also included in `printValidTests()` function: ```Go -func printValidTests() (result v1alpha2.ScorecardTestResult) { +func printValidTests() (result scapiv1alpha3.TestStatus) { ... str := fmt.Sprintf("Valid tests for this image include: %s, tests.CustomTest1Name @@ -165,10 +163,10 @@ docker push //:tag ### Running scorecard command -The `operator-sdk alpha scorecard` command is used to execute the scorecard tests by specifying the location of test bundle in the command. The name or suite of the tests which are to be executed can be specified with the `--selector` flag. The command will create scorecard pods with the image specified in `config.yaml` for the respective test. For example, the `CustomTest1Name` test provides the following json output. +The `operator-sdk scorecard` command is used to execute the scorecard tests by specifying the location of test bundle in the command. The name or suite of the tests which are to be executed can be specified with the `--selector` flag. The command will create scorecard pods with the image specified in `config.yaml` for the respective test. For example, the `CustomTest1Name` test provides the following json output. ```console -operator-sdk alpha scorecard bundle/ --selector=suite=custom -o json --wait-time=32s --skip-cleanup=false +operator-sdk scorecard bundle/ --selector=suite=custom -o json --wait-time=32s --skip-cleanup=false { "metadata": { "creationTimestamp": null @@ -185,11 +183,11 @@ operator-sdk alpha scorecard bundle/ --selector=suite=custom -o json --wait-time } ``` -**Note**: More details on the usage of `operator-sdk alpha scorecard` command and its flags can be found in the [scorecard user documentation][user_doc] +**Note**: More details on the usage of `operator-sdk scorecard` command and its flags can be found in the [scorecard user documentation][user_doc] ### Debugging scorecard custom tests -The `--skip-cleanup` flag can be used when executing the `operator-sdk alpha scorecard` command to cause the scorecard created test pods to be unremoved. +The `--skip-cleanup` flag can be used when executing the `operator-sdk scorecard` command to cause the scorecard created test pods to be unremoved. This is useful when debugging or writing new tests so that you can view the test logs or the pod manifests. @@ -211,13 +209,13 @@ to be outside its scope. You can however implement whatever service accounts your tests require and then specify that service account from the command line using the service-account flag: ``` -operator-sdk alpha scorecard --service-account=mycustomsa +operator-sdk scorecard --service-account=mycustomsa ``` Also, you can set up a non-default namespace that your tests will be executed within using the following namespace flag: ``` -operator-sdk alpha scorecard --namespace=mycustomns +operator-sdk scorecard --namespace=mycustomns ``` If you do not specify either of these flags, the default namespace @@ -240,11 +238,32 @@ connection to invoke the Kube API. [client_go]: https://github.com/kubernetes/client-go -[olm_tests]: https://github.com/operator-framework/operator-sdk/blob/master/internal/scorecard/alpha/tests/olm.go -[basic_tests]: https://github.com/operator-framework/operator-sdk/blob/master/internal/scorecard/alpha/tests/basic.go -[config_yaml]: https://github.com/operator-framework/operator-sdk/blob/master/internal/scorecard/alpha/testdata/bundle/tests/scorecard/config.yaml +[olm_tests]: https://github.com/operator-framework + +[basic_tests]: https://github.com/operator-framework + +[config_yaml]: https://github.com/operator-framework + +[scorecard_main_func]: https://github.com/operator-framework + +[custom_scorecard_repo]: https://github.com/operator-framework + +[user_doc]: /docs/scorecard/scorecard/ +[scorecard_binary]: https://github.com/operator-framework + +[sample_makefile]: https://github.com/operator-framework/operator-sdk + diff --git a/website/content/en/docs/scorecard/kuttl-tests.md b/website/content/en/docs/scorecard/kuttl-tests.md index c685b36a7bf..e3243fd1ce5 100644 --- a/website/content/en/docs/scorecard/kuttl-tests.md +++ b/website/content/en/docs/scorecard/kuttl-tests.md @@ -64,7 +64,7 @@ end user along with any other test results. With the above kuttl test configuration, you can execute that kuttl test using scorecard as follows: ```bash -operator-sdk alpha scorecard deploy/olm-catalog/memcached-operator --selector=suite=kuttlsuite +operator-sdk scorecard deploy/olm-catalog/memcached-operator --selector=suite=kuttlsuite ``` ## Defining kuttl Specific Configuration Options @@ -132,13 +132,13 @@ that holds the required RBAC permissions. You can specify a custom service account in scorecard as follows: ``` -operator-sdk alpha scorecard --service-account=mycustomsa +operator-sdk scorecard --service-account=mycustomsa ``` Also, you can set up a non-default namespace that your tests will be executed within using the following namespace flag: ``` -operator-sdk alpha scorecard --namespace=mycustomns +operator-sdk scorecard --namespace=mycustomns ``` If you do not specify either of these flags, the default namespace diff --git a/website/content/en/docs/scorecard/scorecard-alpha.md b/website/content/en/docs/scorecard/scorecard.md similarity index 97% rename from website/content/en/docs/scorecard/scorecard-alpha.md rename to website/content/en/docs/scorecard/scorecard.md index 70b3964aa8e..d153c468656 100644 --- a/website/content/en/docs/scorecard/scorecard-alpha.md +++ b/website/content/en/docs/scorecard/scorecard.md @@ -1,5 +1,5 @@ --- -title: Scorecard (alpha) +title: Scorecard weight: 25 --- @@ -95,7 +95,7 @@ follows: The scorecard command has the following syntax: ``` -operator-sdk alpha scorecard [flags] +operator-sdk scorecard [flags] ``` The scorecard requires a positional argument that holds either the @@ -257,7 +257,10 @@ Writing custom tests in other programming languages is possible if the test image follows the above guidelines. -[cli-scorecard]: /docs/cli/operator-sdk_alpha_scorecard/ -[sample-config]: https://github.com/operator-framework/operator-sdk/blob/master/internal/scorecard/alpha/testdata/bundle/tests/scorecard/config.yaml +[cli-scorecard]: /docs/cli/operator-sdk_scorecard/ +[sample-config]: https://github.com/operator-framework + [scorecard-struct]: https://github.com/operator-framework/operator-sdk/blob/master/pkg/apis/scorecard/v1alpha3/types.go [olm-bundle]:https://github.com/operator-framework/operator-registry#manifest-format