diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5b3092c35..38ff07d66a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -242,6 +242,8 @@ jobs: workdir: src env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }} + RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }} - name: Upload assets uses: actions/upload-artifact@v3 @@ -305,6 +307,7 @@ jobs: - name: Build Corso Binaries run: > + export 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 }}'" ./build.sh --platforms ${{ env.PLATFORMS }} diff --git a/build/build.sh b/build/build.sh index 19502092ad..aff2559024 100755 --- a/build/build.sh +++ b/build/build.sh @@ -63,7 +63,7 @@ do --env GOARCH=${GOARCH} \ --entrypoint /usr/local/go/bin/go \ golang:${GOVER} \ - build -o corso ${CORSO_BUILD_ARGS} + build -o corso ${CORSO_BUILD_ARGS} -ldflags "${CORSO_BUILD_LDFLAGS}" set +x mkdir -p ${PROJECT_ROOT}/bin/${GOOS}-${GOARCH} diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index 8f251243f2..e3ab77689d 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -12,6 +12,10 @@ builds: ignore: - goos: windows goarch: arm64 + ldflags: + - -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}}' + archives: - replacements: darwin: Darwin diff --git a/src/internal/events/events.go b/src/internal/events/events.go index 414dd5a7fd..3f63bd7872 100644 --- a/src/internal/events/events.go +++ b/src/internal/events/events.go @@ -57,8 +57,8 @@ type Bus struct { } var ( - WriteKey string - DataPlaneURL string + RudderStackWriteKey string + RudderStackDataPlaneURL string ) func NewBus(s storage.Storage, tenID string, opts control.Options) Bus { @@ -70,17 +70,17 @@ func NewBus(s storage.Storage, tenID string, opts control.Options) Bus { envWK := os.Getenv("RUDDERSTACK_CORSO_WRITE_KEY") if len(envWK) > 0 { - WriteKey = envWK + RudderStackWriteKey = envWK } envDPU := os.Getenv("RUDDERSTACK_CORSO_DATA_PLANE_URL") if len(envDPU) > 0 { - DataPlaneURL = envDPU + RudderStackDataPlaneURL = envDPU } var client analytics.Client - if len(WriteKey) > 0 && len(DataPlaneURL) > 0 { - client = analytics.New(WriteKey, DataPlaneURL) + if len(RudderStackWriteKey) > 0 && len(RudderStackDataPlaneURL) > 0 { + client = analytics.New(RudderStackWriteKey, RudderStackDataPlaneURL) } return Bus{