Use corso version with event reporting (#1721)
## Description Add version of the current binary when reporting. ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [x] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * https://github.com/alcionai/corso/issues/1594 ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
95dda0425b
commit
6ee121a70a
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -492,7 +492,7 @@ jobs:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
CORSO_BUILD_LDFLAGS=-X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey=${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}' -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL=${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}' -X 'github.com/alcionai/corso/src/cli.version=${{ needs.SetEnv.outputs.version }}'
|
||||
CORSO_BUILD_LDFLAGS=-X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey=${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}' -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL=${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}' -X 'github.com/alcionai/corso/src/internal/version.Version=${{ needs.SetEnv.outputs.version }}'
|
||||
# use the github cache
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@ -13,7 +13,7 @@ builds:
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
ldflags:
|
||||
- -X 'github.com/alcionai/corso/src/cli.version={{.Env.CORSO_VERSION}}'
|
||||
- -X 'github.com/alcionai/corso/src/internal/version.Version={{.Env.CORSO_VERSION}}'
|
||||
- -X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey={{.Env.RUDDERSTACK_CORSO_WRITE_KEY}}'
|
||||
- -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL={{.Env.RUDDERSTACK_CORSO_DATA_PLANE_URL}}'
|
||||
|
||||
|
||||
@ -16,11 +16,10 @@ import (
|
||||
"github.com/alcionai/corso/src/cli/repo"
|
||||
"github.com/alcionai/corso/src/cli/restore"
|
||||
"github.com/alcionai/corso/src/internal/observe"
|
||||
"github.com/alcionai/corso/src/internal/version"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
)
|
||||
|
||||
var version = "dev"
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Corso Command
|
||||
// ------------------------------------------------------------------------------------------
|
||||
@ -40,7 +39,7 @@ var corsoCmd = &cobra.Command{
|
||||
func handleCorsoCmd(cmd *cobra.Command, args []string) error {
|
||||
v, _ := cmd.Flags().GetBool("version")
|
||||
if v {
|
||||
print.Outf(cmd.Context(), "Corso\nversion: "+version)
|
||||
print.Outf(cmd.Context(), "Corso\nversion: "+version.Version)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
analytics "github.com/rudderlabs/analytics-go"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/version"
|
||||
"github.com/alcionai/corso/src/pkg/control"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/storage"
|
||||
@ -98,7 +99,7 @@ func NewBus(ctx context.Context, s storage.Storage, tenID string, opts control.O
|
||||
client: client,
|
||||
repoID: repoHash(s),
|
||||
tenant: tenantHash(tenID),
|
||||
version: "vTODO", // TODO: corso versioning implementation
|
||||
version: version.Version,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
3
src/internal/version/version.go
Normal file
3
src/internal/version/version.go
Normal file
@ -0,0 +1,3 @@
|
||||
package version
|
||||
|
||||
var Version = "dev"
|
||||
Loading…
x
Reference in New Issue
Block a user