Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Bug 1428422 - add ROOTURL to Credentials struct #37

Closed
wants to merge 2 commits into from

Conversation

petemoore
Copy link
Member

Work in progress...

@coveralls
Copy link

coveralls commented Sep 21, 2018

Coverage Status

Coverage decreased (-1.5%) to 30.259% when pulling a9e04ad on bug1428422_4 into fb9c17b on master.

Copy link
Contributor

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments here, for consistency with other clients.

BaseURL: DefaultBaseURL,
Authenticate: credentials != nil,
Service: "` + api.ServiceName + `",
Version: "` + "v1" + `",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhford has added this to the API reference as api.apiVersion (defaulting to "v1" if not present)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great, the "v1" was a stop gap until we had somewhere to get this data from, I'll update it!

// TASKCLUSTER_ROOT_URL
//
// If environment variable TASKCLUSTER_ROOT_URL is empty string or not set,
// https://taskcluster.net will be assumed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not set a default value for rootUrl in the JS client. I worry that this is going to hide places where we missed setting rootUrl, letting them appear when we shut down taskcluster.net. Admittedly, there are fewer of those to worry about than for JS or Python, since basically only generic-worker uses the go client. Still, I'd like such errors to surface as quickly and easily as possible. For example, that made porting services to the new version of the JS client much easier, by just running the tests until they stopped failing with "rootUrl must be specified" :)

That new requirement is the reason for the major version change on the JS and Python libraries. I don't know if it's worth doing the same for this library (it requires a v2/ directory to make a breaking change in Go, right?), or given the limited usage of the library we can slide the change in in the same repository.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is funny, I had it in mind to go back and change this, it looks like I must have forgotten to - but I came to the same reasoning, so thanks for reminding me! Indeed, we also don't want external organisations to run their client, forget to export TASKCLUSTER_ROOT_URL in their environment (for example) and then suddenly (and surprisingly) connect to our production cluster. In the worst case they might call an unauthenticated endpoint (such as listing clients) and actually get back real data, rather than fail out with an error. That indeed would be undesirable! So, I agree 100%, and am also grateful you took the time to look through the code to see what it was doing. :-)

creds.go Outdated
// Version of client API, e.g. "v1"
Version string
// Service name, e.g. "aws-provisioner"
Service string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we call this ServiceName? To be consistent with the terminology used elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

creds.go Outdated
type Client struct {
// Version of client API, e.g. "v1"
Version string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps ApiVersion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll call it APIVersion so golint doesn't complain. Good idea!

@djmitche
Copy link
Contributor

@petemoore we accomplished this a different way eventually, right? Should this be closed?

@petemoore petemoore closed this Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants