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

"old" version being uploaded as release #34

Open
wolph opened this issue Sep 1, 2021 · 14 comments
Open

"old" version being uploaded as release #34

wolph opened this issue Sep 1, 2021 · 14 comments

Comments

@wolph
Copy link

wolph commented Sep 1, 2021

While I'm still not a 100% sure it's the fault of gpgit (it could be my usage), but I'm seeing the previous commit being pushed as a release: wolph/numpy-stl#173

Some info:

  • develop branch appears correct
  • master branch appears correct
  • tag appears correct
  • built packages appear correct
  • uploaded release (not tag) appears incorrect

I call gpgit from a git-flow-avh post-flow-feature-finish hook like this: https://github.com/WoLpH/dotfiles/blob/master/_git_template/hooks/post-flow-release-finish

https://github.com/WoLpH/dotfiles/blob/e423965d14f9c33f184648092e323e5b8ad47f58/_git_template/hooks/post-flow-release-finish#L21

@NicoHood
Copy link
Owner

NicoHood commented Sep 1, 2021

You do not pass the branch or origin to the script. What is it used for?

You can call gpgit -d for debugging. You will see more output there. If you want to post it here, make sure your github token was hidden in the output before!

@wolph
Copy link
Author

wolph commented Sep 1, 2021

I'm honestly not sure how or where it's going wrong. As far as I can see the master branch, the develop branch and the tag are correct but somehow when I download the source code here, it is the previous version: https://github.com/WoLpH/numpy-stl/releases
The release files themselves are ok which makes me think it somehow links the release to the previous commit instead of the current one.

But I'm not sure if this is due to gpgit or not so I was hoping you might have an idea.

The branch and origin are automatically passed along by git-flow-avh when creating a release.

Here's the git-flow log from a release:

Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Merge made by the 'recursive' strategy.
 stl/__about__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Already on 'master'
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)
Switched to branch 'develop'
Your branch is ahead of 'origin/develop' by 1 commit.
  (use "git push" to publish your local commits)
Already up to date.
Merge made by the 'recursive' strategy.
[GPGit gets executed here]
Deleted branch release/2.16.3 (was 41ea59f).

Summary of actions:
- Release branch 'release/2.16.3' has been merged into 'master'
- The release was tagged 'v2.16.3'
- Release tag 'v2.16.3' has been back-merged into 'develop'
- Release branch 'release/2.16.3' has been locally deleted
- You are now on branch 'develop'

And the gpgit log: log

@NicoHood
Copy link
Owner

NicoHood commented Sep 1, 2021

From the log you can see, that it tags the commit COMMIT=HEAD

You can also see gpgit: line 450: BOLD: unbound variable. Which means the script crashes. Now I am wondering why you even have an output at all.

The crash needs to be fixed, I understand why that happens.

@NicoHood
Copy link
Owner

NicoHood commented Sep 1, 2021

I have commited a fix for the color issue

@NicoHood
Copy link
Owner

NicoHood commented Sep 1, 2021

Alright, looking at your output there seems to be something wrong with your hook. If I have the source of that hook, I can help better.

The issue is, that you are doing a merge. It looks like from dev to master possibly. But you are still tagging the dev branch. GPGit by default tags the HEAD, so that might still point to dev?

@NicoHood
Copy link
Owner

NicoHood commented Sep 1, 2021

So I see that the signed release contains the correct files, while the git tag (and autogenerated github files) do not. Weird.

I have no idea why that happens, as the archive is being created based on the tag. Maybe that is not working correct?
Edit: I still have no idea. I need a complete logfile again.

@wolph
Copy link
Author

wolph commented Sep 6, 2021

I've downloaded the new version from your repo and tried again. The log is attached
gpgit.log

For release 2.16.3 I have not done a git push yet so everything that's visible was generated by gpgit: https://github.com/WoLpH/numpy-stl/releases

The .xz file is correct, both the .tar.gz and .zip files are not.

Upon a little closer inspection, it appears that GPGit correctly pushes the new release with the correct files, but it also pushes an incorrect Git tag. I'm not sure if that's a Github releases quirk or something else, but it appears to be creating a tag based on what is on Github at that time (before the changes are pushed): https://github.com/WoLpH/numpy-stl/tree/v2.16.3

The big issue here is... when I do a git push after creating the release, it won't push the tag anymore because gpgit already created it. Otherwise it could have fixed the issue because the local tag is correct.

@wolph
Copy link
Author

wolph commented Sep 6, 2021

I think I have found it. The current branch is passed as target_commitish which causes github to use that branch to create the tag.

As a workaround I can do a git push --tags before creating the gpgit release, I'm not sure if there's a better solution as Github doesn't allow creating releases with non-existing hashes.

@wolph
Copy link
Author

wolph commented Sep 6, 2021

That appears to work. Perhaps GPGit should default to pushing the tag before creating the release if it exists?

@NicoHood
Copy link
Owner

I dont understand. What is target_commitish?

Gpgit first creates the tag, then pushes it and afterwards creates a github release. I dont understand what you would want to improve here, as it looks "already improved to me". I guess I am completely wrong.

@wolph
Copy link
Author

wolph commented Sep 12, 2021

Yes, gpgit creates the tag locally. But until it is pushed, github won't know about it.

So when you create the release on github, github automatically creates a tag from the current source on github which is outdated at that point.

@NicoHood
Copy link
Owner

NicoHood commented Sep 12, 2021

But the tag gets pushed first.

https://github.com/NicoHood/GPGit/blob/master/gpgit.sh#L715

Maybe the issue is, that it will tag the default branch, as it cannot detect the target branch of the tagged commit?
https://github.com/NicoHood/GPGit/blob/master/gpgit.sh#L864-L877

So the solution would be to push the commit (not the tag) on the specific branch first, so that the Github release will work?

A debug log would help a lot. Does it say "Warning Publishing release on default Github branch"?

@wolph
Copy link
Author

wolph commented Sep 12, 2021

That part could be the culprit in that case. The tag already exists due to git-flow-avh, but that not push it yet. In that case gpgit does not push the tag anymore.

So I guess it's just user error...

With regards to the debug log, I attached one to an earlier reply: https://github.com/NicoHood/GPGit/files/7117208/gpgit.log

In any case, perhaps a good one for the FAQ but it's the interaction between the other scripts that's causing this.

@wolph wolph closed this as completed Sep 12, 2021
@NicoHood
Copy link
Owner

I will try to provide a fix for that, by looking up the remote:
https://stackoverflow.com/questions/6294224/check-if-pushed-tag-is-on-the-git-remote/21116365#21116365

@NicoHood NicoHood reopened this Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants