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

feat(gateway): block project deletion on secrets deletion #1338

Conversation

oddgrd
Copy link
Contributor

@oddgrd oddgrd commented Oct 23, 2023

Description of change

This is based on #1307.

This forces users to delete secrets from resource-recorder before they can delete a project.

How has this been tested? (if applicable)

With a local run of a project with secrets and postgres.

)
})
.map(|resource| resource.r#type.to_string())
.collect::<HashSet<_>>()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may be a bit overkill (it needs to add a few Derive(Hash) annotations), there shouldn't be more than one of each resource, but we have seen that it can happen.

Copy link
Member

Choose a reason for hiding this comment

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

In that case, it might be better to not dedup them here, so that the issue is not obfuscated.

Copy link
Contributor

@iulianbarbu iulianbarbu Oct 23, 2023

Choose a reason for hiding this comment

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

This may be a bit overkill (it needs to add a few Derive(Hash) annotations), there shouldn't be more than one of each resource, but we have seen that it can happen.

Not sure why it matters if there is more than one resource attached for checking if the project has resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll drop it, thanks!

@oddgrd oddgrd force-pushed the feature/eng-1594-block-project-deletion-on-secrets-deletion branch from d597007 to faf1961 Compare October 23, 2023 13:42
)
})
.map(|resource| resource.r#type.to_string())
.collect::<HashSet<_>>()
Copy link
Member

Choose a reason for hiding this comment

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

In that case, it might be better to not dedup them here, so that the issue is not obfuscated.

)
})
.map(|resource| resource.r#type.to_string())
.collect::<HashSet<_>>()
Copy link
Contributor

@iulianbarbu iulianbarbu Oct 23, 2023

Choose a reason for hiding this comment

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

This may be a bit overkill (it needs to add a few Derive(Hash) annotations), there shouldn't be more than one of each resource, but we have seen that it can happen.

Not sure why it matters if there is more than one resource attached for checking if the project has resources.

@oddgrd oddgrd force-pushed the feature/eng-1594-block-project-deletion-on-secrets-deletion branch from 13a9e85 to 51f20c8 Compare October 23, 2023 14:16
@oddgrd oddgrd changed the base branch from main to feat/eng-1500-project-delete October 23, 2023 14:17
@oddgrd oddgrd merged commit f0fbdfe into feat/eng-1500-project-delete Oct 23, 2023
@oddgrd oddgrd deleted the feature/eng-1594-block-project-deletion-on-secrets-deletion branch October 23, 2023 14:18
oddgrd added a commit that referenced this pull request Oct 23, 2023
* feat(cargo-shuttle): project delete command

* fix(cargo-shuttle): Refactor spinner, fix spam on service stop command

* feat(gateway): delete container and volume, delete from db, bump bollard, layout for gateway endpoint

* feat(gateway): add checks before project delete. fix stopping of running deployment.

* feat(gateway): use status endpoint, check for 404's, delete custom domains, fix stop command (caveat in testcase)

* fix(provisioner): validate project name

* fix(provisioner): gracefully handle deletion of non-existent db

* feat(gateway): project delete sqlx transaction

* test(gateway service): add basic project delete tests

* feat(gateway): block project delete on db or secrets (#1338)

---------

Co-authored-by: Iulian Barbu <iulianbarbu2@gmail.com>
Co-authored-by: Oddbjørn Grødem <29732646+oddgrd@users.noreply.github.com>
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.

3 participants