-
Notifications
You must be signed in to change notification settings - Fork 16
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: gto assign / deprecate / register —auto-push #281
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1c2914f
introduce git_push_tag
c053fe3
introduce git_push_tag
a8a71ee
fix echoes suggestion on tag pushing
78c2651
introduce auto-push option in register command
f25fb7f
fix expected message in test
0a3811f
fix test for windows
46e3061
echo git push tag
66344b1
add --auto-push option to gto register
cc379b1
add --auto-push option to gto api unassign
c7bb538
add --auto-push option to gto api deregister
5f683fa
add --auto-push option to gto api deprecate
4ce3170
fix minor bugs
0d4f768
quote echoed git command hints with "`"
francesco086 eae7245
throw exception WrongArgs if try to push tag but provided repo does n…
b13909b
remove prints
8cad931
remove todo after clarification
ea2df8b
assign stage to a model that was not registered requires two tags (fi…
96accc8
fix echo messages in the delete=true case
17eaa0b
fix use of remote.push (takes a list as argument, not many arguments)
a2b0b30
mark auto-push feature as experimental
0f39722
if git push tag fails then raise GTOException, which results in exit …
3858a3f
cleaned test_git_utils by collecting common code to create mocked repo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,5 +138,6 @@ dmypy.json | |
cython_debug/ | ||
|
||
.idea | ||
.vscode | ||
|
||
gto/_gto_version.py |
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
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
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
Oops, something went wrong.
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.
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.
Something to consider: it could be that we have some Git tags locally, but don't have them in remote. Then if you run
--auto-push
in locally cloned repo, you'll decide what to do based on the local repo, but you will try to apply it to the remote one. It could be an error in some cases (you try to remove a remote Git tag that doesn't exist in remote). It could be a incorrect decision (you deprecate a version that doesn't exist in the remote). Looks too complicated to resolve at Friday evening 🍻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.
"From great power comes great responsibility" I'd say :D
In the end the auto-push is something you can choose to use or not at every call, as you can choose or not to git push a tag. But if this were not (very) useful, why would you echo a suggestion to push the created tags?
In practice I find hard to imagine to work with a local repo out of sync with the remote. This is the CI/CD practice, isn't it?
In fact I would suggest to be able to set auto-push always true in a config file...
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.
This could happen by chance. But ok, I guess we'll need to accommodate for this in the future. This may happen as part of implementing
gto status
command, so I'll write it in that ticket.Good idea!
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.
Example of the currently misleading behavior. Consider you have a git tag
[email protected]
in remote, but don't have it locally. Then:I think we should fail at push, printing something like:
The Git tag [email protected] already exists on remote.
WDYT?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.
I agree that it would be more user friendly, therefore desirable. But on the other hand, the same exact error would happen if the user does the git push manually, right? So, as the user can choose if to do git push or not, can also choose whether to add the option
--auto-push
or not.In conclusion, I don't see much harm in it, but one could make error messages easier to interpret, I agree.
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.
Ok, think I got your point. As I see the difference
Successfully pushed git tag...
. E.g. the user may assume the CI is triggered in the remote. But the tag was not pushed, and CI was not triggered. So we're confusing user with this message.--no-fail-if-tags-exist-in-remote
e.g.), but I think it's overkill now.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.
ok, then is it ok if I apply the following change: if
git push
fails, then echo an appropriate message and exit with code 1?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.
appropriate message being something like "Execution of
git push origin [email protected]
failed. Make sure your local repository is in sync with the remote."ok?
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.
Yes, totally. Thanks 🙏🏻
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.
This should be it: 0f39722