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

[WIP] 🧹 Removing the vendor dir #8054

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
uses: ko-build/[email protected]

- name: Check out code onto GOPATH
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install KinD
run: |
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Wait for things to be up
run: |
set -e
source ./vendor/knative.dev/hack/infra-library.sh
source "$(go run knative.dev/hack/cmd/script infra-library.sh)"
wait_until_pods_running ${SYSTEM_NAMESPACE}

- name: Run e2e Tests
Expand Down
1 change: 0 additions & 1 deletion cmd/apiserver_receive_adapter/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/broker/filter/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/broker/ingress/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/controller/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/in_memory/channel_controller/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/in_memory/channel_dispatcher/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/jobsink/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/mtping/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/pong/kodata/VENDOR-LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/webhook/kodata/VENDOR-LICENSE

This file was deleted.

6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ require (
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/golang-lru v1.0.2
github.com/kelseyhightower/envconfig v1.4.0
github.com/mitchellh/go-homedir v1.1.0
github.com/openzipkin/zipkin-go v0.4.3
Expand Down Expand Up @@ -50,6 +48,8 @@ require (
sigs.k8s.io/yaml v1.4.0
)

replace knative.dev/hack => github.com/cardil/knative-hack v0.0.0-20240718135939-e922902857fa

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
Expand All @@ -76,6 +76,8 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/imdario/mergo v0.3.9 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE=
github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc=
github.com/cardil/knative-hack v0.0.0-20240718135939-e922902857fa h1:MNJ+q3m8/Gnw5j0Xk5/Sn6AnfrVVhXH8f2cR01cAz1U=
github.com/cardil/knative-hack v0.0.0-20240718135939-e922902857fa/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
Expand Down Expand Up @@ -838,8 +840,6 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20240704013904-b9799599afcf h1:n92FmZRywgtHso7pFAku7CW0qvRAs1hXtMQqO0R6eiE=
knative.dev/hack v0.0.0-20240704013904-b9799599afcf/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/hack/schema v0.0.0-20240704013904-b9799599afcf h1:AUfdS2IxgjNLc7jplP7Xk/SPnk0c/40G1TvrkZ07UKU=
knative.dev/hack/schema v0.0.0-20240704013904-b9799599afcf/go.mod h1:3pWwBLnTZSM9psSgCAvhKOHIPTzqfEMlWRpDu6IYhK0=
knative.dev/pkg v0.0.0-20240708181110-b4e5f07a2c37 h1:YJopww8+M2C6vdiKzHAP98917VxEZhkBJ66P3ilhU/4=
Expand Down
15 changes: 0 additions & 15 deletions hack/boilerplate/boilerplate.go.txt

This file was deleted.

3 changes: 2 additions & 1 deletion hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# Documentation about this script and how to use it can be found
# at https://github.com/knative/test-infra/tree/main/ci

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() {
# Run `generate-yamls.sh`, which should be versioned with the
Expand Down
2 changes: 1 addition & 1 deletion hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
package tools

import (
_ "knative.dev/hack"
_ "knative.dev/hack/cmd/script"
_ "knative.dev/pkg/configmap/hash-gen"
_ "knative.dev/pkg/hack"

Expand Down
7 changes: 4 additions & 3 deletions hack/update-checksums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ if [ -z "${GOPATH:-}" ]; then
export GOPATH=$(go env GOPATH)
fi

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

go run "${REPO_ROOT_DIR}/vendor/knative.dev/pkg/configmap/hash-gen" "${REPO_ROOT_DIR}"/config/core/configmaps/*.yaml
go run "${REPO_ROOT_DIR}/vendor/knative.dev/pkg/configmap/hash-gen" "${REPO_ROOT_DIR}"/config/channels/in-memory-channel/configmaps/*.yaml
go run knative.dev/pkg/configmap/hash-gen "${REPO_ROOT_DIR}"/config/core/configmaps/*.yaml
go run knative.dev/pkg/configmap/hash-gen "${REPO_ROOT_DIR}"/config/channels/in-memory-channel/configmaps/*.yaml
30 changes: 14 additions & 16 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,53 @@ 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=

echo "=== Update Codegen for $MODULE_NAME"
log.step "Update Codegen for $MODULE_NAME"

# Compute _example hash for all configmaps.
group "Generating checksums for configmap _example keys"

${REPO_ROOT_DIR}/hack/update-checksums.sh
"${REPO_ROOT_DIR}/hack/update-checksums.sh"

group "Kubernetes Codegen"

# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
generate-groups "deepcopy,client,informer,lister" \
knative.dev/eventing/pkg/client knative.dev/eventing/pkg/apis \
"sinks:v1alpha1 eventing:v1alpha1 eventing:v1beta1 eventing:v1beta2 eventing:v1beta3 eventing:v1 messaging:v1 flows:v1 sources:v1beta2 sources:v1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
"sinks:v1alpha1 eventing:v1alpha1 eventing:v1beta1 eventing:v1beta2 eventing:v1beta3 eventing:v1 messaging:v1 flows:v1 sources:v1beta2 sources:v1"

# Deep copy config
${GOPATH}/bin/deepcopy-gen \
"${GOBIN}/deepcopy-gen" \
-O zz_generated.deepcopy \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \
--go-header-file "$(boilerplate)" \
-i knative.dev/eventing/pkg/apis/config \
-i knative.dev/eventing/pkg/apis/messaging/config \

# Only deepcopy the Duck types, as they are not real resources.
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
generate-groups "deepcopy" \
knative.dev/eventing/pkg/client knative.dev/eventing/pkg/apis \
"duck:v1beta1 duck:v1alpha1 duck:v1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
"duck:v1beta1 duck:v1alpha1 duck:v1"

group "Knative Codegen"

# Knative Injection
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
generate-knative "injection" \
knative.dev/eventing/pkg/client knative.dev/eventing/pkg/apis \
"sinks:v1alpha1 eventing:v1alpha1 eventing:v1beta1 eventing:v1beta2 eventing:v1beta3 eventing:v1 messaging:v1 flows:v1 sources:v1beta2 sources:v1 duck:v1beta1 duck:v1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
"sinks:v1alpha1 eventing:v1alpha1 eventing:v1beta1 eventing:v1beta2 eventing:v1beta3 eventing:v1 messaging:v1 flows:v1 sources:v1beta2 sources:v1 duck:v1beta1 duck:v1"

group "Generating API reference docs"

${REPO_ROOT_DIR}/hack/update-reference-docs.sh
"${REPO_ROOT_DIR}/hack/update-reference-docs.sh"

group "Update deps post-codegen"

# Make sure our dependencies are up-to-date
${REPO_ROOT_DIR}/hack/update-deps.sh
"${REPO_ROOT_DIR}/hack/update-deps.sh"
7 changes: 4 additions & 3 deletions hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname "$0")/../vendor/knative.dev/hack/library.sh

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

go_update_deps "$@"

"$(dirname $0)/update-cert-manager.sh"
9 changes: 5 additions & 4 deletions hack/update-reference-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ if [ -z "${GOPATH:-}" ]; then
export GOPATH=$(go env GOPATH)
fi

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

(
cd ${REPO_ROOT_DIR}
go run "${REPO_ROOT_DIR}/vendor/github.com/ahmetb/gen-crd-api-reference-docs" \
cd "${REPO_ROOT_DIR}"
go run github.com/ahmetb/gen-crd-api-reference-docs \
-out-file "docs/eventing-api.md" \
-api-dir "knative.dev/eventing/pkg/apis" \
-template-dir "${REPO_ROOT_DIR}/vendor/github.com/ahmetb/gen-crd-api-reference-docs/template" \
-template-dir "$(go list -f '{{.Dir}}' github.com/ahmetb/gen-crd-api-reference-docs)/template" \
-config "${REPO_ROOT_DIR}/hack/reference-docs-gen-config.json"
)

10 changes: 3 additions & 7 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ set -o pipefail

export GO111MODULE=on

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

readonly TMP_DIFFROOT="$(mktemp -d ${REPO_ROOT_DIR}/tmpdiffroot.XXXXXX)"

Expand All @@ -40,7 +41,6 @@ cp -aR \
"${REPO_ROOT_DIR}/go.mod" \
"${REPO_ROOT_DIR}/pkg" \
"${REPO_ROOT_DIR}/third_party" \
"${REPO_ROOT_DIR}/vendor" \
"${TMP_DIFFROOT}"

"${REPO_ROOT_DIR}/hack/update-codegen.sh"
Expand All @@ -59,15 +59,11 @@ diff -Naupr --no-dereference \
diff -Naupr --no-dereference \
"${REPO_ROOT_DIR}/third_party" "${TMP_DIFFROOT}/third_party" || ret=1

diff -Naupr --no-dereference \
"${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1

# Restore working tree state
rm -fr \
"${REPO_ROOT_DIR}/go.sum" \
"${REPO_ROOT_DIR}/pkg" \
"${REPO_ROOT_DIR}/third_party" \
"${REPO_ROOT_DIR}/vendor"
"${REPO_ROOT_DIR}/third_party"

cp -aR "${TMP_DIFFROOT}"/* "${REPO_ROOT_DIR}"

Expand Down
3 changes: 2 additions & 1 deletion test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

export GO111MODULE=on

source "$(dirname "${BASH_SOURCE[0]}")/../vendor/knative.dev/hack/e2e-tests.sh"
# shellcheck disable=SC1090
source "$(go run knative.dev/hack/cmd/script e2e-tests.sh)"

# If gcloud is not available make it a no-op, not an error.
which gcloud &>/dev/null || gcloud() { echo "[ignore-gcloud $*]" 1>&2; }
Expand Down
4 changes: 3 additions & 1 deletion test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
export GO111MODULE=on

export KO_FLAGS="--platform=linux/amd64"
source "$(dirname "${BASH_SOURCE[0]}")/../vendor/knative.dev/hack/presubmit-tests.sh"

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

# We use the default build, unit and integration test runners.

Expand Down
Loading
Loading