-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add cleanup command #311
Comments
@dkundel I think this is great idea and I like the approach. #310 was aimed at removing projects to avoid hitting the limit of functions. I realise that you could just execute the api remove command, but this is not obvious at all. How about this approach? My take is that if we are going to remove specific services or environments, it needs to mirror how we created them in the first place.
This removes the service from Functions, which aligns nicely with creating a new service regardless the environment in the service.
This aligns with the process of creating an environment within a service. I think it would be good to have a remove and a clean option, because it is more obvious what you are trying to achieve; the 'verb' is used to deploy to an environment, so the command to clean up or remove should be similar. This is not a 100% fit, since the NAME is most likely mandatory for remove and cleanup, with I like the Your approach is actually even better than the original #310 ask. I like it! |
I do not think that
In the past I have used the regular CLI provided With the right documentation I think there should be separate commands:
With the command described as above under Format. Then for removals:
And to remove just an environment (for convenience)
or possibly
Note: because |
I created a verify service. Then I created a project using the CLI from a template. I deployed it. Now I cannot delete it. You can see the 2nd one I can delete because I did not use the CLI. So how can I delete the 1st one if the CLI does not have such a command yet? Also, I would expect the CLI to do whatever that delete button does. |
@rmcsharry You can use the regular Twilio CLI to remove a service via the |
Version 1.x of
twilio-run
at one point introduced a bug through a downstream dependency that would create additional unnecessary resources upon every deploy if the project had more than 50 Functions or more than 50 Assets.Twilio runs an automated cleanup job every 30 days that removes unused Functions and Assets both the respective Versions as well as any unused Resources.
Since the same logic can be executed through the public APIs it would be useful to provide customers with the same functionality.
Logic
Build
instances across allEnvironments
for a givenService
Function
andAsset
ResourcesFunctionVersion
andAssetVersion
instances given the respectiveFunctions
andAssets
FunctionVersion
andAssetVersion
that is not referenced in an activeBuild
Function
andAsset
Resources that don't have an activeFunctionVersion
orAssetVersion
respectively.Considerations
Since this is a very destructive action we should provide a
--dry-run
option that will perform the same logic but will output all resources that would be deleted without actually deleting them.Thought: Should we provide a prompt statement asking the user to confirm the deletion if
--dry-run
is not specified. To be friendly to CI/CD we should then also provide a--yes
flag as well as respect the--force
flag.Format
Possible Additional Features
#310 is asking for a
remove
functionality to delete the service. One option is to have these two commands live side by side but that could be confusing to customers.An alternative would be to add additional features to this command. The same functionality for example could be useful to delete a specific environment.
Option 1
Specific destructive flags such as
--delete-service
which will delete the entire specified service as well as--delete-environment
which will delete an entire environment as well as perform the regular cleanup specified above.If we go with this option the question would be if we should explicity require
--service-sid
or--environment
as flags if either of the two--delete-*
flags are being used or if we follow the same concept as any other command and try to infer these values.Option 2
Dedicated subcommands. We could provide
twilio serverless:cleanup:service
andtwilio serverless:cleanup:environment
. The benefit would be that it's likely more discoverable than Option 1 but it would also raise the question if the base command should betwilio serverless:cleanup:unused
instead.Option 3
We have a remove command as a dedicated separate command. This could lead to confusion as mentioned above.
The text was updated successfully, but these errors were encountered: