Skip to content

Commit 265b9a7

Browse files
committed
Add plugin version to Vault backend
Signed-off-by: Martin Baillie <martin@baillie.id>
1 parent f55e704 commit 265b9a7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.goreleaser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ builds:
2222
ldflags:
2323
- -s
2424
- -w
25-
- -extldflags
26-
- -static
25+
- -extldflags -static
2726
- -X {{.ModulePath}}/github.projectName={{.ProjectName}}
2827
- -X {{.ModulePath}}/github.projectDocs=https://{{.ModulePath}}
28+
- -X {{.ModulePath}}/github.projectVersion={{.Version}}
2929
- -X github.com/prometheus/common/version.BuildDate={{.Date}}
3030
- -X github.com/prometheus/common/version.Revision={{.Commit}}
3131
- -X github.com/prometheus/common/version.Version={{.Version}}

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
name = "vault-plugin-secrets-github";
4545
package = "github.com/martinbaillie/${name}";
4646
rev = self.rev or "dirty";
47-
ver = if self ? "dirtyRev" then self.dirtyShortRev else self.shortRev;
47+
ver = "v0.0.0-" + (if self ? "dirtyRev" then self.dirtyShortRev else self.shortRev);
4848
date = self.lastModifiedDate or "19700101";
4949
in
5050
{
@@ -68,6 +68,7 @@
6868
"-extld ld"
6969
"-extldflags -static"
7070
"-X ${package}/github.projectName=${name}"
71+
"-X ${package}/github.projectVersion=${ver}"
7172
"-X ${package}/github.projectDocs=https://${package}"
7273
"-X github.com/prometheus/common/version.BuildDate=${date}"
7374
"-X github.com/prometheus/common/version.Revision=${rev}"

github/backend.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/hashicorp/vault/sdk/logical"
1212
)
1313

14+
// Linker-provided project/build information.
15+
var projectVersion string
16+
1417
const backendHelp = `
1518
GitHub Apps Token Backend
1619
`
@@ -68,6 +71,7 @@ func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend,
6871
// Renew:
6972
}},
7073
Invalidate: b.Invalidate,
74+
RunningVersion: projectVersion,
7175
}
7276

7377
if conf == nil {

0 commit comments

Comments
 (0)