knative / toolbox

Toolbox: tools used in Knative project
Apache License 2.0
5 stars 11 forks source link

Release Go-native tool #17

Open cardil opened 1 year ago

cardil commented 1 year ago

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
}
github-actions[bot] commented 9 months ago

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.

cardil commented 7 months ago

/reopen /remove-lifecycle stale /triage accepted

knative-prow[bot] commented 7 months ago

@cardil: Reopened this issue.

In response to [this](https://github.com/knative/toolbox/issues/17#issuecomment-2039477879): >/reopen >/remove-lifecycle stale >/triage accepted Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.