-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INTMDB-232: Fix user agent version #505
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ GOOPTS="-p 2" | |
|
||
GITTAG=$(shell git describe --always --tags) | ||
VERSION=$(GITTAG:v%=%) | ||
LINKER_FLAGS=-X mongodbatlas/version.ProviderVersion=${VERSION} | ||
LINKER_FLAGS=-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}' | ||
|
||
GOLANGCI_VERSION=v1.29.0 | ||
|
||
|
@@ -42,7 +42,7 @@ websitefmtcheck: | |
lint: | ||
@echo "==> Checking source code against linters..." | ||
# https://github.com/golangci/golangci-lint/issues/337 fixing error | ||
golangci-lint run ./$(PKG_NAME) -v --deadline=30m | ||
bin/golangci-lint run ./$(PKG_NAME) -v --deadline=30m | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drive-by: golangci-lint is installed under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line 16 includes the bin folder in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't work for me on Mac, but it worked in GH actions |
||
|
||
tools: ## Install dev tools | ||
@echo "==> Installing dependencies..." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,9 @@ import ( | |
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" | ||
"github.com/mongodb/terraform-provider-mongodbatlas/version" | ||
|
||
digest "github.com/mongodb-forks/digest" | ||
"github.com/mongodb-forks/digest" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drive-by fix - unnecessary aliasing |
||
matlasClient "go.mongodb.org/atlas/mongodbatlas" | ||
realmAuth "go.mongodb.org/realm/auth" | ||
"go.mongodb.org/realm/realm" | ||
|
@@ -38,7 +39,7 @@ func (c *Config) NewClient(ctx context.Context) (interface{}, diag.Diagnostics) | |
|
||
client.Transport = logging.NewTransport("MongoDB Atlas", transport) | ||
|
||
optsAtlas := []matlasClient.ClientOpt{matlasClient.SetUserAgent("terraform-provider-mongodbatlas/" + ProviderVersion)} | ||
optsAtlas := []matlasClient.ClientOpt{matlasClient.SetUserAgent("terraform-provider-mongodbatlas/" + version.ProviderVersion)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [q] this is the user agent we do for the cli var userAgent = fmt.Sprintf("%s/%s (%s;%s)", config.ToolName, version.Version, runtime.GOOS, runtime.GOARCH) should we make something similar, ie: include os and arch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that makes sense. Will update later, but if you want to make the change directly on the PR it would be even better, since I won't be in front of a computer for the next few hours. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought @gssbzn, if we made this change, the UA would be reported as:
(since we add the OS/ARCH via the go client) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to merge the PR as is / I don't think duplicating that info makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. totally forgot we were doing that in the client, merge away |
||
if c.BaseURL != "" { | ||
optsAtlas = append(optsAtlas, matlasClient.SetBaseURL(c.BaseURL)) | ||
} | ||
|
@@ -50,7 +51,7 @@ func (c *Config) NewClient(ctx context.Context) (interface{}, diag.Diagnostics) | |
} | ||
|
||
// Realm | ||
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + ProviderVersion)} | ||
optsRealm := []realm.ClientOpt{realm.SetUserAgent("terraform-provider-mongodbatlas/" + version.ProviderVersion)} | ||
if c.BaseURL != "" { | ||
optsRealm = append(optsRealm, realm.SetBaseURL(c.BaseURL)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package mongodbatlas | ||
package version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved under root / following the same directory structure as the AWS provider |
||
|
||
var ( | ||
// ProviderVersion is set during the release process to the release version of the binary | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProviderVersion was not being replaced, without the full repo path being specified