conda-smithy: v1 recipe fails when using `git` as `source` on Windows
When using this recipe with the c-f infrastructure:
context:
name: katago
version: 1.15.3
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
git: https://github.com/lightvector/KataGo.git
tag: v${{ version }}
build:
number: 0
script:
- touch hello.txt
about:
summary: GTP engine and self-play learning in Go
license: MIT
license_file: LICENSE
homepage: https://github.com/lightvector/KataGo
extra:
recipe-maintainers:
- hadim
It fails during a window build with:
╭─ Running build for recipe: katago-1.15.3-h57928b3_0
│
│ ╭─ Fetching source code
│ │ Fetching source from git repo: https://github.com/lightvector/KataGo.git
│ │ Fetching repository from https://github.com/lightvector/KataGo.git at refs/tags/v1.15.3 into D:\bld\src_cache\KataGo.git
│ │ × error Command failed: `git rev-parse "refs/tags/v1.15.3"`
│ │
│ ╰─────────────────── (took 8 seconds)
│
╰─────────────────── (took 8 seconds)
Error:
× Failed to run git command: failed to get valid hash for rev
Traceback (most recent call last):
File "D:\a\1\s\.ci_support\build_all.py", line 356, in <module>
build_all(os.path.join(root_dir, "recipes"), args.arch)
File "D:\a\1\s\.ci_support\build_all.py", line 192, in build_all
build_folders_rattler_build(recipes_dir, platform, arch, channel_urls)
File "D:\a\1\s\.ci_support\build_all.py", line 292, in build_folders_rattler_build
subprocess.run(args + ["--variant-config", fp.name], check=True)
Note that it does not fail on osx and linux.
See this simple experiment to reproduce: https://github.com/conda-forge/staged-recipes/pull/28906
The original issue has been spotted at https://github.com/conda-forge/katago-feedstock/pull/11 where I was seeing actually two different but maybe related errors depending on the conda_install_tool used:
conda_install_tool: micromamba: same as above instaged-recipes
╭─ Running build for recipe: katago-1.15.3-h57928b3_0
│
│ ╭─ Fetching source code
│ │ Fetching source from git repo: https://github.com/lightvector/KataGo.git
│ │ Fetching repository from https://github.com/lightvector/KataGo.git at refs/tags/v1.15.3 into D:\bld\src_cache\KataGo.git
│ │ × error Command failed: `git rev-parse "refs/tags/v1.15.3"`
│ │
│ ╰─────────────────── (took 8 seconds)
│
╰─────────────────── (took 8 seconds)
Error:
× Failed to run git command: failed to get valid hash for rev
Traceback (most recent call last):
File "D:\a\1\s\.ci_support\build_all.py", line 356, in <module>
build_all(os.path.join(root_dir, "recipes"), args.arch)
File "D:\a\1\s\.ci_support\build_all.py", line 192, in build_all
build_folders_rattler_build(recipes_dir, platform, arch, channel_urls)
File "D:\a\1\s\.ci_support\build_all.py", line 292, in build_folders_rattler_build
subprocess.run(args + ["--variant-config", fp.name], check=True)
conda_install_tool: pixi:
Error:
× Failed to run git command: Git clone failed for source: Cloning into '/d/
│ bld/src_cache/KataGo.git'...
│ fatal: unable to access 'https://github.com/lightvector/KataGo.git/':
│ error setting certificate file: /usr/ssl/certs/ca-bundle.crt
Important: this issue is likely c-f related, since it does not happen when building those same recipes on Windows’ runner in a simple GH action without any of the c-f infra setup (experiment not shown since it’s in a private repo).
For completeness and given the above comment, I also opened two tickets in the pixi and rattler-build repos but I doubt those are the culprit here:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 32 (30 by maintainers)
That does indeed do the trick:
I did more digging and here is a small snippet to help reproduce:
Note that using a
tagor arevis the same (error get triggered).With the latest rattler-build version (0.43.0) we have a more detailed error message:
After asking a few insights from a chatbot, it might be due to the shell used
cmd.exewhere the caret^is a special character used for escaping other special characters. Check the “Command output” from above, missing the{and}characters.One solution could be to use
git rev-parse "v1.16.0^{commit}"orgit rev-parse v1.16.0^^^{commit}at least when the shell used is not UNIX-like.That hypothesis could also explain why I don’t see the error on a vanilla GHA win-64 machine (cuz it uses bash).
This is just yet another hypothesis since I cannot reproduce the error neither test the fix without a Windows machine.
I just made the release that hopefully fixes this (0.43.1): https://github.com/conda-forge/rattler-build-feedstock/pull/164
However, according the
man git-rev-parsethe following<rev>^0 is a short-hand for <rev>^{commit}should work regardless of msys glob or noglob.So I think we’ll use that instead in rattler-build 😃
Awesome, great to hear 😃
I confirm the fix as well. Thanks @wolfv !
Yup, that did it. With
rattler-buildv0.43.1(https://github.com/conda-forge/rattler-build-feedstock/pull/164) Windows builds are passing now: https://github.com/conda-forge/rundec-feedstock/pull/8Thanks so much for all the work, @wolfv and co!
@consideRatio I think so, given that in my feedstock I’ve specified using
rattler-buildandpixi(as the install tool)which results in the feedstock’s Pixi manifest having
We’ll find out in a bit though, as it will take about 20 minutes for the build products of https://github.com/conda-forge/rattler-build-feedstock/pull/164 to sync with the CDN and then we can retrigger our builds to check.
I’ll try in bit! Thanks @isuruf
Try setting
$env:MSYS=noglobHmm there seems to be a difference between conda-forge (m2-git) and the other Git I have installed on my Windows system:
I debugged a bit here and running
git rev-parsein the CLI on Windows seems to work fine (with conda-forge git). Next thing would be to add additional error logging in rattler-build so that we can see what’s actually going on there.Nice work investigating, reporting, and cross-referencing things well @hadim - I found my way here easily thanks to it!
I ran into this exact issue failing on git rev-parse with dask/dask-gateway’s feedstock, here is a build failure in conda-forge’s CI system: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=1221415&view=logs&j=fe7faf59-69bb-5487-b8fd-a35a7bda3a51&t=55731638-dd49-5144-2129-5101b9dd1960.
The failure was triggered from working on this PR transitioning to rattler-build: https://github.com/conda-forge/dask-gateway-feedstock/pull/45