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

gto should not push on register without --push flag. #405

Closed
tnjordan opened this issue Sep 12, 2023 · 3 comments · Fixed by #417
Closed

gto should not push on register without --push flag. #405

tnjordan opened this issue Sep 12, 2023 · 3 comments · Fixed by #417
Labels
p1-high High priority triage

Comments

@tnjordan
Copy link
Contributor

tnjordan commented Sep 12, 2023

The gto command has a --push flag which according to the docs will push a created tag.

--push - Push created tag automatically (experimental)

However, looking into the code the tag will automatically be pushed if the git repository has a remote.

This is unexpected as it is not a mentioned actions in the docs. I looked back into a older versions of gto (v0.3.5) and saw that there was similar logic, but found the logic to not be implemented/functional.

I have a github action that automatically increments the tag version when changes are pushed to a branch (prod).

name: Increment Tag Version
on:
  push:
    branches:
      - prod

jobs:
  tag-up:
    environment: ${{ github.ref_name }}
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.<Personal Access Token>}}
          fetch-depth: 0

      - name: ⬆️ tag version ⬆️
        run: |
          pip install gto
          git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          gto register pfc-irm HEAD --bump-patch
    
      - name: ✍ push tags ✍
        run: |
          git push origin --tags

This action was working with gto prior to the version 1 release. It now fails with the logs:

Created git tag '<model>@v1.0.11' that registers version
Running `git push origin <model>@v1.0.11`
❌ The command `git push origin <model>@v1.0.11` failed. Make sure your local 
repository is in sync with the remote.

I am not sure why the automatic gto register push is failing; however, I would suggest that the push only happens when the --push flag is provided. An additional --auto-push flag could be created that could cover the current behavior.

Alternatively pushing could be the default behavior and a --no-push flag could be provided to prevent pushing.

@mnrozhkov
Copy link

Thanks for reporting @tnjordan! I found out about this issue today as well.

@shcheklein
Copy link
Member

I've confirmed that this is a bug. Fix is coming here #417 . Sorry for the inconvenience folks. There was a lack of tests that made the last refactoring fragile a bit.

shcheklein added a commit that referenced this issue Sep 23, 2023
Fixes #405 

We've changed the semantic of the operation during the recent migration
to `scmrepo`. The key thing is the `has_remote(reg.scm)` calls and
implementation. I think the original intention was to push automatically
when we run GTO operations on a remote repo (means we are cloning it
into a temp dir, do some op, and push the result back).

## TODO

- [x] Tests
- [x] Review CLI option description
- [x] Review docs

## Docs

Relevant docs update is here
iterative/dvc.org#4879
@shcheklein
Copy link
Member

Should be fixed in the 1.3.0 that should be published today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-high High priority triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants