Skip to content

SH doesn't correctly grab global.json sdk version #7

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

Closed
jbobo opened this issue Apr 9, 2020 · 13 comments
Closed

SH doesn't correctly grab global.json sdk version #7

jbobo opened this issue Apr 9, 2020 · 13 comments
Assignees
Labels
bug Something isn't working maintenance-mode-prerequisite Maintenance mode prerequisites triaged

Comments

@jbobo
Copy link

jbobo commented Apr 9, 2020

https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh when run as bash ./dotnet-install.sh --jsonfile ./global.json grabs everything in sdk after version instead of only grabbing the sdk.version value.

Example of global.json:

{
  "sdk": {
    "version": "3.1",
    "allowPrerelease": false,
    "rollForward": "latestPatch"
  }
}

error:

dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1allowPrerelease:falserollForward:latestPatch/dotnet-sdk-3.1allowPrerelease:falserollForward:latestPatch-linux-x64.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1allowPrerelease:falserollForward:latestPatch/dotnet-sdk-3.1allowPrerelease:falserollForward:latestPatch-linux-x64.tar.gz
dotnet-install: Downloading legacy link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1allowPrerelease:falserollForward:latestPatch/dotnet-dev-centos-x64.3.1allowPrerelease:falserollForward:latestPatch.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1allowPrerelease:falserollForward:latestPatch/dotnet-dev-centos-x64.3.1allowPrerelease:falserollForward:latestPatch.tar.gz
dotnet_install: Error: Could not find/download: `.NET Core SDK` with version = 3.1allowPrerelease:falserollForward:latestPatch
dotnet_install: Error: Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@tdykstra
Copy link

@wli3 who can help with this?

@wli3 wli3 transferred this issue from dotnet/docs Apr 10, 2020
@wli3
Copy link

wli3 commented Apr 10, 2020

@donJoseLuis

Although I don't think this is a high priory issue. Considering we want to move majority of the logic out of the bash script (to some programming language more maintainable). Once we have that, we can share logic with SDK resolver for this logic

@marcpopMSFT marcpopMSFT self-assigned this Apr 16, 2020
@bekir-ozturk
Copy link
Contributor

We haven't been able to fix the issues with failing builds yet, so we don't have the availability to work on this issue now. Please track the progress of the current issue we are working here: dotnet/sdk#11320

@bekir-ozturk bekir-ozturk transferred this issue from dotnet/sdk May 19, 2020
@donJoseLuis donJoseLuis added the bug Something isn't working label May 28, 2020
@donJoseLuis donJoseLuis changed the title dotnet-install.sh doesn't correctly grab global.json sdk version SH doesn't correctly grab global.json sdk version May 28, 2020
@kondratyev-nv
Copy link
Contributor

It looks like the issue can be fixed by removing the line https://github.com/dotnet/install-scripts/blob/master/src/dotnet-install.sh#L471

sdk_list="$(echo -e "${sdk_list}" | tr -d '[[:space:]]')"

On macOS, echo does not have a -e argument, so all lines of key-value pairs in sdk_list are merged into a single line. Removing it seems to fix it.

I've already created a PR in sdk repo - dotnet/sdk#12339, as I thought that was the right place to fix it. All tests are passed and I've added more tests to reproduce the issue there.

I can create a similar PR in the install-scripts repo. However, ./build.sh from the root of the repo throws and error, and I don't see tests (as in https://github.com/dotnet/sdk/blob/master/src/Tests/InstallationScript.Tests/GivenThatIWantToInstallTheSdkFromAScript.cs) to make sure that changes are working. If anyone can suggest a way to build this repo and test the changes I would be happy to open a PR.

@AR-May
Copy link
Member

AR-May commented Oct 23, 2020

Hello @kondratyev-nv!

I agree, it seems the problem is in this line. Your PR from SDK repo should solve it. Could you please make a similar PR to this repo?

The GivenThatIWantToInstallTheSdkFromAScript.cs file was added: see
https://github.com/dotnet/install-scripts/blob/master/tests/Install-Scripts.Test/GivenThatIWantToInstallTheSdkFromAScript.cs.
The easiest way to test the changes as for now, however, is to run automatic tests on the PR. I'd recommend commit and make a PR with the tests, see that they failed, then commit also the bug fix and see the tests pass.

@kondratyev-nv
Copy link
Contributor

@AR-May Hi! Sure, I'll create one here 🙂

@AR-May
Copy link
Member

AR-May commented Oct 27, 2020

@kondratyev-nv Thank you!

@AR-May AR-May closed this as completed Oct 30, 2020
@RehanSaeed
Copy link

Has the fix for this been released?

@RehanSaeed
Copy link

When I try the latest script I get the following failure when running on Ubuntu:

Build started
git clone -q --branch=use-latest-major-dotnet-sdk https://github.com/RehanSaeed/Schema.NET.git /home/appveyor/projects/schema-net
git checkout -qf 0f930f0479cf250ee953515547558ef336a6fc86
Running "build_script" scripts
if ($isWindows) {
  Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
  ./dotnet-install.ps1 -JSonFile global.json -InstallDir 'C:\Program Files\dotnet'
}
else {
  Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
  sudo chmod u+x dotnet-install.sh
  if ($isMacOS) {
    sudo ./dotnet-install.sh --jsonfile global.json --install-dir '/Users/appveyor/.dotnet'
  } else {
    sudo ./dotnet-install.sh --jsonfile global.json --install-dir '/usr/share/dotnet'
  }
}
dotnet_install: Error: Unable to find the SDK:version node in `global.json`�(B
Command exited with code 1
Build failed

You can see the build on AppVeyor here.

@bekir-ozturk
Copy link
Contributor

Hi @RehanSaeed ,

The change is merged to master, but we haven't deployed it to dot.net website yet. We, unfortunately, don't deploy that frequently unless there is a serious blocking issue, because deploying is a manual process.

I will get this deployed soon. As a workaround, you can download the scripts using the GitHub link https://raw.githubusercontent.com/dotnet/install-scripts/master/src/dotnet-install.ps1 instead of https://dot.net/v1/dotnet-install.ps1 .

@RehanSaeed
Copy link

Thanks @bozturkMSFT. So you don't ship with .NET 5, it's just ad-hoc right? In that case, is there a way to know when it's released? Or can you keep us posted about when it goes out?

@bekir-ozturk
Copy link
Contributor

Hi @RehanSaeed . No, we don't follow .NET shipping schedule. I have created a PR here https://github.com/dotnet/website/pull/2418 . It usually takes 1 day to a week to get it released after that. There is, unfortunately, no way of knowing unless you check the internal release build. I will notify you here once it is available on the website.

@AR-May AR-May added the maintenance-mode-prerequisite Maintenance mode prerequisites label Nov 6, 2020
@bekir-ozturk
Copy link
Contributor

Hi @RehanSaeed ,
Changes are now available at https://dot.net/v1/dotnet-install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maintenance-mode-prerequisite Maintenance mode prerequisites triaged
Projects
None yet
Development

No branches or pull requests

9 participants