chore: Add version information of eventing (#495)

* chore: Add version information of eventing

Adding sources.eventing.knative.dev to version info (the only eventing API)
for now as this will be the first one used.

* chore(version): Add grouping for API versions
This commit is contained in:
Roland Huß 2019-11-19 11:20:07 +01:00 committed by Knative Prow Robot
parent d116fb9422
commit 48797269ed
2 changed files with 18 additions and 5 deletions

View File

@ -27,8 +27,13 @@ var BuildDate string
var GitRevision string
// update this var as we add more deps
var apiVersions = []string{
"serving.knative.dev/v1alpha1 (knative-serving v0.10.0)",
var apiVersions = map[string][]string{
"serving": {
"serving.knative.dev/v1alpha1 (knative-serving v0.10.0)",
},
"eventing": {
"sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.10.0)",
},
}
// NewVersionCommand implements 'kn version' command
@ -42,8 +47,13 @@ func NewVersionCommand(p *commands.KnParams) *cobra.Command {
fmt.Fprintf(out, "Build Date: %s\n", BuildDate)
fmt.Fprintf(out, "Git Revision: %s\n", GitRevision)
fmt.Fprintf(out, "Supported APIs:\n")
for _, api := range apiVersions {
fmt.Fprintf(out, "- %s\n", api)
fmt.Fprintf(out, "* Serving\n")
for _, api := range apiVersions["serving"] {
fmt.Fprintf(out, " - %s\n", api)
}
fmt.Fprintf(out, "* Eventing\n")
for _, api := range apiVersions["eventing"] {
fmt.Fprintf(out, " - %s\n", api)
}
},
}

View File

@ -35,7 +35,10 @@ var versionOutputTemplate = `Version: {{.Version}}
Build Date: {{.BuildDate}}
Git Revision: {{.GitRevision}}
Supported APIs:
- serving.knative.dev/v1alpha1 (knative-serving v0.10.0)
* Serving
- serving.knative.dev/v1alpha1 (knative-serving v0.10.0)
* Eventing
- sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.10.0)
`
const (