Skip to content

Add submodule that automatically cleans up old projects #3

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

Merged
merged 14 commits into from
Jun 11, 2019

Conversation

Jberlinsky
Copy link
Contributor

This pull request depends on #2

Adds an example tool that automatically cleans up old projects in a GCP Organization. This tool checks an organization for projects over a certain number of hours old, whose labels contain a specified key-value pair. All of these parameters are configured via environment variables passed to the cloud function. The nascent purpose of this tool is to clean up projects in the CFT continuous automation pipeline that linger as a result of CI failures or other errors.

This example is notably not currently controlled by an integration test. This is a potential future improvement.

@morgante morgante requested review from morgante and aaron-lane March 27, 2019 15:14
Copy link
Contributor

@aaron-lane aaron-lane left a comment

Choose a reason for hiding this comment

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

Please rebase the branch.

@ogreface
Copy link
Contributor

I'm a little weary of putting an example with substantial side effects into a public repo that if run by default would delete old projects in the org. Mostly because I think it's a pretty unexpected result of a example for scheduled functions themselves.

@morgante
Copy link
Contributor

The point of examples is to show what you could do, nobody should be blindly running examples.

This might be better off as a submodule though.

@ogreface
Copy link
Contributor

Agreed on not blindly running examples. But we have modules where integration tests run all the examples. And while we'd desire the cleanup, someone using the module themselves wouldn't expect deletion just running the example (or eventually integration tests).

Could even gate it with a flag "actually_delete_projects" that defaults to false or something would be a little safer. Though I think the submodule might be the better choice as you said.

@morgante
Copy link
Contributor

But we have modules where integration tests run all the examples.

That doesn't mean we always want to, but we could easily adjust the defaults to target projects we do want deleted.

We don't have anything which automatically runs all examples, nor should we.

And while we'd desire the cleanup, someone using the module themselves wouldn't expect deletion just running the example (or eventually integration tests).

I disagree. If you run an example called "delete projects" and are surprised when projects get deleted, that's WAI.

Could even gate it with a flag "actually_delete_projects" that defaults to false or something would be a little safer.

I'd rather not introduce flags which no actual user will ever need.

@ogreface
Copy link
Contributor

ogreface commented Mar 27, 2019

But we have modules where integration tests run all the examples.

That doesn't mean we always want to, but we could easily adjust the defaults to target projects we do want deleted.

We don't have anything which automatically runs all examples, nor should we.

Ah, then I misunderstand that then. I thought we'd be making this part of the integration tests, as we've done on other projects. If that isn't happening, then it's less risky.

Possibly we want to rename cleanup -> deletion then.

@Jberlinsky Jberlinsky force-pushed the feature/automatic-project-deletion-example branch from 3917899 to 0eefc6f Compare March 27, 2019 17:23
@aaron-lane aaron-lane dismissed their stale review March 27, 2019 18:35

Rebased!

Copy link
Contributor

@aaron-lane aaron-lane left a comment

Choose a reason for hiding this comment

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

Based on out of band discussion, let's change this to be a submodule.

@Jberlinsky Jberlinsky force-pushed the feature/automatic-project-deletion-example branch from 0eefc6f to 3ecc7fa Compare May 15, 2019 03:32
@Jberlinsky Jberlinsky requested a review from aaron-lane May 15, 2019 03:32
Copy link
Contributor

@aaron-lane aaron-lane left a comment

Choose a reason for hiding this comment

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

The submodules directory must be renamed to modules (as unintuitive as it is).

@Jberlinsky Jberlinsky requested a review from aaron-lane June 1, 2019 15:03
@Jberlinsky
Copy link
Contributor Author

@aaron-lane This is ready for another pass, thanks!

@aaron-lane aaron-lane added the enhancement New feature or request label Jun 3, 2019
@aaron-lane aaron-lane changed the title Add example tool that automatically cleans up old projects Jun 3, 2019
@Jberlinsky
Copy link
Contributor Author

@aaron-lane Sorry for the delay in responding to these -- it appears that my Github notifications weren't quite tuned right. This is ready for another pass at your convenience.

@Jberlinsky Jberlinsky requested a review from aaron-lane June 11, 2019 03:56
@aaron-lane
Copy link
Contributor

Thanks @Jberlinsky!

@aaron-lane aaron-lane merged commit ba5a47b into master Jun 11, 2019
@aaron-lane aaron-lane deleted the feature/automatic-project-deletion-example branch June 11, 2019 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
6 participants