gitgitgadget / git

GitGitGadget's Git fork. Open Pull Requests here to submit them to the Git mailing list
https://gitgitgadget.github.io/
Other
218 stars 134 forks source link

main windows-test workflow error handling is buggy #938

Open jsoref opened 3 years ago

jsoref commented 3 years ago

Looking at some runs, I noticed some odd failures...

This run especially: https://github.com/check-spelling/git/actions/runs/762362339/workflow

Here's an excerpt of the log (eventually the run will be Garbage Collected, and at some point before or after that, I will probably delete the repository):

:x: actions/checkout@v1 ``` steps: - uses: actions/checkout@v1 ``` ``` Run actions/checkout@v1 Syncing repository: check-spelling/git git version git version 2.31.1.windows.1 git lfs version git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851) git init "D:\a\git\git" Initialized empty Git repository in D:/a/git/git/.git/ git remote add origin https://github.com/check-spelling/git git config gc.auto 0 git config --get-all http.https://github.com/check-spelling/git.extraheader git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* remote: Repository not found. Error: fatal: repository 'https://github.com/check-spelling/git/' not found Warning: Git fetch failed with exit code 128, back off 5.447 seconds before retry. git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* error: RPC failed; HTTP 404 curl 22 The requested URL returned error: 404 Error: fatal: error reading section header 'shallow-info' Warning: Git fetch failed with exit code 128, back off 2.088 seconds before retry. git -c http.extraheader="AUTHORIZATION: basic ***" fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* remote: Repository not found. Error: fatal: repository 'https://github.com/check-spelling/git/' not found Error: Git fetch failed with exit code: 128 Error: Exit code 1 returned from process: file name 'c:\runners\2.277.1\bin\Runner.PluginHost.exe', arguments 'action "GitHub.Runner.Plugins.Repository.v1_0.CheckoutTask, Runner.Plugins"'. ```

🚫 download build artifacts 🚫 extract build artifacts 🚫 download git-sdk-64-minimal 🚫 test

:x: ci/print-test-failures.sh ``` - name: ci/print-test-failures.sh if: failure() shell: powershell run: | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh ``` ``` Run & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh & : The term '.\git-sdk-64-minimal\usr\bin\bash.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At D:\a\_temp\b09e3e86-ad33-476d-ae75-7deb9764dc31.ps1:2 char:3 + & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (.\git-sdk-64-minimal\usr\bin\bash.exe:String) [], ParentContainsErrorRe cordException + FullyQualifiedErrorId : CommandNotFoundException Error: Process completed with exit code 1. ```

The first step (checkout) failed (❌), and thus the next four steps were skipped (🚫). The ci/print-test-failures.sh step has an if: failure() so it will run even though the job is dead (in fact, only because...).

Here's the version of the workflow used: https://github.com/git/git/blob/0981a071e2e7d229ae547fe8db2875c0e3e38944/.github/workflows/main.yml

I wonder what value is gained by trying to use git-sdk-64-minimal's bash instead of doing shell: bash. I'm pretty sure that azure runners will have bash as well. I'd be shocked by a CI system that supports .github and doesn't support shell: bash.

A quick look at https://github.com/git/git/blob/0981a071e2e7d229ae547fe8db2875c0e3e38944/ci/print-test-failures.sh doesn't seem to show any particular benefit from trying to use the custom bash (which in the case of this run wasn't downloaded).

Admittedly, there's nothing useful to report since nothing actually ran. But this is an error in an error handler, and there's no need for it to error.


I'm not sure why the checkout itself failed. I mean, I can see what it says, but it doesn't particularly make sense to me. I'm puzzled by the pinned choice of actions/checkout@v1 instead of actions/checkout@v2 + with: + fetch-depth: 0 (see actions/checkout#fetch-all-history-for-all-tags-and-branches), but that's an unrelated issue.

dscho commented 3 years ago

❌ actions/checkout@v1

I think you might have merely run into https://www.githubstatus.com/incidents/cj7gzzj30411. I say that because the other matrix jobs did not fail, even if they executed the same definition.

I wonder what value is gained by trying to use git-sdk-64-minimal's bash instead of doing shell: bash. I'm pretty sure that azure runners will have bash as well. I'd be shocked by a CI system that supports .github and doesn't support shell: bash.

I am glad you asked.

Azure's agents indeed have a default Bash. On Windows, this is even the Git for Windows Bash.

The problem with that Bash is that it has no usable GCC. Or at least it does not have the one we expect Git for Windows to build with, and the result to pass Git's test suite.

Therefore we require git-sdk-64-minimal.

Regarding this, and the question whether to use actions/checkout@v2, I would like to point out that I already worked on this: https://github.com/gitgitgadget/git/pull/878. It is still being battle-tested in the git-for-windows/git fork, and once I satisfied myself that this is ready to be submitted, I will do so.

jsoref commented 3 years ago

I'm not asking about the whole workflow, just this one stage. I don't think it needs gcc.

jsoref commented 3 years ago

It looks like that PR also addresses the main item here, so, yay!

dscho commented 3 years ago

I'm not asking about the whole workflow, just this one stage. I don't think it needs gcc.

It might not need GCC, but it does need the minimal subset of Git for Windows SDK. What we want to ensure here is not that the compiled Git would run when copied into whatever Git for Windows version is installed in that build agent, but that the compiled Git would run when bundled as a new Git for Windows. That's what this guarantees.