TFS with OctoDeploy: deployment Octopus Exited with code - -1 - octopus-deploy

I have intermittent build failure in TFS
How do you solve Octopus Exited with code - 1
Exception Message: Octopus Exited with code - -1 (type Exception)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

WorkAround
Only work around is to monitor the build and trigger deploy again and the issue will go away.
So far I have no other solution
Common answer I have found
Thanks for getting in touch! Very rarely we get ghost processes.
To reset them on your tentacle please do the following:
> cd \Program Files\Octopus Deploy\Tentacle
>
> tentacle.exe service --stop tentacle.exe reset-activities tentacle.exe
> service --start
That is however not very neat solution and does not remove the cause as far I can tell.

Related

Visual Studio Publish throws "MSB4018 The "ResolvePackageDependencies" task failed unexpectedly."

I have a project that I used to deploy as a single executable, but I am no longer able to as the Publish process throws while trying to resolve the nugest. The project builds fine during the publish process and it also runs fine from visual studio.
My publish results:
========== Build: 7 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I get a popup with this error:
08/12/2021 21:35:26
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
And in the Error view I get this:
Severity Code Description Project File Line Suppression State
Error MSB4018 The "ResolvePackageDependencies" task failed unexpectedly.
System.ArgumentException: Invalid framework version '3.1/win-x64'.
at NuGet.Frameworks.NuGetFramework.ParseFrameworkNameParts(IFrameworkNameProvider mappings, String[] parts, String& framework, Version& version, String& profile)
at NuGet.Frameworks.NuGetFramework.ParseFrameworkName(String frameworkName, IFrameworkNameProvider mappings)
at NuGet.Frameworks.NuGetFramework.Parse(String folderName, IFrameworkNameProvider mappings)
at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.<GetPackageAndFileDefinitions>b__48_5(String tg)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.Contains[TSource](IEnumerable`1 source, TSource value, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.Contains[TSource](IEnumerable`1 source, TSource value)
at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.<>c__DisplayClass48_1.<GetPackageAndFileDefinitions>b__3(IAssetsLogMessage log)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.<GetPackageAndFileDefinitions>g__GetPackageDiagnosticLevel|48_0(LockFileLibrary package)
at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.GetPackageAndFileDefinitions()
at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() TextureEditor C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 195
This is the configuration I am trying to build with:
If interested, the project can be found here: https://github.com/olekristianhomelien/TheAssetEditor
Any ideas what is going wrong?

TFS2015 Test Agent Aborted - PowerShell script completed with errors

