JetBrains / teamcity-dotnet-plugin

TeamCity plugin for .NET projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is this plugin compatible w/dotnet cli 2 on Ubuntu 16.04

ormico opened this issue · comments

I'm trying to use this on Ubuntu but I cannot get it to detect the dotnet cli. I have installed the cli and it didn't detect it automaticly. I also tried setting the DOTNET_HOME but that doesn't seemt to work either. Is this plugin compatible with Ubuntu/Linux agents or just Windows agents. I'm trying to compile a asp.net core app and then package in a linux docker container. my Windows agent stopped working after a recent windows update affecting Windows 10 & nested virtualization. thought I would try running it on Ubuntu instead.

@ormico, this plugin detects .net cli by using PATH and DOTNET_HOME. Please ensure that on this specific build agent mentioned env vars are available under user which was used to start TeamCity build agent.

Actual values you could find on the %build_agent% -> Agent Parameters -> Environment Variables page.

@dtretyakov We have set DOTNET_HOME, and dotnet is in the PATH on Ubuntu 16.04, but none of the agent configuration parameters are being set by the plugin.

$ which dotnet
/usr/bin/dotnet

$ dotnet --info
.NET Command Line Tools (2.1.200)

Product Information:
 Version:            2.1.200
 Commit SHA-1 hash:  2edba8d7f1

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.200/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

We see the following error in the agent logs:

[2018-06-15 20:03:17,343]  DEBUG - tnet.DotnetPropertiesExtension - Locating .NET CLI 
[2018-06-15 20:03:17,348]   INFO - .agent.CommandLineExecutorImpl - Execute command line: /usr/share/dotnet/dotnet --version 
[2018-06-15 20:03:17,363]  DEBUG - uildServer.CommandLineExecutor - Start waiting for process finishing 
[2018-06-15 20:03:17,453]  DEBUG - uildServer.CommandLineExecutor - Process.waitFor() finished 
[2018-06-15 20:03:17,453]  DEBUG - uildServer.CommandLineExecutor - Start waiting for stdout collector thread 
[2018-06-15 20:03:17,457]  DEBUG - uildServer.CommandLineExecutor - Finished waiting for stdout collector thread 
[2018-06-15 20:03:17,457]  DEBUG - uildServer.CommandLineExecutor - Start waiting for stderr collector thread 
[2018-06-15 20:03:17,464]  DEBUG - uildServer.CommandLineExecutor - Finished waiting for stderr collector thread 
[2018-06-15 20:03:17,464]  DEBUG - uildServer.CommandLineExecutor - Stop waiting for process finishing 
[2018-06-15 20:03:17,473]  DEBUG - .agent.CommandLineExecutorImpl - Result:
Exit code: 1Stdout:
Stderr:
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
   at System.IO.Path.Combine(String path1, String path2)
   at Microsoft.DotNet.Configurer.CliFallbackFolderPathCalculator.get_DotnetUserProfileFolderPath()
   at Microsoft.DotNet.Configurer.FirstTimeUseNoticeSentinel..ctor(CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

However, this command is available and works:

$ /usr/share/dotnet/dotnet --version
2.1.200

To fix this, I added variables to the init.d script:

export HOME="/mnt/teamcity"
export DOTNET_HOME="/usr/share/dotnet"

@jeremygaither, ok, thanks for details, it was caused by https://github.com/dotnet/cli/issues/8053 and we'll try to fix this case on TeamCity .NET CLI plugin side.

I'm still unclear on whether or not this works, or what's needed to make this work. I can run all dotnet commands from the command line directly just fine, but agent detection will not show my linux agents as viable when I try to use the TC dotnet plugin
image

The agents definitely do have the correct environment variables:
image

@queen-of-code, what TeamCity and dotnet version do you use? Could you please file an issue in TeamCity tracker and privately attach teamcity-agent.log file from this build agent?

Still having this issue on RHEL 7 although both PATH and DOTNET_HOME variables are correctly set to point to the folder where the executable is located and are reported to the TC server by the agent. Any updates?

Try using TeamCity 2019.2. The dotnet plugin uses PATH and DOTNET_HOME to find dotnet executable. DOTNET_HOME has more priority. If you still have any issues around it could you please share a file like teamcity-agent.log from an TeamCity agent machine after agent restart and a build log after any failed build to my e-mail. I will try to fix it in TeamCity 2019.2.1