Code Monkey home page Code Monkey logo

toolbox's People

Contributors

adrcunha avatar bbolroc avatar cardil avatar chaodaig avatar chizhg avatar coryrc avatar dependabot[bot] avatar dprotaso avatar dushyanthsc avatar ericklawitter avatar haubenr avatar joshua-bone avatar knative-automation avatar knative-prow-robot avatar knative-prow-updater-robot avatar krsna-m avatar markusthoemmes avatar mattmoor avatar mattmoor-sockpuppet avatar mdafsanhossain avatar nader-ziada avatar nak3 avatar peterfeifanchen avatar pierdipi avatar slinkydeveloper avatar srinivashegde86 avatar steuhs avatar trevorfarrelly avatar upodroid avatar yt3liu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

toolbox's Issues

Performance tests Go-native tool

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 `toolchain` directive

Problem description

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

Presubmit Go-native runner

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")
    },
  })
}

go run knative.dev/toolbox/kntest/cmd/kntest@latest fails

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.

Also CI - https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative_hack/297/integration-tests_hack_main/1677125496590045184

Release Go-native tool

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
}

Codegen Go-native tool

Rewrite codegen-library.sh script into a Golang tool knative.dev/toolbox/codegen. The current script:

https://github.com/knative/hack/blob/158898889ae8670c7e68e522e32cd6800e1729a0/codegen-library.sh#L19-L35

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

e2e Go-native test runner

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"],
    }},
  })
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.