Open Satheesh-Balachandran opened 4 years ago
Specifically the restore command would be very useful here but full support for Nuget would be fantastic.
@Satheesh-Balachandran, @clardiz
Bamboo Artifactory plugin 3.2.0 is released. In this version we added new NuGet
and .NET
tasks.
The new tasks include either restore and push command.
@clardiz - we'd appreciate your feedback for the NuGet restore.
Please read the Bamboo version compatibility matrix, before upgrading to version 3.2.o of tbe plugin.
Can you point us to some documentation around the Artifactory Nuget and .NET tasks? The existing documentation doesn't seem to talk about it at all
@jigar61, The Bamboo Artifactory Plugin documentation does not currently go into detail describing each of the Artifactory task types. After upgrading to the latest Artifactory Plugin version, you'll see that the Artifactory NuGet and Artifactory. NET Core task types become available when adding a new task. The embedded Bamboo help includes description for each of the tasks fields. Please share with us any feedback you may have for the new tasks. As previously mentioned, please read the Bamboo version compatibility matrix included in the Bamboo Artifactory Plugin documentation, before upgrading to version 3.2.o of tbe plugin.
Is there a different task to support .NET Framework projects? Currently there seems to be only a .NET core task to resolve dependencies for.
@jigar61 The latest plugin version contains tasks for building with .Net Core and NuGet. To better understand what you have missing, can you please elaborate some more:
@Satheesh-Balachandran, @clardiz Bamboo Artifactory plugin 3.2.0 is released. In this version we added new
NuGet
and.NET
tasks. The new tasks include either restore and push command.@clardiz - we'd appreciate your feedback for the NuGet restore.
@Satheesh-Balachandran - We are looking into it now
While trying out the Artifactory .NET task to restore a .NET Core project, we see this error while running the build in Bamboo. 2020-11-18 11:37:58,382 ERROR [TaskExecutorImpl] Error occurred while running Task 'test restore(8)' of type org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryDotNetCoreTask. java.lang.RuntimeException: java.io.IOException: dotnet nuget add source failed: The system cannot find the file specified. . Please make sure .NET Core 3.1.200 SDK or above is installed.
The .NET Core version on the bamboo agent is 3.1.301.
@jigar61, Thanks for reporting this issue!
The error you're getting says "The system cannot find the file specified". I suspect that this means that the dotnet executable is not included in the build agent's PATH. Can you please try adding it to the path and let us know if this resolves the issue? This information should have been included as part of the online documentation. We're adding this to the documentation as we speak. I'll soon share the link here.
As an additional reference, the exception is thrown from the addSource
method in the DotnetDriver
class:
public String addSource(String configPath, ArtifactoryDependenciesClient client, String repo, String sourceName, String username, String password) throws IOException {
try {
String sourceUrl = buildNugetSourceUrl(client, repo);
List<String> extraArgs = new ArrayList<>();
extraArgs.addAll(Arrays.asList(FLAG_PREFIX + CONFIG_FILE_FLAG, configPath, FLAG_PREFIX + NAME_FLAG, sourceName, FLAG_PREFIX + USERNAME_FLAG, username, FLAG_PREFIX + PASSWORD_FLAG, password, CLEAR_TEXT_PASSWORD_FLAG));
return runCommand(new String[]{"nuget", "add", "source", sourceUrl}, extraArgs);
} catch (Exception e) {
throw new IOException("dotnet nuget add source failed: " + e.getMessage() + ". Please make sure .NET Core 3.1.200 SDK or above is installed.", e);
}
}
I believe the runCommand
fails when it tries to run dotnet nuget add source...
Looking forward to your feedback.
Dotnet exe is already included in the PATH variable of the server. Other tasks that run dotnet in the same build plan are running fine. Only the artifactory task is showing this error.
On Sun, Nov 22, 2020, 7:06 AM Eyal Ben Moshe notifications@github.com wrote:
@jigar61 https://github.com/jigar61, Thanks for reporting this issue!
The error you're getting says "The system cannot find the file specified". I suspect that this means that the dotnet executable is not included in the build agent's PATH. Can you please try adding it to the path and let us know if this resolves the issue? This information should have been included as part of the online documentation. We're adding this to the documentation as we speak. I'll soon share the link here.
As an additional reference, the exception is thrown from the addSource method in the DotnetDriver class:
public String addSource(String configPath, ArtifactoryDependenciesClient client, String repo, String sourceName, String username, String password) throws IOException { try { String sourceUrl = buildNugetSourceUrl(client, repo); List<String> extraArgs = new ArrayList<>(); extraArgs.addAll(Arrays.asList(FLAG_PREFIX + CONFIG_FILE_FLAG, configPath, FLAG_PREFIX + NAME_FLAG, sourceName, FLAG_PREFIX + USERNAME_FLAG, username, FLAG_PREFIX + PASSWORD_FLAG, password, CLEAR_TEXT_PASSWORD_FLAG)); return runCommand(new String[]{"nuget", "add", "source", sourceUrl}, extraArgs); } catch (Exception e) { throw new IOException("dotnet nuget add source failed: " + e.getMessage() + ". Please make sure .NET Core 3.1.200 SDK or above is installed.", e); } }
I believe the runCommand fails when it tries to run dotnet nuget add source...
Looking forward to your feedback.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jfrog/bamboo-artifactory-plugin/issues/112#issuecomment-731761933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOARKIEGMGKRUQ76YQMQ6BDSRESH3ANCNFSM4MG7V2VA .
@jigar61, Can you please share the entire stacktrace from the log, so that we see where this cause of this IOException?
@jigar61 - We documented the installation and compatibility details of the nuget and dotnet clients here. If you're able to share the full stacktrace of the exception you get, this will help us pinpoint the root cause of the issue.
Here's the stacktrace. Error occurred while running Task 'test restore(8)' of type org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryDotNetCoreTask. java.lang.RuntimeException: java.io.IOException: dotnet nuget add source failed: The system cannot find the file specified. . Please make sure .NET Core 3.1.200 SDK or above is installed. at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:170) at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.executeRestore(ArtifactoryDotNetTaskBase.java:113) at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.runTask(ArtifactoryDotNetTaskBase.java:74) at org.jfrog.bamboo.task.ArtifactoryTaskType.execute(ArtifactoryTaskType.java:46) at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$2(TaskExecutorImpl.java:321) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:321) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: dotnet nuget add source failed: The system cannot find the file specified. . Please make sure .NET Core 3.1.200 SDK or above is installed. at org.jfrog.build.extractor.nuget.drivers.DotnetDriver.addSource(DotnetDriver.java:30) at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareConfig(NugetRun.java:199) at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareAndRunCmd(NugetRun.java:178) at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:160) ... 19 more Caused by: java.io.IOException: The system cannot find the file specified.
at org.jfrog.build.extractor.nuget.drivers.ToolchainDriverBase.runCommand(ToolchainDriverBase.java:92)
at org.jfrog.build.extractor.nuget.drivers.ToolchainDriverBase.runCommand(ToolchainDriverBase.java:85)
at org.jfrog.build.extractor.nuget.drivers.DotnetDriver.addSource(DotnetDriver.java:28)
... 22 more
@jigar61 - I'm a bit puzzled by this issue.
To get a better understanding for why the dotnet executable is not found on the agent, I made a change to the code, which adds a log message, with the exact command executed by the Bamboo Plugin. This code change adds a log message starting with "Executing command:" before the donet command executes. The new code is included in this pull request - https://github.com/jfrog/build-info/pull/420 on the build-info project, used by the Bamboo Artifactory Plugin. This pull request was merged to use the new build-info code - https://github.com/jfrog/bamboo-artifactory-plugin/pull/131 You can download a snapshot version with the new log print using the below link: https://oss.jfrog.org/artifactory/oss-snapshot-local/org/jfrog/bamboo/bamboo-artifactory-plugin/3.2.x-SNAPSHOT/bamboo-artifactory-plugin-3.2.x-20201206.124705-3.jar
Hopefully this will shed some light on the issue. Looking forward to your feedback.
We have the issue that the nuget executable cannot be found as well - we have version 3.2.2 installed. The executable is in the path of the remote build agent and a capability is defined as well. Running nuget from a script task has no problem.
29-Sep-2021 11:21:43 | nuget sources add failed: 'nuget' is not recognized as an internal or external command, |
---|---|
01-Jan-1970 01:00:00 | operable program or batch file. |
29-Sep-2021 11:21:43 | java.io.IOException: nuget sources add failed: 'nuget' is not recognized as an internal or external command, |
29-Sep-2021 11:21:43 | operable program or batch file. |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.NugetDriver.addSource(NugetDriver.java:29) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareConfig(NugetRun.java:199) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareAndRunCmd(NugetRun.java:178) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:160) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.executeRestore(ArtifactoryDotNetTaskBase.java:113) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.runTask(ArtifactoryDotNetTaskBase.java:74) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryTaskType.execute(ArtifactoryTaskType.java:46) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$2(TaskExecutorImpl.java:321) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:321) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:137) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:130) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) |
29-Sep-2021 11:21:43 | at java.lang.Thread.run(Thread.java:748) |
29-Sep-2021 11:21:43 | Caused by: java.io.IOException: 'nuget' is not recognized as an internal or external command, |
29-Sep-2021 11:21:43 | operable program or batch file. |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.ToolchainDriverBase.runCommand(ToolchainDriverBase.java:99) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.NugetDriver.addSource(NugetDriver.java:27) |
29-Sep-2021 11:21:43 | ... 22 more |
29-Sep-2021 11:21:43 | Error occurred while running Task 'test nuget(2)' of type org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryNugetTask. |
29-Sep-2021 11:21:43 | java.lang.RuntimeException: java.io.IOException: nuget sources add failed: 'nuget' is not recognized as an internal or external command, |
29-Sep-2021 11:21:43 | operable program or batch file. |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:170) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.executeRestore(ArtifactoryDotNetTaskBase.java:113) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryDotNetTaskBase.runTask(ArtifactoryDotNetTaskBase.java:74) |
29-Sep-2021 11:21:43 | at org.jfrog.bamboo.task.ArtifactoryTaskType.execute(ArtifactoryTaskType.java:46) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$2(TaskExecutorImpl.java:321) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:258) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:321) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:190) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:162) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:137) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:118) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:130) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:110) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) |
29-Sep-2021 11:21:43 | at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) |
29-Sep-2021 11:21:43 | at java.lang.Thread.run(Thread.java:748) |
29-Sep-2021 11:21:43 | Caused by: java.io.IOException: nuget sources add failed: 'nuget' is not recognized as an internal or external command, |
29-Sep-2021 11:21:43 | operable program or batch file. |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.NugetDriver.addSource(NugetDriver.java:29) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareConfig(NugetRun.java:199) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.prepareAndRunCmd(NugetRun.java:178) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.extractor.NugetRun.execute(NugetRun.java:160) |
29-Sep-2021 11:21:43 | ... 19 more |
29-Sep-2021 11:21:43 | Caused by: java.io.IOException: 'nuget' is not recognized as an internal or external command, |
29-Sep-2021 11:21:43 | operable program or batch file. |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.ToolchainDriverBase.runCommand(ToolchainDriverBase.java:99) |
29-Sep-2021 11:21:43 | at org.jfrog.build.extractor.nuget.drivers.NugetDriver.addSource(NugetDriver.java:27) |
29-Sep-2021 11:21:43 | ... 22 more |
Currently there is no support for Nuget package type in bamboo artifactory plugin. So artifactory cannot record the build info for MsBuild.