I am running a TFS nightly build that for the last few days has not been able to complete all its tests. It fails after several hours with a "Test run is aborted" message. Previous to this the tests always ran successfully, and no major changes(or even minor) have been made to the system that runs these tests.
Information:
Two MStest runs in the build(unit tests)
Timeout is set to 20 hours
Runs for approx. 15 hours before failure
Tests are set to continue on failure
When I look in the TFS log for the latest run it lists the following(2017-04-11T06:42:47.5500707Z):
[warning]DistributedTests: Test run is aborted. Logging details of the run logs.
[warning]DistributedTests: New test run created.
[warning]Test Run queued for Project Collection Build Service
[warning]DistributedTests: Test discovery started.
[warning]DistributedTests: Test Run Discovery Completed . Test run id: 533
[warning]DistributedTests: 290 test cases discovered.
[warning]DistributedTests: Test execution started. Test run id : 533
[warning]DistributedTests: Test run timed out. Test run id : 533
[warning]DistributedTests: Test run aborted. Test run id: 533
[error]The test run was aborted, failing the task.
When I look at the run log(worker_20170410-234426-utc_864.log) I see:
06:42:47.659516 BaseLogger.LogConsoleMessage(scope.JobId =
7ced7f31-e360-47f3-b334-ef20faeaf000, message = ##[error]The test run
was aborted, failing the task.) 06:42:47.659516
Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException:
PowerShell script completed with errors. at
Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext
context, CancellationToken cancellationToken) at
Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext
context, TaskWrapper task, CancellationTokenSource tokenSource)
In the test log, I don't see any errors in the VS, just a warning about not able to connect(I see these often):
W, 2060, 5, 2017/04/10, 16:26:03.595, XXXTESTING\QTController.exe,
Test of LoadTestResultConnectString failed: A network-related or
instance-specific error occurred while establishing a connection to
SQL Server. The server was not found or was not accessible. Verify
that the instance name is correct and that SQL Server is configured to
allow remote connections. (provider: SQL Network Interfaces, error: 26
- Error Locating Server/Instance Specified)
I also see an error thrown in the Application Event log at the same time:
The description for Event ID 0 from source Application cannot be
found. Either the component that raises this event is not installed on
your local computer or the installation is corrupted. You can install
or repair the component on the local computer.
If the event originated on another computer, the display information
had to be saved with the event.
The following information was included with the event:
Error Handler Exception: System.ServiceModel.CommunicationException:
There was an error reading from the pipe: The pipe has been ended.
(109, 0x6d). ---> System.IO.IOException: The read operation failed,
see inner exception. ---> System.ServiceModel.CommunicationException:
There was an error reading from the pipe: The pipe has been ended.
(109, 0x6d). ---> System.IO.PipeException: There was an error reading
from the pipe: The pipe has been ended. (109, 0x6d).....
the message resource is present but the message is not found in the
string/message table
The issue is that I really don't know how to interpret these messages, each log just says "test run was aborted, failing the task", I'm not even certain the powershell issue is what caused it. I'm also not sure that the error thrown in the application log is related, though it was thrown at exactly the same time that the run failed.
It's also difficult to research this issue, when you really don't know what's causing the test agent to fail. There are posts related to VS, and to the TFS Test Agent, but these don't strike me as related issues, and of course there is this somewhat unhelpful post about the Powershell message.
Has anyone seen this sort of issue before? I don't think anything on my build server has changed over the last few days(maybe updates...), what do you think would cause an issue like this to occur?
If you look at the failed build(containing tests) after it is aborted in the "Build" section of TFS, its says it was "Aborted", that's it... If you look at results of the build(containing tests) in the "Test" section of TFS it specified that the test run "Exceeded Timeout".
Apparently MSTest was running up against the default value of this little gem. I think it defaults to 8 hours when not specified, but I'm not too sure about this. Anyways I set the following setting in my "Default.testsettings" file:
<?xml version="1.0" encoding="utf-8"?>
<TestSettings name="TestSettings1">
<Execution>
<Timeouts runTimeout="200000000" />
</Execution>
</TestSettings>
Seems to resolve the issue. Tests runs successfully and no longer time out.

TFS Error Publishing Log Files to non existent directory

My Build Server has been running just fine for a couple months and then this week we started getting this problem (see below).
It's almost certainly a permission problem, but no one in IT will admit to having changed a permission somewhere.
Also, it's trying to publish a log file to a location that doesn't exist!
to '#/416/logs/msbuild/agent-2'
If I knew where this location was, I would happily fix it or turn this specific publish off. All the other logs are present and accessible (obviously I'm able to view the log of these errors).
using Visual Studio 2013 & TFS2013.
This is the same issue, but changing the drop folders didn't fix it:
TFS Error publishing log files to #/198/logs/msbuild/agent-2
Other Errors and Warnings
3 error(s), 0 warning(s)
Exception Message: TF270016: An error occurred publishing log files from
'C:\Builds\2\AppName\AppName\src\AppName\AppName.log'
to '#/416/logs/msbuild/agent-2'. Details: An error occurred while
sending the request. (type PublishLogFileException) Exception Stack
Trace: at
System.Activities.Statements.Throw.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
Inner Exception Details:
Exception Message: An error occurred while sending the request. (type
HttpRequestException) Exception Stack Trace: at
Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String
sourceDirectory, String targetDirectory) at
Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String
sourceDirectory, String targetDirectory, String[] renameIfExists)
at
Microsoft.TeamFoundation.Build.Workflow.Activities.PublishLogFile.Execute(CodeActivityContext
context)
Inner Exception Details:
Exception Message: Unable to connect to the remote server (type
WebException)Exception Stack Trace: at
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult
ar)
Inner Exception Details:
Exception Message: No connection could be made because the target
machine actively refused it [::1]:8080 (type SocketException)
Exception Stack Trace: at
System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState state, IAsyncResult asyncResult, Exception&
exception)
An error occurred while copying diagnostic activity logs
to the drop location. Details: An error occurred while sending the
request.
An error occurred while copying diagnostic activity logs to
the drop location. Details: An error occurred while sending the
request.
Update 12/29/2015
I've been able to confirm with IT that our main TFS instance was updated to 2013 Update 5.
Our build server is running TFS 2013 Update 4. My next priority will be getting the build server updated.
You can try to create a new build agent to see whether the issue persists.
The issue had nothing to do with TFS.
On the build server machine, we had a copy of Visual Studio installed (necessary for MSBuild and MSTest). The license we used had expired, and as a result Visual Studio installed in trial mode.
I don't know why this mattered, but reinstalling Visual Studio using a valid license fixed the issue.

