Skip to content
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

Allow force deleting agent pools #435

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

komalali
Copy link
Member

@komalali komalali commented Nov 1, 2024

Sometimes, a user may want to force delete an agent pool, even if it is associated with existing deployment settings. This is already supported in the API, bringing the functionality to PSP.

@komalali komalali force-pushed the komal/allow-force-deleting-agent-pool branch from 8c35ce5 to d931b1d Compare November 1, 2024 03:55
@komalali komalali force-pushed the komal/allow-force-deleting-agent-pool branch from d931b1d to 15dfae1 Compare November 1, 2024 03:58
@komalali komalali force-pushed the komal/allow-force-deleting-agent-pool branch from 69dba5e to 1d8d156 Compare November 5, 2024 06:23
Urn: "urn:beep-boop",
}

resp, err := provider.Delete(&req)
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this just testing that the mock returns what you told it to return? 😞
I don't think this is useful

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a better test would be verifying that the force=true param gets passed through when destroying the stack that has the ForceDestroy input set

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that's fair. Anything that's not a full integration test has been somewhat tricky to test in the provider. Let me spend some time figuring this out.

Copy link
Contributor

@nyobe nyobe Nov 6, 2024

Choose a reason for hiding this comment

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

it seems like most of the other tests in the package are the same way so I don't want to block you 🤷‍♀️
but if you figure out something I'd love to know for #436 !

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think I'm going to merge this just to unblock Scala but this is a good question that we do need an answer to beyond E2E tests

@@ -39,7 +39,7 @@ const stackWebhook = new service.Webhook("stack-webhook", {
organizationName: serviceOrg,
projectName: pulumi.getProject(),
stackName: pulumi.getStack(),
payloadUrl: "https://example.com",
payloadUrl: "https://hooks.slack.com/blahblah",
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed an update due to new URL validation for webhooks

@@ -106,18 +107,23 @@ func (c *Client) UpdateAgentPool(ctx context.Context, agentPoolId, orgName, name
return nil
}

func (c *Client) DeleteAgentPool(ctx context.Context, agentPoolId, orgName string) error {
func (c *Client) DeleteAgentPool(ctx context.Context, agentPoolId, orgName string, forceDestroy bool) error {
Copy link
Member

Choose a reason for hiding this comment

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

super nit: should we consider making options like this a struct in case we need to add more later?

@@ -31,6 +32,9 @@ func GenerateAgentPoolProperties(input PulumiServiceAgentPoolInput, agentPool pu
if input.Description != "" {
inputMap["description"] = resource.NewPropertyValue(input.Description)
}
if input.ForceDestroy {
inputMap["forceDestroy"] = resource.NewPropertyValue(input.ForceDestroy)
Copy link
Member

Choose a reason for hiding this comment

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

Might want to make forceDestroy a constant

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, not sure it makes sense to make one input a constant and not any of the others... so I'd leave that to a future optimization since this is not the pattern anywhere in the provider.

@komalali komalali merged commit 3445009 into main Nov 6, 2024
13 checks passed
@komalali komalali deleted the komal/allow-force-deleting-agent-pool branch November 6, 2024 22:19
@pulumi-bot
Copy link

This PR has been shipped in release v0.27.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants