-
Notifications
You must be signed in to change notification settings - Fork 840
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 fly clear-versions command #8196
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xtremerui
reviewed
Mar 31, 2022
xtremerui
reviewed
Apr 1, 2022
I created two endpoints, one for clearing resource versions and the other for clearing resource type versions. They both do the same thing where if an admin runs the endpoint, it will trust and clear the resource/resource type versions through it's scope. This means that if the resource is sharing the scope with other resources, it will also clear the versions for the other resources as well. There will be a validation phase in the fly command that I will implement in the next commit that will tell the user which resources will be affected by this clearing of versions and if the user is sure they want to continue with the clearing of versions. [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
Added two endpoints for fetching the resources or resource types that are sharing the same resource config scope id as the one that is passed into the endpoint. There are two endpoints because one is for finding the shared resources/resource types of a resource and the other is for a resource type. The endpoints are basically the exact same though. These endpoints are added for the fly clear-versions command that will be added because it will be used to display to the user what resources/resource types will be affected by the clearing of versions. [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
Modify the clear versions for resource and resource type to return the number of versions that were deleted. This will be shown in the fly command after you have deleted versions using the clear versions fly command. [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
The clear-versions command can take in either a resource or a resource type to clear the versions for. It will also print a warning message with all the resources/resource types that the clearing of versions will affect. Also added the endpoints to the go-concourse package so that they can be used by fly. [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
thanks rui! [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
Addresses review comment to write the error to stdout when it fails with 500 in the api endpoints. I only added it to the db methods that have a higher chance of erroring vs the other db methods that is only for information gathering. [#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
[#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
[#5418] Signed-off-by: Clara Fu <fclara@vmware.com>
clarafu
force-pushed
the
fly-clear-versions
branch
from
April 7, 2022 20:20
1d1f56e
to
e6ad875
Compare
@xtremerui Should be ready to be re-reviewed! :) |
xtremerui
approved these changes
May 11, 2022
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.
Manually run the concourse and build fly to test the new command. Works good for me!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed by this PR
closes #5418
I added a fly command that will clear the version history for a resource or a resource type. It will print out a warning message before it executes the deletion in order to show the user which other resources/resource-types are affected if they are sharing the same version history.
Only admin users will be able to use this command because of how it can be used to delete version histories of resources/resource-types across pipelines/teams.
Through adding this fly command, I had to add 4 API endpoints. 2 are for listing out the resources/resource-types that share the same
resource_config_scope_id
(meaning that they are sharing the same version history). The other 2 endpoints are for clearing the version history for the resource or resource type.Release Note
global-resources
enabled, it can possibly delete version histories of other resources/resource-types in other pipelines so there is a warning message that will show any resources or resource types that are affected.