Skip to content

Commit 485bf7d

Browse files
multi: update GetInfoResponse` response
Add the `tag` and `commit_hash` fields to the GetInfoResponse. The semantics of the `version` field is also updated to always contain the most recent semantic version of the litd node, following the semantic versioning 2.0.0 spec (http://semver.org/). This commit also updates the `litcli --version` command result, to include all three fields of the GetInfoResponse.
1 parent 1d9c546 commit 485bf7d

File tree

12 files changed

+190
-37
lines changed

12 files changed

+190
-37
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GOIMPORTS_BIN := $(GO_BIN)/gosimports
1616

1717
COMMIT := $(shell git describe --abbrev=40 --dirty --tags)
1818
COMMIT_HASH := $(shell git rev-parse HEAD)
19-
PUBLIC_URL :=
19+
PUBLIC_URL :=
2020

2121
# GO_VERSION is the Go version used for the release build, docker files, and
2222
# GitHub Actions. This is the reference version for the project. All other Go
@@ -69,6 +69,7 @@ make_ldflags = $(2) -X $(LND_PKG)/build.Commit=lightning-terminal-$(COMMIT) \
6969
-X $(LND_PKG)/build.RawTags=$(shell echo $(1) | sed -e 's/ /,/g') \
7070
-X $(PKG).appFilesPrefix=$(PUBLIC_URL) \
7171
-X $(PKG).Commit=$(COMMIT) \
72+
-X $(PKG).GitCommitHash=$(COMMIT_HASH) \
7273
-X $(LOOP_PKG).Commit=$(LOOP_COMMIT) \
7374
-X $(POOL_PKG).Commit=$(POOL_COMMIT) \
7475
-X $(TAP_PKG).Commit=$(TAP_COMMIT)

app/src/types/generated/proxy_pb.d.ts

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/proxy_pb.js

Lines changed: 61 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/litcli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var (
7373
func main() {
7474
app := cli.NewApp()
7575

76-
app.Version = terminal.Version()
76+
app.Version = terminal.RichVersion()
7777
app.Name = "litcli"
7878
app.Usage = "control plane for your Lightning Terminal (lit) daemon"
7979
app.Flags = []cli.Flag{

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
367367
appName := filepath.Base(os.Args[0])
368368
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
369369
if preCfg.ShowVersion {
370-
fmt.Println(appName, "version", Version())
370+
fmt.Println(appName, "version", RichVersion())
371371
os.Exit(0)
372372
}
373373
if preCfg.Lnd.ShowVersion {

litrpc/proxy.pb.go

Lines changed: 47 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

litrpc/proxy.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ message GetInfoRequest {
5252
}
5353

5454
message GetInfoResponse {
55-
// The version of the LiTd software that the node is running.
55+
// The application version of the LiTd software running on the node,
56+
// following the Semantic Versioning 2.0.0 specification
57+
// (http://semver.org/).
5658
string version = 1;
59+
60+
// The Git tag that the LiTd binary build was based on. If the build was
61+
// not based on a clean tagged commit, this field will contain the most
62+
// recent tag suffixed by the commit hash, and/or a "-dirty" suffix.
63+
string tag = 2;
64+
65+
// The Git commit hash the LiTd binary build was based on.
66+
string commit_hash = 3;
5767
}

litrpc/proxy.swagger.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,15 @@
135135
"properties": {
136136
"version": {
137137
"type": "string",
138-
"description": "The version of the LiTd software that the node is running."
138+
"description": "The application version of the LiTd software running on the node,\nfollowing the Semantic Versioning 2.0.0 specification\n(http://semver.org/)."
139+
},
140+
"tag": {
141+
"type": "string",
142+
"description": "The Git tag that the LiTd binary build was based on. If the build was\nnot based on a clean tagged commit, this field will contain the most\nrecent tag suffixed by the commit hash, and/or a \"-dirty\" suffix."
143+
},
144+
"commit_hash": {
145+
"type": "string",
146+
"description": "The Git commit hash the LiTd binary build was based on."
139147
}
140148
}
141149
},

proto/proxy.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ message GetInfoRequest {
5252
}
5353

5454
message GetInfoResponse {
55-
// The version of the LiTd software that the node is running.
55+
// The application version of the LiTd software running on the node,
56+
// following the Semantic Versioning 2.0.0 specification
57+
// (http://semver.org/).
5658
string version = 1;
59+
60+
// The Git tag that the LiTd binary build was based on. If the build was
61+
// not based on a clean tagged commit, this field will contain the most
62+
// recent tag suffixed by the commit hash, and/or a "-dirty" suffix.
63+
string tag = 2;
64+
65+
// The Git commit hash the LiTd binary build was based on.
66+
string commit_hash = 3;
5767
}

rpc_proxy.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ func (p *rpcProxy) GetInfo(_ context.Context, _ *litrpc.GetInfoRequest) (
240240
*litrpc.GetInfoResponse, error) {
241241

242242
return &litrpc.GetInfoResponse{
243-
Version: Version(),
243+
Version: Version(),
244+
Tag: CommitTag(),
245+
CommitHash: CommitHash(),
244246
}, nil
245247
}
246248

0 commit comments

Comments
 (0)