knative / toolbox Goto Github PK
View Code? Open in Web Editor NEWToolbox: tools used in Knative project
License: Apache License 2.0
Toolbox: tools used in Knative project
License: Apache License 2.0
Currently, all built binaries are suffixed with -<OS>-<ARCH>
. Additional, copy of current platform binary without those suffixes would be beneficial, as it would be easier to write a cross-platform docs.
https://github.com/knative/toolbox/blob/main/banned_deps_test.go#L17-L18 this is great for our use case, but we should generalize this that we check for any postfix name space clash
Go generate should be called while building and testing
Currently, all tests are running in test
target. It would be cool to define some additional test runs like integration
or e2e
that will run with specific tags or subdirectories or by using Golang -short
flag.
Rewrite performance-tests.sh
script (https://github.com/knative/hack/blob/main/README.md#using-the-performance-testssh-helper-script) into a Golang tool knative.dev/toolbox/performance
.
Invent new Go-native extension interface, for example:
# will look for Go files with `perf` build constraints, that register configuration
go run knative.dev/toolbox/performance@latest
An example configuration might look like:
//go:build perf
package serving
import (
"fmt"
"os"
// Implemented with `github.com/bitfield/script` or similar
"knative.dev/pkg/kscript/ko"
"knative.dev/toolbox/performance/pkg/config"
)
init {
config.Configure(config.Config{
Dir: "test/perf/bench", # default is "test/performance/benchmarks"
UpdateKnative: function(ctx config.Context) error {
ctx.LogProgress("Updating serving")
return ko.Apply("config")
},
UpdateBenchmark: function(ctx config.Context, benchmark string) error {
ctx.LogProgress(fmt.Sprintf("Updating benchmark $1", benchmark))
return ko.Apply(fmt.Sprintf("%s/%s, ctx.Dir, benchmark))
},
})
}
buoy fails with go 1.21 when the toolchain
directive is in go.mod:
cat go.mod | head -n 10
module knative.dev/pkg
go 1.21
toolchain go1.21.6
buoy needs go.mod --domain knative.dev
Error: go.mod:5: unknown directive: toolchain
Usage:
buoy needs go.mod [flags]
Flags:
-d, --domain string domain filter (i.e. knative.dev) [required]
-h, --help help for needs
2024/01/24 10:56:11 Error during command execution: go.mod:5: unknown directive: toolchain
Rewrite presubmit-tests.sh
script (https://github.com/knative/hack/blob/main/README.md#using-the-presubmit-testssh-helper-script) into a Golang tool knative.dev/toolbox/presubmit
.
Invent new Go-native extension interface, for example:
# will look for Go files with `presubmit` build constraints, that register configuration
go run knative.dev/toolbox/presubmit@latest --unit-tests
An example configuration might look like:
//go:build presubmit
package eventing
import (
"fmt"
"os"
"github.com/bitfield/script"
"knative.dev/toolbox/presubmit/pkg/config"
)
init {
config.Configure(config.Hooks{
PostBuildTests: function(ctx config.Context) error {
return os.RemoveAll("build-cache")
},
UnitTests: function(ctx config.Context) error {
p := script.Exec("make -C tests test")
_, _ = pp.Stdout()
return p.Error()
},
PreIntegrationTests: function(ctx config.Context) error {
return os.RemoveAll("staging-area")
},
})
}
A checksum file should be produced to have checksums of all produced artifacts.
toolbox/release-jobs-syncer/main.go
Lines 34 to 35 in 292433b
We need to adjust the above lines to point to the knative/infra by default. It would be good that this is configurable.
/kind bug
Related to knative/community#1291
As per title, the command produces an error:
$ go run knative.dev/toolbox/kntest/cmd/kntest@latest
go: knative.dev/toolbox/kntest/cmd/kntest@latest (in knative.dev/toolbox/[email protected]):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
Many systems can consume test reports in XML format, Prow and Jenkins being just an example. It would be beneficial to support test reports in those formats.
I think https://github.com/gotestyourself/gotestsum can be a good candidate to implement it.
Rewrite release.sh
script (https://github.com/knative/hack/blob/main/README.md#using-the-releasesh-helper-script) into a Golang tool knative.dev/toolbox/releaser
.
Invent new Go-native extension interface, for example:
# will look for Go files with `release` build constraints, that register build configuration
go run knative.dev/toolbox/releaser@latest ./ \
--dot-release \
--release-gcs knative-releases/kn-plugin-event \
--release-gcr gcr.io/knative-releases \
--github-token /etc/hub-token/token \
--apple-codesign-key /etc/notary/cert.p12 \
--apple-notary-api-key /etc/notary/key.json \
--apple-codesign-password-file /etc/notary/password \
--branch release-1.9
The release configuration might look like:
//go:build release
package serving
import (
"fmt"
"os"
// Implemented with `github.com/bitfield/script` or similar
"knative.dev/pkg/kscript/ko"
"knative.dev/toolbox/releaser/pkg/config"
)
init {
config.Configure(function(ctx config.Context) {
f := must[*os.File](ko.Resolve("config").AsFile("release.yaml"))
ctx.AddAsArtifact(f)
})
}
func must[T any](ret T, err error) T {
if err != nil {
panic(err)
}
return ret
}
Rewrite codegen-library.sh
script into a Golang tool knative.dev/toolbox/codegen
. The current script:
Invent new CLI, for example:
go run knative.dev/toolbox/codegen@latest k8s \
"deepcopy,client,informer,lister" \
knative.dev/serving/pkg/client knative.dev/serving/pkg/apis \
"serving:v1 serving:v1beta1 autoscaling:v1alpha1"
go run knative.dev/toolbox/codegen@latest knative \
"injection" \
knative.dev/serving/pkg/client knative.dev/serving/pkg/apis \
"serving:v1 serving:v1beta1 autoscaling:v1alpha1"
go run knative.dev/toolbox/codegen@latest deepcopy-gen \
-i knative.dev/serving/pkg/apis/config \
-i knative.dev/serving/pkg/reconciler/route/config \
-i knative.dev/serving/pkg/autoscaler/config/autoscalerconfig \
-i knative.dev/serving/pkg/autoscaler/scaling \
-i knative.dev/serving/pkg/deployment \
-i knative.dev/serving/pkg/gc
Rewrite bash function go_update_deps "$@"
from knative.dev/hack/library.sh (L663-L681)
into a Golang tool knative.dev/toolbox/update-deps
.
https://github.com/knative/hack/blob/158898889ae8670c7e68e522e32cd6800e1729a0/library.sh#L663-L681
Keep the same CLI:
go run knative.dev/toolbox/update-deps@latest \
--upgrade \
--release <release-version> \
--module-release <module-version>
Rewrite the e2e-tests.sh
script (https://github.com/knative/hack/blob/main/README.md#using-the-e2e-testssh-helper-script) into a Golang tool knative.dev/toolbox/presubmit
.
Invent new Go-native extension interface, for example:
# will look for Go files with `e2e` build constraints, that register configuration
go run knative.dev/toolbox/e2e@latest --run-tests
An example configuration might look like:
//go:build e2e
package test
import (
"fmt"
"os"
"github.com/bitfield/script"
"knative.dev/toolbox/e2e/pkg/config"
"knative.dev/toolbox/e2e/pkg/commands/knative"
"knative.dev/toolbox/e2e/pkg/commands/wait"
)
var waitForKnative = true
init {
config.Configure(config.Hooks{
KnativeSetup: function(ctx config.Context) error {
if err := knative.StartServingLatest(); err != nil {
return err
}
if waitForKnative {
return wait.UntilPodsRunning("knative-serving")
}
return nil
},
DefineFlags: function(fs *flag.FlagSet) {
fs.BoolVar(&waitForKnative, "wait-for-knative", true, "wait for Knative install?")
},
Tests: []config.E2eSuite{{
Name: "Istio",
Dir: "./...",
Flags: ["--istio"],
}},
})
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.