knative / knative/toolbox

Presubmit Go-native runner

Open
#19 5 comments 0 reactions 0 assignees View on GitHub
kind/enhancement triage/accepted
Dominant language
Go
Stars
4
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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:

```sh
# 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
//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")
},
})
}
```

Contributor guide

Open the contributing guide

Research direction

Read the README.md helper-script usage and inspect presubmit-tests.sh first, then review the proposed knative.dev/toolbox/presubmit entry point and config interface. Done means a Go-native runner supports the proposed presubmit hooks and the --unit-tests invocation as a replacement for the script.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, shell
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.