sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Remove HOME variable requirement to perform restore

Open schellap opened this issue 11 years ago • 15 comments

On Ubuntu CI machines, issuing dotnet restore causes errors. This is because HOME is not defined and DNX has trouble finding a place for its cache. Worst case please at least default to /tmp/{username} or use some other variable.

See also hack here: https://github.com/dotnet/cli/blob/5f5e3ad74c0c1de7071ba1309dca2ea289691163/scripts/ci_build.sh#L24

@Sridhar-MS, @piotrpMSFT, @krwq, @brthor

00:45:22 "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/bin/tools/cli/bin/dotnet" restore --packages "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/packages" --source https://www.myget.org/F/dotnet-core/ --source https://www.myget.org/F/dotnet-coreclr/ --source https://www.myget.org/F/dotnet-corefxtestdata/ --source https://www.myget.org/F/dotnet-buildtools/ --source https://www.myget.org/F/dotnet/ --source https://www.nuget.org/api/v2/ "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/src" "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00104/lib/" (TaskId:7) 00:45:22 libust[45745/45745] : warning : HOME environment variable not set. Disabling LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305) [/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/build.proj] 00:45:22 libust[45752/45752] : warning : HOME environment variable not set. Disabling LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305) [/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/build.proj] 00:45:23 Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16048 (TaskId:7) 00:45:23 (TaskId:7) 00:45:23 ---------- (TaskId:7) 00:45:23 System.ArgumentNullException: Value cannot be null. (TaskId:7) 00:45:23 Parameter name: path1 (TaskId:7) 00:45:23 at System.IO.Path.Combine(String path1, String path2) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.<>c.b__5_3() (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.FirstNonEmpty(Func1[] providers) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.GetFolderPath(SpecialFolder folder) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.GetFolderPath(DnuFolderPath folder) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.GetFolderPath(DnuFolderPath folder) (TaskId:7) 00:45:23 at NuGet.CommandLineMachineWideSettings..ctor() (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.NuGetConfig.ForSolution(String solutionDirectory, IFileSystem fileSystem) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.RestoreCommand.ReadSettings(String solutionDirectory) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.RestoreCommand.<Execute>d__68.MoveNext() (TaskId:7) 00:45:23 ---------- (TaskId:7) 00:45:23 Restore failed (TaskId:7) 00:45:23 Value cannot be null. (TaskId:7) 00:45:23 Parameter name: path1 (TaskId:7) 00:45:23 ---------- (TaskId:7) 00:45:23 System.ArgumentNullException: Value cannot be null. (TaskId:7) 00:45:23 Parameter name: path1 (TaskId:7) 00:45:23 at System.IO.Path.Combine(String path1, String path2) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.<>c.<GetFolderPath>b__5_3() (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.FirstNonEmpty(Func1[] providers) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.Environment.GetFolderPath(SpecialFolder folder) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.GetFolderPath(DnuFolderPath folder) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.DnuEnvironment.GetFolderPath(DnuFolderPath folder) (TaskId:7) 00:45:23 at NuGet.CommandLineMachineWideSettings..ctor() (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.NuGetConfig.ForSolution(String solutionDirectory, IFileSystem fileSystem) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.RestoreCommand.ReadSettings(String solutionDirectory) (TaskId:7) 00:45:23 at Microsoft.Dnx.Tooling.RestoreCommand.d__68.MoveNext() (TaskId:7) 00:45:23 ---------- (TaskId:7) 00:45:23 Restore failed (TaskId:7) 00:45:23 Value cannot be null. (TaskId:7) 00:45:23 Parameter name: path1 (TaskId:7) 00:45:23 /mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/build.proj(24,5): error MSB3073: The command ""/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/bin/tools/cli/bin/dotnet" restore --packages "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/packages" --source https://www.myget.org/F/dotnet-core/ --source https://www.myget.org/F/dotnet-coreclr/ --source https://www.myget.org/F/dotnet-corefxtestdata/ --source https://www.myget.org/F/dotnet-buildtools/ --source https://www.myget.org/F/dotnet/ --source https://www.nuget.org/api/v2/ "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/src" "/mnt/j/workspace/dotnet_corert/debug_prtest_ubuntu/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00104/lib/"" exited with code 1.

schellap avatar Nov 30 '15 23:11 schellap

@davidfowl @anurse is this addressed in NuGet already?

TheRealPiotrP avatar Dec 01 '15 08:12 TheRealPiotrP

No, this will be something we need to review. Right now, both NuGet 3 and DNX use HOME to locate their packages cache, since we found that most places have it already. Perhaps we could provide an override variable for CI processes, but the idea is that this cache should be shared between builds, even on CI machines. We could have a final fallback of using Path.GetTempPath if absolutely necessary

analogrelay avatar Dec 01 '15 17:12 analogrelay

@schellap can you drive this issue?

TheRealPiotrP avatar Dec 01 '15 21:12 TheRealPiotrP

@anurse, are you guys tracking this in NuGet? Do you have an issue for it?

schellap avatar Dec 13 '15 22:12 schellap

@davidfowl @yishaigalatzer ?

analogrelay avatar Dec 14 '15 18:12 analogrelay

We don't have an issue for it. However this does also break on some windows ci machines when you log in a service account it will try to write stuff to the windows directory.

I'm also not in 100% agreement about sharing the cache across different builds. Yes it works for the simple scenarios but not when you change feeds across builds and isolation is highly desired.

I'm not sure however what the problem with setting a home environment variable is? Is it that you need one more step for setup or is there a serious reason not to set it up at all. For that matter we also require a temp variable.

yishaigalatzer avatar Dec 14 '15 18:12 yishaigalatzer

If you really need a location set from the env, why overload HOME which has a specific meaning? Why not have NUGET_HOME or NUGET_TEMP to be set if $HOME or %TEMP% is not available by default?

About the feed namespace not part of the cache lookup is a bug, though low-pri. I'd imagine someone wouldn't upload different packages with same version/name in different feeds. Just in case, the CI had the HOME variable set to /home/dotnet-bot, this would be breaking and this won't work on my dev box if I changed the feed between two branches in my repo.

/Cc @manu-silicon or @kangaroo, it seems HOME not being explicitly set is providing isolation for multiple CI processes running on the build machines. FYI, we have some random strings appended in the CoreRT build for development package names so there is no cache hit between two parallel builds.

schellap avatar Dec 14 '15 19:12 schellap

It's not a bad idea to add NUGET_HOME or NUGET_TEMP as alternate, but we do need a default location and the default location is under the home folder at the moment.

yishaigalatzer avatar Dec 14 '15 20:12 yishaigalatzer

We also encountered this issue with MSBuild: https://github.com/Microsoft/msbuild/pull/404/files#diff-eeecaff74834007a6aaf4dbb7158a161R14

Our quick workaround was to set HOME if not set :)

cdmihai avatar Dec 16 '15 23:12 cdmihai

HOME env var is no longer necessary

TheRealPiotrP avatar May 10 '16 23:05 TheRealPiotrP

I just installed dotnetcli on a new ubuntu14 box and got the original error message so clearly HOME env var is still necessary

jchannon avatar Aug 04 '16 12:08 jchannon

Just hit this issue again, it looks like it's still needed, can we re-open this issue?

Yantrio avatar Sep 16 '16 08:09 Yantrio

Pinging @piotrpMSFT

jchannon avatar Sep 16 '16 09:09 jchannon

@piotrpMSFT same here. I still get this error

inormis avatar Nov 28 '16 14:11 inormis

Let's track this in dotnet/cli#2385 as there is more recent context there.

TheRealPiotrP avatar Dec 01 '16 03:12 TheRealPiotrP