Skip to content

Commit

Permalink
fix: versions for operator during build
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Sep 11, 2023
1 parent 72c9158 commit 2dfe7d1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ builds:
- CGO_ENABLED=0
main: ./cmd/operator/
ldflags:
- -s -w -X main.version={{.Tag}}
- -s -w -X github.com/minio/operator/pkg.ReleaseTag={{.Tag}} -X github.com/minio/operator/pkg.CommitID={{.FullCommit}} -X github.com/minio/operator/pkg.Version={{.Version}} -X github.com/minio/operator/pkg.ShortCommitID={{.ShortCommit}} -X github.com/minio/operator/pkg.ReleaseTime={{.Date}}
flags:
- -trimpath
hooks:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ VERSION ?= $(shell git describe --tags)
VERSIONV ?= $(shell git describe --tags | sed 's,v,,g')
endif
TAG ?= "minio/operator:$(VERSION)"
LDFLAGS ?= "-s -w -X main.Version=$(VERSION)"
SHA ?= $(shell git rev-parse --short HEAD)
LDFLAGS ?= "-s -w -X github.com/minio/operator/pkg.ReleaseTag=$(VERSIONV) -X github.com/minio/operator/pkg.Version=$(VERSION) -X github.com/minio/operator/pkg.ShortCommitID=$(SHA)"
GOPATH := $(shell go env GOPATH)
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
Expand Down
2 changes: 1 addition & 1 deletion api/client-admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewAdminClientWithInsecure(url, accessKey, secretKey, sessionToken string,
stsClient := PrepareConsoleHTTPClient(insecure)
admClient.SetCustomTransport(stsClient.Transport)
// set user-agent to differentiate Console UI requests for auditing.
admClient.SetAppInfo("MinIO Console", pkg.Version)
admClient.SetAppInfo("MinIO Operator Console", pkg.Version)
return admClient, nil
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,10 @@ func getUserAgent() string {
uaAppend := func(p, q string) {
userAgentParts = append(userAgentParts, p, q)
}
uaAppend("Console (", runtime.GOOS)
uaAppend("Operator Console (", runtime.GOOS)
uaAppend("; ", runtime.GOARCH)
uaAppend(") Console/", pkg.Version)
uaAppend(" Console/", pkg.ReleaseTag)
uaAppend(" Console/", pkg.CommitID)
uaAppend(") Operator Console/", pkg.Version)
uaAppend(" Operator Console/", pkg.ShortCommitID)

return strings.Join(userAgentParts, "")
}
Expand Down
7 changes: 4 additions & 3 deletions web-app/src/api/operatorApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,10 @@ export class HttpClient<SecurityDataType = unknown> {
? { "Content-Type": type }
: {}),
},
signal: cancelToken
? this.createAbortSignal(cancelToken)
: requestParams.signal,
signal:
(cancelToken
? this.createAbortSignal(cancelToken)
: requestParams.signal) || null,
body:
typeof body === "undefined" || body === null
? null
Expand Down

0 comments on commit 2dfe7d1

Please sign in to comment.