-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using scripts without relying on vendor dir
- Loading branch information
Showing
30 changed files
with
728 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hack/boilerplate/boilerplate.go.txt → vendor/knative.dev/hack/boilerplate.go.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Vendorless Knative | ||
|
||
The Knative projects can be built without a vendor directory. This is a | ||
convenience for developers, and brings a number of benefits: | ||
|
||
* It is easier to see the changes to the code and review them. | ||
* It is easier to maintain the build and CI scripts, as they don't need to | ||
filter out the vendor directory. | ||
* The project doesn't look dated (the proper dependency management tools | ||
are available for Go since 1.13+). | ||
* No vendor directory means less possibility of accidentally traversing | ||
into it by symlinks or scripts. | ||
|
||
For more details and reasons for avoiding the vendor directory, see | ||
[knative/infra#134](https://github.com/knative/infra/issues/134). | ||
|
||
## Status | ||
|
||
The [knative/infra#134](https://github.com/knative/infra/issues/134) is | ||
ongoing effort. Currently, it is possible to use make projects vendorless, | ||
only if they don't use Knative nor Kubernetes code-generation tools. See the | ||
epic issue for current status. | ||
|
||
## Migration to a vendorless project | ||
|
||
The following steps are required to migrate a project to be vendorless: | ||
|
||
1. Update the `knative.dev/hack` dependency to the latest version. | ||
1. Update the project scripts to use the scripts inflation: | ||
```patch | ||
-source $(dirname $0)/../vendor/knative.dev/hack/release.sh | ||
+source "$(go run knative.dev/hack/cmd/script release.sh)" | ||
``` | ||
1. Update the `hack/tools.go` file to refer to the `knative.dev/hack/cmd/script` | ||
tool: | ||
```go | ||
package hack | ||
|
||
import ( | ||
_ "knative.dev/hack/cmd/script" | ||
) | ||
``` | ||
1. Remove the `vendor` directory. | ||
1. Run `hack/update-deps.sh` to update the `go.mod` file(s). | ||
|
||
### Examples of migrated projects | ||
|
||
* [knative/func#1966](https://github.com/knative/func/pull/1966) | ||
* [knative-extensions/kn-plugin-event#307](https://github.com/knative-extensions/kn-plugin-event/pull/307) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Copyright 2022 The Knative 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 | ||
https://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 main | ||
|
||
import "knative.dev/hack/pkg/inflator/cli" | ||
|
||
func main() { | ||
cli.ExecuteOrDie(cli.Options...) | ||
} | ||
|
||
// RunMain is used by tests to run the main function. | ||
func RunMain() { // nolint:deadcode | ||
main() | ||
} |
Oops, something went wrong.