Closed chrisd8088 closed 2 years ago
A few further notes:
The actual build problem appears to stem not from the ronn
gem itself but from Ruby's own build tooling, and specifically occurs when building one of ronn's dependencies, the RDiscount Markdown processor gem (https://github.com/davidfstr/rdiscount).
We don't actually build or test any Ruby code of our own for the Git LFS project; it's all written in Go. But we do convert our manual pages from Markdown to roff and HTML formats using the ronn
tool. So we only need to install that Ruby gem (and its dependencies), so we can then run ronn
to do the file conversions.
We have experimented with first running the ruby/setup-ruby@v1
action, as recommended, but while this does permit the gem install
to succeed, it unfortunately installs a number of other tools like MSYS2 and alters the PATH
such that a considerable number of our CI tests fail.
shell: bash
don't run C:\Program Files\Git\bin\bash.EXE
but C:\msys64\usr\bin\bash.EXE
instead, with an environment that looks like:
env:
MSYS2_PATH_TYPE: inherit
Path: C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS\;C:\tools\zstd;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.7.3\x64;C:\cabal\bin;C:\\ghcup\bin;C:\tools\ghc-9.2.1\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.1.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\hostedtoolcache\windows\go\1.16.13\x64\bin;C:\hostedtoolcache\windows\Python\3.9.10\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.10\x64;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.322-6\x64\bin;C:\npm\prefix;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Docker;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\LLVM\bin;C:\Program Files\OpenSSL\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.4\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\SeleniumWebDrivers\ChromeDriver\;C:\SeleniumWebDrivers\EdgeDriver\;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps
PATH
changes the Git which is found and run by default is C:\Program Files\Git\bin\git.exe
instead of C:\Program Files\Git\mingw64\bin\git.exe
. That might be OK for us, as they may even be the same binary.git-lfs.exe
binary which our CI jobs compile. Our CI suite prepends the location of the compiled git-lfs.exe
binary to the PATH
environment variable, and then runs git lfs
, which should invoke the default Git binary, which then looks for a git-lfs
binary in the PATH
locations and executes it. That's how Git looks up all of its own individual programs, such as git-commit
, git-merge
, etc. This all works normally on other platforms (Linux, macOS) and on Windows Server 2019 runners.ruby/setup-ruby@v1
action, when Git looks through the set of PATH
locations, it appears to get only the PATH
as defined above, not as it has been adjusted by our CI scripts. This may be due to the way MSYS2 can reset PATH
. Supposedly this behaviour is changed by setting MSYS2_PATH_TYPE
to inherit
, but that may not be taking effect (see, for instance, msys2/MSYS2-packages#2140). The consequence is that the default Git LFS binary is run, not the one compiled by our CI job, so of course the test suite then fails.ruby/setup-ruby@v1
and deal with the problem of gem install ronn
failing that way.We don't particularly care if we need to run ruby/setup-ruby@v1
or not to get get install ronn
to run to completion, but we do need a working environment afterwards and not one which overwrites PATH
in a way that can't be undone by the usual ability to prepend paths, i.e., PATH=/new/path:$PATH
. That breaks all kinds of assumptions throughout our test suite.
Hello @chrisd8088 , We will take a look at it.
Thanks, @al-cheb! I've added another few notes in the comment above; in particular, I wrote up the problems with ruby/setup-ruby@v1
and Bash and PATH
in ruby/setup-ruby#293, and created some small workflows to demonstrate that problem.
If that were fixed first, we could work around this issue by running ruby/setup-ruby@v1
, which then allows gem install ronn
to succeed. But for the moment that workaround is not possible for us, due to the problems with PATH
, so if there's a more direct way to get gem install ronn
to work just with the system default Ruby installation, that would be awesome.
Thanks very much for taking a look at this; it's much appreciated! ❤️
@chrisd8088 hello!
the failure happens just because we are having different versions of ruby be default on win19 and win22 (2.5 and 3.0 respectively). setup-ruby
indeed helps mitigating this, but given that you can't use it at the moment the most suitable workarond for you would be changing the default $PATH
value and put there a ruby version you wish, say, by executing the same function as we do in your pipeline's runtime.
Thanks for the advice and info, @mikhailkoliada! That's helped us formulate an alternative approach; I suspect we will stop using ronn altogether and replace it with either Pandoc or Asciidoctor. It'll be a bit more work on our end but as ronn appears to be unmaintained at this point, I think this is probably the right direction. Thanks again!
Description
In our Windows CI build job for the Git LFS project, we have a step which installs the
ronn
Ruby gem (https://github.com/rtomayko/ronn) withgem install ronn
. This succeeds on a Windows Server 2019 Actions runner, but fails on a Windows Server 2022 runner, due to a what seems to be a C library or header problem. The specific failure is outlined in the "Actual behavior" section below.Virtual environments affected
Image version and build link
Environment: windows-2022 Version: 20220207.1 Failed build: https://github.com/chrisd8088/git-lfs/runs/5236350328?check_suite_focus=true
Is it regression?
This is a regression from Windows Server 2019.
Environment: windows-2019 Version: 20220131.1 Successful build: https://github.com/chrisd8088/git-lfs/runs/5236480511?check_suite_focus=true
Expected behavior
We expect the Ruby gem to install cleanly and successfully, as it does with Windows Server 2019:
Actual behavior
The build failure output is as follows; it appears that the key issue may be a failure to build a small C test program used to check the system configuration during the build process. The result is perhaps a failure to run the test program and check its return value.
Repro steps
An Actions workflow which runs
gem install ronn
on a Windows Server 2022 runner, e.g.:Note that the same workflow but with
runs-on: windows-2019
succeeds.Also note that while our legacy CI job for the Git LFS project first runs the now-deprecated
actions/setup-ruby@v1
action, the problem can be seen without that step, as per the reproduction workflow script above.