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

git push in roundup action failing w/ remote ahead of local #98

Closed
jimmie opened this issue Oct 14, 2022 · 8 comments
Closed

git push in roundup action failing w/ remote ahead of local #98

jimmie opened this issue Oct 14, 2022 · 8 comments
Assignees
Labels
B13.1 bug Something isn't working i&t.skip s.low

Comments

@jimmie
Copy link
Contributor

jimmie commented Oct 14, 2022

πŸ› Describe the bug

Trying to build harvest release/3.7.1 and roundup-action failed with following error:

1 file changed, 1 insertion(+), 1 deletion(-)
DEBUG:pds.roundup.util:Stderr = «»
DEBUG:pds.roundup.util:πŸƒβ€β™€οΈ Running Β«['git', 'push', 'origin', 'HEAD:main']Β»
CRITICAL:pds.roundup.util:πŸ’₯ Process with command line ['git', 'push', 'origin', 'HEAD:main'] failed with status 1
CRITICAL:pds.roundup.util:πŸͺ΅ Stdout = «»
CRITICAL:pds.roundup.util:πŸ“š Stderr = Β«To https://github.com/NASA-PDS/harvest
! [rejected] HEAD -> main (fetch first)
error: failed to push some refs to 'https://github.com/NASA-PDS/harvest'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Β»
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pds.roundup-0.0.0-py3.9.egg/pds/roundup/util.py", line 52, in invoke
File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'push', 'origin', 'HEAD:main']' returned non-zero exit status 1.

Could be a side effect of #76.

@jimmie jimmie added bug Something isn't working needs:triage labels Oct 14, 2022
@jordanpadams
Copy link
Member

setting severity to low for the time being unless it becomes a major problem moving forward. I think this usually just means you are tagging without the latest commit. I have noticed this happening when I merge a PR and then try to tag a release before the unstable build completes. The unstable build then sneaks in a change log update before the stable build completes.

@jordanpadams
Copy link
Member

@nutjob4life @jimmie FYI ☝️

nutjob4life added a commit to nasa-pds-engineering-node/roundup-action that referenced this issue Oct 25, 2022
@nutjob4life
Copy link
Member

Apparently there are two causes of the issue:

  1. In mid-Roundup, someone merges to main which causes Roundup's attempt to push to main to fail because its local tree is out of date, which makes sense.
  2. For some reason we can't fathom, a push to main fails because the local tree is out of date, but git pull says Already up to date anyway.

Putting a git pull in front of any push to HEAD:main sounds like an easy fixβ€”except since we changed to triggering a release by a tag instead of a branch, we're always in a "detached HEAD" state in the Roundup action in stable releases.

Now, we could have the Roundup create a temporary branch from the release/X.Y.Z tag in which to do its workβ€”and then a git pull would succeed. But that's a bigger underlying change to the Roundup and we'd want to vet this "fix" fully in the sandbox.

But given this is a rare occurrence and the issue itself is marked s.low maybe we should skip it? Thoughts?

@jimmie
Copy link
Contributor Author

jimmie commented Oct 25, 2022

I am OK with kicking this to the curb.

@nutjob4life
Copy link
Member

Over Slack, @jimmie wrote:

it seems we can reproduce that build error fairly easily - each time we’ve done a commit just before tagging - the subsequent build appears to fail consistently. Food for thought.

So not kicking this to the curb.

@nutjob4life
Copy link
Member

The timeline that causes the problem seems to be as follows:

  1. git add some-file.c && git push origin main or merge a PR into main
  2. This triggers unstable-cicd.yaml which starts up a Roundup Action using the "unstable" assembly. What's happening at this point? _Quite a bit, including pushes directly into main.
  3. git tag release/1.2.3 && git push origin release/1.2.3
  4. This triggers stable-cicd.yaml which starts up a Roundup Action using the "stable" assembly. But the unstable assembly is still going on.

I think we need a mutex between Roundups so that one is ever only running at a time in a repository.

Thankfully, GitHub Actions provides such a feature for us: just add concurrency: roundup to all stable-cicd.yaml and unstable-cicd.yaml files at the workflow level. Sound good?

This was referenced Oct 28, 2022
@jordanpadams
Copy link
Member

all PRs merged. done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B13.1 bug Something isn't working i&t.skip s.low
Projects
None yet
Development

No branches or pull requests

4 participants