Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
ksonnet
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ijaz Ahmad
ksonnet
Commits
abc4d4c3
Unverified
Commit
abc4d4c3
authored
7 years ago
by
Bryan Liles
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #285 from ksonnet/construct-apimachinery-version
Construct apimachinery version
parents
e109bc8b
57a4192f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+3
-1
3 additions, 1 deletion
Makefile
cmd/version.go
+9
-1
9 additions, 1 deletion
cmd/version.go
main.go
+2
-0
2 additions, 0 deletions
main.go
with
14 additions
and
2 deletions
Makefile
+
3
−
1
View file @
abc4d4c3
...
...
@@ -16,9 +16,11 @@
VERSION
?=
dev-
$(
shell
date
+%FT%T%z
)
KS_BIN
?=
ks
APIMACHINERY_VER
:=
$(
shell dep status |
grep
k8s.io/apimachinery |
awk
'{print $$3
}
'
)
GO
=
go
EXTRA_GO_FLAGS
=
GO_FLAGS
=
-ldflags
=
"-X main.version=
$(
VERSION
)
$(
GO_LDFLAGS
)
"
$(
EXTRA_GO_FLAGS
)
GO_FLAGS
=
-ldflags
=
"-X main.version=
$(
VERSION
)
-X main.apimachineryVersion=
$(
APIMACHINERY_VER
)
$(
GO_LDFLAGS
)
"
$(
EXTRA_GO_FLAGS
)
GOFMT
=
gofmt
# GINKGO = "go test" also works if you want to avoid ginkgo tool
GINKGO
=
ginkgo
...
...
This diff is collapsed.
Click to expand it.
cmd/version.go
+
9
−
1
View file @
abc4d4c3
...
...
@@ -30,14 +30,22 @@ func init() {
// Version is overridden by main
var
Version
=
"(dev build)"
var
APImachineryVersion
=
""
var
versionCmd
=
&
cobra
.
Command
{
Use
:
"version"
,
Short
:
"Print version information for this ksonnet binary"
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
out
:=
cmd
.
OutOrStdout
()
clientGoVersion
:=
fmt
.
Sprintf
(
"%s.%s"
,
version
.
Get
()
.
Major
,
version
.
Get
()
.
Minor
)
if
APImachineryVersion
!=
""
{
clientGoVersion
+=
fmt
.
Sprintf
(
"-%s"
,
APImachineryVersion
)
}
fmt
.
Fprintln
(
out
,
"ksonnet version:"
,
Version
)
fmt
.
Fprintln
(
out
,
"jsonnet version:"
,
jsonnet
.
Version
())
fmt
.
Fprintln
(
out
,
"client-go version:"
,
version
.
Get
()
)
fmt
.
Fprintln
(
out
,
"client-go version:"
,
clientGoVersion
)
},
Long
:
`
The `
+
"`version`"
+
` command prints out version info about the current ksonnet CLI,
...
...
This diff is collapsed.
Click to expand it.
main.go
+
2
−
0
View file @
abc4d4c3
...
...
@@ -26,9 +26,11 @@ import (
// Version is overridden using `-X main.version` during release builds
var
version
=
"(dev build)"
var
apimachineryVersion
=
""
func
main
()
{
cmd
.
Version
=
version
cmd
.
APImachineryVersion
=
apimachineryVersion
if
err
:=
cmd
.
RootCmd
.
Execute
();
err
!=
nil
{
// PersistentPreRunE may not have been run for early
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment