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

fatal: not a valid object name: '4.0.x' #241

Open
Spomky opened this issue May 19, 2023 · 4 comments · May be fixed by #255
Open

fatal: not a valid object name: '4.0.x' #241

Spomky opened this issue May 19, 2023 · 4 comments · May be fixed by #255
Labels
Bug Something isn't working

Comments

@Spomky
Copy link

Spomky commented May 19, 2023

Bug Report

Q A
Version(s) 1.24.0

Summary

Job is failing: https://github.com/web-token/jwt-framework/actions/runs/5016108869/jobs/8992552443
Previous executions were fine: https://github.com/web-token/jwt-framework/actions/runs/4392789931/jobs/7692769201
No changes in the Github Action file.
I cannot find what is missing.

Current behavior

Github Action fails with the following error code and detail.

In execute.php line 180:
                                                                               
  [Psl\Shell\Exception\FailedExecutionException (128)]                         
  Shell command "exec git 'branch' 'temporary-branchHVM4BAIn' '4.0.x'" return  
  ed an exit code of "128".                                                    
                                                                               
  STDOUT:                                                                      
                                                                               
                                                                               
  STDERR:                                                                      
      fatal: not a valid object name: '4.0.x'                                  
                                                                               

Exception trace:
  at /app/vendor/azjezz/psl/src/Psl/Shell/execute.php:180
 Psl\Shell\execute() at /app/src/Git/PushViaConsole.php:25
 Laminas\AutomaticReleases\Git\PushViaConsole->__invoke() at /app/src/Application/Command/SwitchDefaultBranchToNextMinor.php:61
 Laminas\AutomaticReleases\Application\Command\SwitchDefaultBranchToNextMinor->execute() at /app/vendor/symfony/console/Command/Command.php:312
 Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Application.php:1022
 Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Application.php:3[14](https://github.com/web-token/jwt-framework/actions/runs/5016108869/jobs/8992552443#step:6:15)
 Symfony\Component\Console\Application->doRun() at /app/vendor/symfony/console/Application.php:[16](https://github.com/web-token/jwt-framework/actions/runs/5016108869/jobs/8992552443#step:6:17)8
 Symfony\Component\Console\Application->run() at /app/bin/console.php:[18](https://github.com/web-token/jwt-framework/actions/runs/5016108869/jobs/8992552443#step:6:19)0
 Laminas\AutomaticReleases\WebApplication\{closure}() at /app/bin/console.php:181

laminas:automatic-releases:switch-default-branch-to-next-minor

How to reproduce

The error is issued during normal Github Action call.

Expected behavior

The branch '4.0.x' already exists. It is expected for the action to correctly find it and continue its execution.

@Spomky Spomky added the Bug Something isn't working label May 19, 2023
@Ocramius
Copy link
Member

I've seen this a number of times now: I think the action is not fetching all branches 🤔

@Spomky
Copy link
Author

Spomky commented May 21, 2023

I modified the action to make sure all branches are fetched. Unfortunately, the result is the same.

@Xerkus
Copy link
Member

Xerkus commented Feb 1, 2024

This does not make much sense. It tries to create new default branch from latest release branch not taking into account release major version.
If release happened for previous major like 3.10.0 while 4.0.x branch exists it attempts to create new default branch from 4.0.x. I wonder what new branch name is, I suspect it is 3.11.x meaning major changes can get backported on branch switch.

@Xerkus
Copy link
Member

Xerkus commented Feb 1, 2024

I looked closely at this issue. I am pretty sure I know what is going on here.

Checkout action by default does depth 1 shallow checkout. Doing git fetch in shallow repository prevents fetching refs that are not in .git/shallow.

https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---update-shallow

--update-shallow

By default when fetching from a shallow repository, git fetch refuses refs that require updating .git/shallow. This option updates .git/shallow and accepts such refs.

Since release normally happens from latest release branch it ends up available in happy path condition.
However, when latest available release branch is for the next major it is not fetched to local repository which causes this failure.

It is for the good actually. If not for this bug the more sinister bug would have been uncovered: next minor branch for current major would have been created from the next major branch.

Fix here is two-fold:

  • Fix latest release branch selection to only consider same major versions.
  • Update release action workflow to do full clone. Alternative would be to add --unshallow to git fetch in SwitchDefaultBranchToNextMinor command. I like former approach better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants