-
Notifications
You must be signed in to change notification settings - Fork 102
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
Update Run Tasks for global config and stages #865
Conversation
fdff167
to
ae83584
Compare
7faf9e7
to
fe0b2e3
Compare
d30fe15
to
54ab479
Compare
Add Compliance team for review. Not that it's required, but a nice to have |
23e371d
to
3e5eee6
Compare
} | ||
// DEPRECATED : Please use the newSubscriptionUpdater instead. | ||
func upgradeOrganizationSubscription(t *testing.T, _ *Client, organization *Organization) { | ||
newSubscriptionUpdater(organization).WithBusinessPlan().Update(t) |
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.
nice!! 👍
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.
A minor comment fix. LGTM otherwise! 👍
This commit also extracts the subscription update process and updated it as it fails in the local development. Specifically, there may be 2 or more tokens used to administer a TFC instance which have different admin scopes. This commit now encapsulates that logic inside a SubscriptionUpdater "service" class which can be used to build up the request to update a subscription.
This commit updates the entitlement set object to include the new global-run-tasks feature.
The global run tasks feature updates both the Organization and Workspace Run tasks with new attributes. Unfortunately these new attributes exposed an issue with the JSON API pacakge, that it doesn't support complex objects (Custom maps or non-standard types) [1]. Instead we need to unmarshall to a more simpler object and then we adapt the simpler object to our more correct struct. [1] google/jsonapi#74
59dee80
to
3cbccb0
Compare
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.
Very nicely done to expose the interface you want and hide the problematic object case. I also appreciate the subscription update cleanup
Category string `jsonapi:"attr,category"` | ||
HMACKey *string `jsonapi:"attr,hmac-key,omitempty"` | ||
Enabled bool `jsonapi:"attr,enabled"` | ||
RawGlobal map[string]interface{} `jsonapi:"attr,global-configuration,omitempty"` |
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.
TIL that jsonapi doesn't automatically decode json annotated attribute object types. It's certainly in spec to have an object within an attribute. I will take a closer look after I finish this review.
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.
Unfortunately, jsonapi is effectively a dead project :-( It had a "No Maintenance Intended" badge added 4 years ago and the PR/Issues list is wasteland. We'd have to fork it if we wanted to fix any issues with it.
DERP ME ... we are using a fork
Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes. |
This PR needs the Global Run Tasks feature to be generally available, and deployed to the CI environment before CI will pass
Description
This commit also extracts the subscription update process and updated it as it
fails in the local development. Specifically, there may be 2 or more tokens
used to administer a TFC instance which have different admin scopes. This commit
now encapsulates that logic inside a SubscriptionUpdater "service" class which
can be used to build up the request to update a subscription.
This commit updates the entitlement set object to include the new
global-run-tasks feature.
The global run tasks feature updates both the Organization and Workspace
Run tasks with new attributes. Unfortunately these new attributes exposed
an issue with the JSON API pacakge, that it doesn't support complex objects
(Custom maps or non-standard types) [1]. Instead we need to unmarshall to
a more simpler object and then we adapt the simpler object to our more
correct struct.
[1] google/jsonapi#74
Testing plan
Updated integration tests exercise this behaviour.
External links
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.