0
votes

I have a virtual machine on Azure that I use to run a self hosted DevOps agent(version 2.170.1). The pipeline consists of some PowerShell tasks that runs build and unit testing. I use PowerShell core for this(version 7.0.2) and the server OS is Windows Server 2019 Datacenter 1809.

I have tried to run the tasks directly on the server from Powershell core(Version 7.0.2) and everything works as expected. When it runs in a pipeline with the Powershell@2 task, warnings are reported as errors causing the task to fail even though it should not. Furthermore other unexpected errors also occurs, that did not happen while running it directly on the server.

As an experiment I installed an agent of the same version on a laptop, and ran the pipeline on that instead. Again Powershell Core(Version 7.0.2) was used and the laptop OS is Windows 10 Enterprise 1909. All compilers, test tools, and such are also the same version.

This time everything worked as expected while running the pipeline.

This seems to suggest that it is not the Powershell task or the Agent that is the problem. However I have now arrived at a point where I dont really know where the problem could be located.

Here is an example of two of the tasks the pipeline is running.

- task: PowerShell@2
    displayName: Build source code
    inputs:
      targetType: inline
      pwsh: true
      script: 'cd build; make all --jobs 4 --output-sync'

  - task: PowerShell@2
    displayName: Unit test
    inputs:
      targetType: inline
      pwsh: true
      script: 'cd test/unit; ceedling gcov:i2c_ha utils:gcov'

Does anyone have an idea of what the problem could be and what a possible solution could be?

UPDATE:

So I have done some further investigation and it seems like problem actually originates in the way errors are logged from the output.

When I run Ceedling with warnings disabled no errors or warnings are reported. When warnings is enabled all warnings are reported as errors. So it seems like the output from Ceedling is analysed incorrectly.

A piece of the output from running Ceedling

In the link I have attached a piece of the output log of the task running Ceedling. As it can be seen Ceedling only reports warnings, but the logging tool in Azure DevOps actually logs it as an error.

This makes it hard to get an overview of warnings and the actual errors.

1

1 Answers

0
votes

When it runs in a pipeline with the Powershell@2 task, warnings are reported as errors causing the task to fail even though it should not.

1.Normally the PS task won't fail for warning, try adding script below:

  ignoreLASTEXITCODE: true
  pwsh: true
  continueOnError: true

2.If #1 doesn't resolve your issue, you should check if you're picking right machine to run your pipeline. Assuming your agent pool has more than one agents, you can add demands to specifiy the agent.

pool:
  name: Default
  demands:
  - Agent.Name -equals YourAgentName