deploying webjobs through CI-CD pipeline - azure-devops

I have a continuous webJob and am running it through CI-CD pipeline. After successful release webjob is showing as restart pending. Getting an error in the logs
D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el>dotnet
MiddleCompassServer.exe
A fatal error was encountered. The library 'hostpolicy.dll' required
to execute the application was not found in
'D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el\'.
Failed to run as a self-contained app. If this should be a
framework-dependent app, add the
D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el\MiddleCompassServer.runtimeconfig.json
file specifying the appropriate framework.

There was chance that the dotnet core version specified in .json file mismatch with the version installed. You can try the solutions given in this thread mentioned by TrevorBrooks.
If above thread didnot workout for you.Try run .exe directly from console (./MiddleCompassServer.exe ) without using dotnet. as pointed out in this thread.
You can also try adding the runtimes setting in project.json and modify the RuntimeIdentifiers in .csproj file as this thread pointed out.

Related

Extraction failed for file: in ExtractFiles#1

I have a react js application, that one currently set for Azure CI/CD pipelines.
Suddenly it started failing at the release phase. it's building successfully and I can see .zip file created in artifacts.
Extract file task set in the following way
error occurring this way, no more details about the extraction failing
Extraction failed for file:
/home/vsts/work/r1/a/{pipeline_project}/drop/{build_number}.zip
ExtractFiles task has been migrated from the Node 10 handler to the Node 16 handler.
There's a known issue here in the Node 16 handler compared to the Node 10 handler. A Pull Request to increase the value of the maxBuffer option has been created to fix the issue.
Currently, the task version has been overridden to the previous one (1.200.0). Tested it, now it works.
Please try it again using the task version 1.200.0.

Why is Access to the path '/bin/roslyn' denied?

Long story short, I was able to build a bitbucket .NET/MVC/Angular project successfully on windows 2019 azure hosted agent, but I am unable to make it build successfully on ubuntu agent.
The reason I want to build it on ubuntu is because I noticed the build time is way faster than that of the windows agent, which makes sense considering the platforms.
I am facing this error:
Copying file from "/home/vsts/work/1/s/Bobby.ProjectA/obj/Debug/Bobby.ProjectA.pdb" to "/home/vsts/work/1/s/Bobby.ProjectA/bin/Bobby.ProjectA.pdb".
CopyRoslynCompilerFilesToOutputDirectory:
Creating directory "/bin/roslyn".
Creating directory "/bin/roslyn".
Creating directory "/bin/roslyn".
Creating directory "/bin/roslyn".
/home/vsts/work/1/s/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8/build/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(17,5):
warning MSB3021: Unable to copy file "/home/vsts/work/1/s/packages/Microsoft.Net.Compilers.2.4.0/build/../tools/csc.exe" to "/bin/roslyn/csc.exe". Access to the path '/bin/roslyn' is denied. [/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj]
According to this post, the issue is because the VBCSCompiler is locking the src.
So i have exhausted all of these solutions here to kill the VBCCompiler, but none of them worked.
I also can't restart the ubuntu agent during a build due to CI limitation, and killall VBCSCompiler bash script before msbuild task resulted in this error: VBCSCompiler: no process found
So now i am stumped, if VBCSCompiler process is not even running, why is Access to the path '/bin/roslyn' denied???
Ive also tried updating/installing Microsoft.CodeDom.Providers.DotNetCompilerPlatform package per this post here, but that didnt do/help anything.
This is how my build tasks looks like if it helps:

AutomationUI function test don't start by Azure Pipelines YAML

I have to run some AutomationUI functional tests from Azure DevOps Pipelines. The tests use a desktop application in WPF/Winforms. The problem is a process of application start but without UI. I run the test using YAML and tasks: VSTest#2 or PowerShell#2. I found exception in Windows Event Viewer:
The description for Event ID 0 from source VSTTExecution 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:
(testhost.exe, PID 13060, Thread 3)
HKEY_LOCAL_MACHINE\EnterpriseTools\QualityTools\TestTypes Key cannot
be found!
The message resource is present but the message was not found in the
message table.
I reinstalled the service as was suggested on a forum, but it still not work.
When I run the same tests from PowerShell or Command Line there is no problem.
Where could be a problem? Is there any recommended way to run functional test? I suppose the problem is between Azure DevOps Pipelines and VS test runner, because the same test was running successful by Team City or from PowerShell/Command Line

VssServiceResponseException: Forbidden in Azure Pipelines

I'm using Azure Pipelines to run automated tests via VSTest Platform (V2). The deployment group I'm using has no Internet access and is private. I have the task currently set up to run Nunit tests in the project via the test assemblies. The deployment group has VSTest Platform installed on it and I specify the path to vstest.console.exe in the task. The build artifact is downloaded from the pipeline.
The error I'm getting during the VSTest task is this:
Unhandled exception ocurred: Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Forbidden
Followed by a stack trace and then this shortly after:
Error: The process 'C:\agent\A1\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.164.2\Modules\DTAExecutionHost.exe' failed with exit code 3762504530
I can attach the full log if need be, but I'm just trying to get some general direction at the moment.
First off, what is VssService? I'm assuming it has something to do with Visual Studio, but the only things I can find with the VSS acronym are Visual SourceSafe (Microsoft source control software from ~2005, so I really doubt that's it) and something to do with Cisco network switches.
Second, what is DTAExecutionHost?
Third, where can I find information on that error code?

Why don't my artifacts published during the build using the publishArtifacts service message show up in TeamCity?

I am creating a screenshot when my NUnit end-to-end test fails and I am trying to publish it with TeamCity (build agent and server both running on Windows) using the following service message (as described here) which I am writing with Console.WriteLine from an NUnit test:
##teamcity[publishArtifacts 'C:\BuildAgent\work\xxxxxxxxxxxxxxxx\Path\To\My\Stuff\fail.png']
I see the line in the build log:
------- Stdout: -------
##teamcity[publishArtifacts 'C:\BuildAgent\work\xxxxxxxxxxxxxxxx\Path\To\My\Stuff\fail.png']
But TeamCity is not picking up the file, or at least it is not showing up in the build artifacts. How do I make this work?
Try using relative paths. Teamcity should resolve them against build working directory.
You can try Console.Write instead of Console.WriteLine (see below).
Anyway, I guess TeamCity don't trap these messages because they are 'test reports' and appended in the buildlog as text output.
My feeling is they are not parsed and then not interpreted by the Build Script Interaction behavior because of the way they are flushed into the build log.
From the Build Script Interaction (TC 7) :
Service messages are used to pass commands/build information to
TeamCity server from the build script. In order to be processed by
TeamCity they should be printed into standard output stream of the
build (otherwise, if the output is not in the service message syntax,
it should appear in the build log). A single service message should
not contain a newline character inside it, it should not span across
multiple lines.
You should put your test artifacts in a specific folder and delay the publish after the tests.
Note that if you don't need to resolve artifact dynamically, you should use the simpliest way : the Artifact paths in the build configuration general settings.
Use the NuGet package provided by JetBrains, this takes care of all the subtleties
NuGet Install TeamCity.ServiceMessages
On GitHub: https://github.com/JetBrains/TeamCity.ServiceMessages