Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fold in knative.dev/client-pkg as a submodule #1953

Merged
merged 18 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions cmd/kn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"strings"

"github.com/spf13/cobra"
"knative.dev/client/pkg/kn/config"
pluginpkg "knative.dev/client/pkg/kn/plugin"
"knative.dev/client/pkg/kn/root"
"knative.dev/client/pkg/config"
pluginpkg "knative.dev/client/pkg/plugin"
"knative.dev/client/pkg/root"
)

func main() {
Expand Down
16 changes: 7 additions & 9 deletions cmd/kn/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,23 @@ import (
"strings"
"testing"

pluginpkg "knative.dev/client/pkg/kn/plugin"

"github.com/spf13/cobra"
"gotest.tools/v3/assert"

"knative.dev/client/lib/test"
"knative.dev/client/pkg/kn/config"
"knative.dev/client/pkg/kn/root"
"knative.dev/client/pkg/config"
pluginpkg "knative.dev/client/pkg/plugin"
"knative.dev/client/pkg/root"
"knative.dev/client/pkg/util"
"knative.dev/client/pkg/util/test"
)

func TestValidatePlugin(t *testing.T) {

// Build up simple command hierarchy
root := cobra.Command{}
rootCmd := cobra.Command{}
one := &cobra.Command{Use: "one"}
one.AddCommand(&cobra.Command{Use: "eins"}, &cobra.Command{Use: "zwei"})
two := &cobra.Command{Use: "two"}
root.AddCommand(one, two)
rootCmd.AddCommand(one, two)

data := []struct {
givenPluginCommandParts []string
Expand Down Expand Up @@ -84,7 +82,7 @@ func TestValidatePlugin(t *testing.T) {

for i, d := range data {
step := fmt.Sprintf("Check %d", i)
err := validatePlugin(&root, commandPartsOnlyPlugin(d.givenPluginCommandParts))
err := validatePlugin(&rootCmd, commandPartsOnlyPlugin(d.givenPluginCommandParts))
if len(d.expectedErrors) == 0 {
assert.NilError(t, err, step)
} else {
Expand Down
4 changes: 3 additions & 1 deletion hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ if has_flag --debug; then
fi

# Shared funcs from hack repo
source "$(basedir)"/vendor/knative.dev/hack/library.sh

# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script library.sh)"

# Shared funcs with CI
while IFS= read -r -d '' file; do
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"os"

"github.com/spf13/cobra/doc"
"knative.dev/client/pkg/kn/root"
"knative.dev/client/pkg/root"
)

func main() {
Expand Down
5 changes: 3 additions & 2 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
# Documentation about this script and how to use it can be found
# at https://github.com/knative/hack

source $(dirname $0)/../vendor/knative.dev/hack/release.sh
# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script release.sh)"

function build_release() {
# Env var exported by hack/build-flags.sh
source $(dirname $0)/build-flags.sh
source "$(dirname "$0")/build-flags.sh"
local ld_flags="${KN_BUILD_LD_FLAGS:-}"

export CGO_ENABLED=0
Expand Down Expand Up @@ -63,9 +64,9 @@
fi
echo "KO_FLAGS:${KO_FLAGS}"

ko resolve ${KO_FLAGS} -f config/ >kn-image-location.yaml

Check failure on line 67 in hack/release.sh

View workflow job for this annotation

GitHub Actions / style / suggester / shell

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: hack/release.sh:67:- ko resolve ${KO_FLAGS} -f config/ >kn-image-location.yaml hack/release.sh:67:+ ko resolve "${KO_FLAGS}" -f config/ >kn-image-location.yaml
ARTIFACTS_TO_PUBLISH="kn-darwin-amd64 kn-darwin-arm64 kn-linux-amd64 kn-linux-arm64 kn-windows-amd64.exe kn-linux-s390x kn-linux-ppc64le kn-image-location.yaml"
sha256sum ${ARTIFACTS_TO_PUBLISH} >checksums.txt

Check failure on line 69 in hack/release.sh

View workflow job for this annotation

GitHub Actions / style / suggester / shell

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: hack/release.sh:69:- sha256sum ${ARTIFACTS_TO_PUBLISH} >checksums.txt hack/release.sh:69:+ sha256sum "${ARTIFACTS_TO_PUBLISH}" >checksums.txt
ARTIFACTS_TO_PUBLISH="${ARTIFACTS_TO_PUBLISH} checksums.txt"
echo "🧮 Checksum:"
cat checksums.txt
Expand Down
2 changes: 1 addition & 1 deletion hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package tools

// This package imports things required by this repository, to force `go mod` to see them as dependencies
import (
_ "knative.dev/hack"
_ "knative.dev/hack/cmd/script"
skonto marked this conversation as resolved.
Show resolved Hide resolved
_ "knative.dev/pkg/hack"

_ "k8s.io/code-generator"
Expand Down
3 changes: 2 additions & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh
# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script codegen-library.sh)"

# If we run with -mod=vendor here, then generate-groups.sh looks for vendor files in the wrong place.
export GOFLAGS=-mod=
Expand Down
3 changes: 2 additions & 1 deletion hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/library.sh
# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script library.sh)"

go_update_deps "$@"
3 changes: 2 additions & 1 deletion hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/library.sh
# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script library.sh)"

"${REPO_ROOT_DIR}"/hack/build.sh --codegen
if output="$(git status --porcelain)" && [ -z "$output" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package broker
import (
"github.com/spf13/cobra"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
)

// NewBrokerCommand represents broker management commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
duckv1 "knative.dev/pkg/apis/duck/v1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"

"knative.dev/client/pkg/commands"
clientv1beta1 "knative.dev/client/pkg/eventing/v1"
"knative.dev/client/pkg/kn/commands"
v1beta1 "knative.dev/eventing/pkg/apis/eventing/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
v1 "knative.dev/eventing/pkg/apis/duck/v1"
duckv1 "knative.dev/pkg/apis/duck/v1"

"knative.dev/client/pkg/commands"
clientv1beta1 "knative.dev/client/pkg/eventing/v1"
"knative.dev/client/pkg/kn/commands"
)

var createExample = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/spf13/cobra"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
)

var deleteExample = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"reflect"

"github.com/spf13/cobra"
"knative.dev/client/pkg/commands/flags"
"knative.dev/client/pkg/dynamic"
"knative.dev/client/pkg/kn/commands/flags"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

v1beta1 "knative.dev/eventing/pkg/apis/eventing/v1"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/printers"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/kn/commands/flags"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/commands/flags"
hprinters "knative.dev/client/pkg/printers"
eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
v1 "knative.dev/client/pkg/eventing/v1"
duckv1 "knative.dev/eventing/pkg/apis/duck/v1"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/spf13/cobra"

"k8s.io/client-go/tools/clientcmd"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
messagingv1 "knative.dev/client/pkg/messaging/v1"
clientv1beta1 "knative.dev/eventing/pkg/client/clientset/versioned/typed/messaging/v1"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"k8s.io/client-go/tools/clientcmd"
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
clientv1beta1 "knative.dev/client/pkg/messaging/v1"
eventingduck "knative.dev/eventing/pkg/apis/duck/v1"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (

"github.com/spf13/cobra"

"knative.dev/client/pkg/commands"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/kn/commands"
knflags "knative.dev/client/pkg/kn/flags"
knflags "knative.dev/client/pkg/flags"
knmessagingv1 "knative.dev/client/pkg/messaging/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"

"github.com/spf13/cobra"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
)

// NewChannelDeleteCommand is for deleting a Channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"

"knative.dev/client/pkg/commands"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/printers"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/printers"
hprinters "knative.dev/client/pkg/printers"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"

"github.com/spf13/cobra"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/kn/commands/flags"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/commands/flags"
"knative.dev/eventing/pkg/client/clientset/versioned/scheme"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/commands/flags"
"knative.dev/client/pkg/dynamic"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/kn/commands/flags"
messagingv1 "knative.dev/client/pkg/messaging/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (

dynamicfakeClient "knative.dev/client/pkg/dynamic/fake"

"knative.dev/client/pkg/commands"
clientdynamic "knative.dev/client/pkg/dynamic"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/util"
"knative.dev/eventing/pkg/apis/messaging"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"errors"
"os"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"

"github.com/spf13/cobra"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ package completion
import (
"testing"

"knative.dev/client/lib/test"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/util"

"github.com/spf13/cobra"
"gotest.tools/v3/assert"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/util"
"knative.dev/client/pkg/util/test"
)

func TestCompletionUsage(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra"

corev1 "k8s.io/api/core/v1"
"knative.dev/client/pkg/kn/commands"
knflags "knative.dev/client/pkg/kn/flags"
"knative.dev/client/pkg/commands"
knflags "knative.dev/client/pkg/flags"
sigyaml "sigs.k8s.io/yaml"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package container

import (
"github.com/spf13/cobra"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
)

// NewContainerCommand to manage containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

"gotest.tools/v3/assert"
"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
)

func TestContainerCommand(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra"

"k8s.io/apimachinery/pkg/util/validation"
"knative.dev/client/pkg/commands"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/kn/commands"
clientv1beta1 "knative.dev/client/pkg/serving/v1beta1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/spf13/cobra"

"knative.dev/client/pkg/commands"
knerrors "knative.dev/client/pkg/errors"
"knative.dev/client/pkg/kn/commands"
)

// NewDomainMappingDeleteCommand to create event channels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"

"knative.dev/client/pkg/kn/commands"
"knative.dev/client/pkg/commands"
"knative.dev/client/pkg/printers"
"knative.dev/serving/pkg/apis/serving/v1beta1"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/client/pkg/commands"
clientdynamic "knative.dev/client/pkg/dynamic"
"knative.dev/client/pkg/kn/commands"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

Expand Down
Loading
Loading