Release management server succeeds manual, but fails automated

I'm trying to configure release management server to deploy to out test server when a specific build configuration on TFS succeeds. Now I have a build definition which runs fine, I use the build process template 'ReleaseTfvcTemplate.12.xaml'.
The 'Release Template' in Release Management Server (RMS) is set to trigger on build.
Now when I set the 'Release Build' property in the Release category to 'False', the build runs fine. Then when I go the Release Management Client and create a release, everything goes fine and my project (a WebAPI) is succesfully published to our testserver.
As soon as I set the 'Release build' property to true (in the build definition) and queue a new build, the build fails.
I receive the following error :
Exception Message: The directory name is invalid (type Win32Exception)
Exception Stack Trace: Server stack trace: at
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo) at
Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.ProcessWrapper.Start()
at
Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.InvokeProcessInternal.RunCommand(AsyncState
state) at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Object[]& outArgs) at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage
msg, IMessageSink replySink)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase) at
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData) at System.Func2.EndInvoke(IAsyncResult
result) at
System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor
executor, BookmarkManager bookmarkManager)
The build template includes a xcopy step which may cause the "The directory name is invalid", but I don't understand why the process works manually, but not automated.
Any suggestions in the right direction are very welcome!
Make sure you have a RM Client install on the build agent machine.
Sometimes the release template can 'lose' its connection in to the build definition. To check this open the release template and use the Properties link to re-establish the connection to the build definition. In case it helps I have a soup to nuts blog post series on configuring all this - index page here.

TFS Error publishing log files to #/198/logs/msbuild/agent-2

I installed TFS 2013 and am having a problem with the build system. I don't use a drop folder, one solution being built, pretty simple config. I am getting the following error which fails the build (some names replaced with AppName to protect the app's identity):
Exception Message: TF270016: An error occurred publishing log files from 'S:\Builds\2\NCSoftware\AppName\src\Solutions\AppName\AppName.log' to '#/198/logs/msbuild/agent-2'. Details: Internal Server Error (type PublishLogFileException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Inner Exception Details: Exception Message: Internal Server Error (type VssServiceResponseException) Exception Stack Trace: at Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String sourceDirectory, String targetDirectory) at Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String sourceDirectory, String targetDirectory, String[] renameIfExists) at Microsoft.TeamFoundation.Build.Workflow.Activities.PublishLogFile.Execute(CodeActivityContext context)
An error occurred while copying diagnostic activity logs to the drop location. Details: Internal Server Error
An error occurred while copying diagnostic activity logs to the drop location. Details: Internal Server Error
Where is this "#/198/logs/msbuild/agent-2" path that obviously is the cause of this problem?
Thank you.
Check your DropLocation variable in your build template.
Simplest way to find where this path is set is to look into your build template and search for e.g. "log".
In my case I found only one Activity that assigning logs path to variable. Then you can backtrack all variables in your template to original sources of data.
Something like this:
<Assign x:TypeArguments="x:String"
DisplayName="Initialize LogFile Drop Location" To="[logFileDropLocation]"
Value="[If (platformConfiguration.IsEmpty
Or BuildSettings.PlatformConfigurations.Count = 1,
BuildDropProvider.CombinePaths(DropLocation, "logs"), If
(platformConfiguration.IsPlatformEmptyOrAnyCpu,
BuildDropProvider.CombinePaths(DropLocation, "logs",
platformConfiguration.Configuration),
BuildDropProvider.CombinePaths(DropLocation,
"logs", platformConfiguration.Platform,
platformConfiguration.Configuration)))]"
mtbwt:BuildTrackingParticipant.Importance="Low" />

Resources