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

Semantic Release 20 can't detect git installed in Github Action Windows #2658

Closed
Belphemur opened this issue Jan 7, 2023 · 20 comments
Closed

Comments

@Belphemur
Copy link

Current behavior

Crashes complaining can't find git binary.

Relating to this dependabot PR: Belphemur/SoundSwitch#1085

Expected behavior

Find the git binary as it was the case before in the 19.0.5 version.

semantic-release version

20.0.0

CI environment

GitHub Action

Plugins used

git

semantic-release configuration

https://github.com/Belphemur/SoundSwitch/blob/dev/package.json

CI logs

Run npx semantic-release -d
[semantic-release]: Git version 2.7.1 is required. No git binary found.
TypeError: Invalid Version: undefined
at new SemVer (D:\a\SoundSwitch\SoundSwitch\node_modules\semver\classes\semver.js:19:13)
at compare (D:\a\SoundSwitch\SoundSwitch\node_modules\semver\functions\compare.js:3:3)
at lt (D:\a\SoundSwitch\SoundSwitch\node_modules\semver\functions\lt.js:2:29)
at file:///D:/a/SoundSwitch/SoundSwitch/node_modules/semantic-release/bin/semantic-release.js:29:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Process completed with exit code 1.

@webstech
Copy link
Contributor

webstech commented Jan 8, 2023

Wow. I just hit this as well.

Git for Windows may not fully follow the semver standard (I will open an issue there to ask about it) but the switch of checkers did break things.

Is this test still needed? Git 2.7.1 came out in early 2016. Existing users of this package will be past that version. New users will likely have an updated tool chain given all the attacks in the past few years. I would vote to remove the test.

EDIT:
Issue #4086 was opened (and closed) recently regarding this. It appears the semver package works and the find-versions package does not.

@Rossbro2
Copy link

Rossbro2 commented Jan 9, 2023

So what's the solution to this? My build is currently failing due to this 😞

@Belphemur
Copy link
Author

Belphemur commented Jan 9, 2023 via email

@webstech
Copy link
Contributor

webstech commented Jan 9, 2023

So what's the solution to this?

Not sure. After removing the version test, other windows errors occurred.

