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

Presubmit Go-native runner #19

Open
Tracked by #254
cardil opened this issue Oct 10, 2023 · 5 comments
Open
Tracked by #254

Presubmit Go-native runner #19

cardil opened this issue Oct 10, 2023 · 5 comments
Labels
kind/enhancement triage/accepted Issues which should be fixed (post-triage)

Comments

@cardil
Copy link
Contributor

cardil commented Oct 10, 2023

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")
    },
  })
}
@cardil cardil changed the title presubmit-tests runner Presubmit Go-native runner Oct 10, 2023
@cardil cardil transferred this issue from knative/hack Oct 10, 2023
@mgencur
Copy link
Contributor

mgencur commented Nov 2, 2023

will look for Go files with presubmit build constraints, that register configuration
go run knative.dev/toolbox/presubmit@latest --unit-tests

Where will the binary look for the configuration? Do we want to pass the path as an argument like in #17 where the first argument is the path (i.e. go run knative.dev/toolbox/presubmit@latest ./ --unit-tests)

Or possibly pass the configuration as an argument: go run knative.dev/toolbox/presubmit@latest --config=/path/to/config --unit-tests
I'm curious if beeing more explicit about the passed config would make it more clear and easy to use.

@cardil
Copy link
Contributor Author

cardil commented Nov 2, 2023

@mgencur Where will the binary look for the configuration?

I was thinking we can have this as an optional argument, which by default will take the information from the current module (see the modscope tool)

Copy link

github-actions bot commented Feb 1, 2024

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 1, 2024
@github-actions github-actions bot closed this as completed Mar 3, 2024
@cardil
Copy link
Contributor Author

cardil commented Apr 5, 2024

/reopen
/remove-lifecycle stale
/triage accepted

Copy link

knative-prow bot commented Apr 5, 2024

@cardil: Reopened this issue.

In response to this:

/reopen
/remove-lifecycle stale
/triage accepted

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow knative-prow bot reopened this Apr 5, 2024
@knative-prow knative-prow bot added triage/accepted Issues which should be fixed (post-triage) and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement triage/accepted Issues which should be fixed (post-triage)
Projects
None yet
Development

No branches or pull requests

2 participants