[9:35:47 a.m.] [semantic-release] » ℹ  Running semantic-release version 20.0.2
[9:35:47 a.m.] [semantic-release] » ✘  An error occurred while running semantic-release: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:400:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:989:11)
    at defaultResolve (node:internal/modules/esm/resolve:1069:3)
    at nextResolve (node:internal/modules/esm/loader:161:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:834:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:415:18)
    at ESMLoader.import (node:internal/modules/esm/loader:516:22)
    at importModuleDynamically (node:internal/modules/esm/translators:108:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:36:14)
    at loadPlugin (file:///C:/Users/chris/Documents/GitHub/test-smtp-server/node_modules/semantic-release/lib/plugins/utils.js:57:88) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

@travi
Copy link
Member

travi commented Jan 9, 2023

thank you for raising this and apologies for not jumping into the thread sooner

For now, I'm staying on 19.0.5

until we are able to resolve this windows specific issue, this would be our official recommendation as well. the v19 line has been stable for a while now, so continuing to use that for the time being is your best bet.

New users will likely have an updated tool chain given all the attacks in the past few years. I would vote to remove the test.

while it is true that most consumers are likely not on an old enough version to cause a problem here, we do want to keep this check in place to communicate a detectable incompatibility. we have plans to raise this minimum because it has restricted us from using some newer features of git that would be helpful in some of the tasks that semantic-release performs. we attempt to communicate an accurate minimum with this warning, so in order to use those newer features, this would be raised and would inform folks of that new minimum at that point.

So what's the solution to this?

we will get a branch started soon that adds windows to our test matrix for this core project. i'm hoping that will at least reproduce this issue in that context. assuming that is true, it could be helpful if folks would help us investigate possible solutions and open PRs against that reproduction. I will post back here once we have that reproduction available.

travi added a commit that referenced this issue Jan 9, 2023
@travi travi pinned this issue Jan 9, 2023
@travi
Copy link
Member

travi commented Jan 9, 2023

i've created the branch to add windows into the os matrix. you can find a draft PR related to it here: #2659

it does not appear to reproduce the problem with finding git (yet). i would have expected that to show up in the integration tests. however, it appears those are failing to run due to the inability to find the base image for the npm registry used in those tests. that works find on the ubuntu runner (and locally on macos), so it will need to be investigated why that step is failing on windows. i'm hopeful that resolving that will make the failure to find git reproduceable in those integration tests.

An error occurred while running semantic-release: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

this error is reproduced in the unit tests running in windows-latest. this will need to be solved as well.

if folks would like to help get this resolved more quickly, please feel free to investigate either issue and contribute PRs against the windows-git branch.

sergey-steinvil added a commit to js-data-tools/js-helpers that referenced this issue Jan 10, 2023
There is an issue with the latest semantic-release version, which does not allow running it on Windows.  See the semantic-release/semantic-release#2658 for more details.

At the moment, the recommended solution is to downgrade to v19.0.5
@stefanfrede
Copy link

It seems this is not a bug related to merely Windows because we could reproduce it now with v20.0.2 on Linux and on Mac.

@koalaty-code
Copy link

however, it appears those are failing to run due to the inability to find the base image for the npm registry used in those tests.

@travi, I believe the 404 NOT_FOUND is due to verdaccio/verdaccio:5 not supporting Windows architecture. All available tags for verdaccio only support linux/amd64 and linux/arm64.

@travi
Copy link
Member

travi commented Jan 13, 2023

I believe the 404 NOT_FOUND is due to verdaccio/verdaccio:5 not supporting Windows architecture.

thanks @koalaty-code! that makes sense why we're seeing that situation in the integration tests then. unfortunately, that will mean that we wont be able to add windows to the OS matrix with the tests in their current state (might be the reason we dont already have it in there).

without that available for reproducing this issue, it does mean that it will be more difficult for our core maintenance team to investigate this issue since we primarily work from macs and dont have windows environments easily available to us. we could really use some help from the community on solving this one.

@travi
Copy link
Member

travi commented Jan 13, 2023

It seems this is not a bug related to merely Windows because we could reproduce it now with v20.0.2 on Linux and on Mac.

@stefanfrede we have not seen any evidence to support this beyond your message. i have many packages releasing from github actions using the ubuntu-latest runner that have been working properly, even when this update was still just a pre-release.

it seems like the issue you might be seeing is likely not directly related to this issue. would you mind opening a new issue with links to reproductions or at least your logs with the debug flag enabled?

@webstech
Copy link
Contributor

@travi I have a couple of commits that address the git version and plugin load issues in my repo branch. I started from the master branch so not sure how to handle this. Should I just open a pull request that pulls all the master updates or do you want to rebase the windows-git branch first?

@webstech
Copy link
Contributor

@travi On a different note, should package.json specify running node for windows compatibility? ie:

"semantic-release": "./bin/semantic-release.js"

vs

"semantic-release": "node ./bin/semantic-release.js"

Windows does not recognize shebang (yet - ok, maybe never 🤨).

@travi
Copy link
Member

travi commented Jan 15, 2023

Should I just open a pull request that pulls all the master updates or do you want to rebase the windows-git branch first?

@webstech given that the verdaccio image is not available for windows, my hope that we could reproduce effectively in the windows-git branch arent going to pan out with the current testing setup. since thats the case, i'd say we just go ahead and target master directly with the pr to resolve this

@travi
Copy link
Member

travi commented Jan 15, 2023

On a different note, should package.json specify running node for windows compatibility?

i'm not aware of anyone reporting this as a problem before now. i'm open to talking through it, but this seems less blocking than the other bugs. is that a fair assesment? would it be worth discussing that in a new issue?

@webstech
Copy link
Contributor

i'm not aware of anyone reporting this as a problem before now.

It is not a big deal and certainly would not affect existing maintainers on this project. Only windows maintainers would see this. Running against semantic-release is not a good test anyway - just went for the fastest route to verify the changes.

@webstech
Copy link
Contributor

Status update for those interested. PR #2672 has been opened to address the initial problems. That change may resolve the issues with running on Windows.

To run the Windows tests, changes are needed to some of the test jobs and there are changes to an external package. At this point, all the test jobs are running, so patches are being prepared for the external package (changes were initially done in the node_modules tree).

@webstech
Copy link
Contributor

changes are needed to some of the test jobs

integration.test.js

  1. for some reason the test npm docker image appears to have a test-release package so a new name is needed
  2. some extra config is needed to avoid the password pop-ups for the credential manager
  3. a current docker engine on Windows needs additional configuration to publicize the ports - will see if this needs docker version tests

@travi
Copy link
Member

travi commented Jan 24, 2023

@travi travi closed this as completed Jan 24, 2023
@Rossbro2
Copy link

Confirmed this works 👍 Thank you all!

@Belphemur
Copy link
Author

Same on my side. Thanks team !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants