actions / runner-images

GitHub Actions runner images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipeline Broken by Ubuntu 18.04 (20220710 update) PR #5882

dariusonsched opened this issue · comments

Description

Our YAML pipeline broke following your Ubuntu 18.04 agent update 20220710 in PR #5882.

Without any changes to our YAML pipeline definition for over thirty days, following our last successful execution of a YAML pipeline that sets a pipeline variable using the AzurePowerShell@5 task on 7/11/2022 at 9:47am EDT, all subsequent executions are failing as of 7/14/2022 at 12:57pm EDT and thereafter.

Note: Repointing our YAML to Ubuntu 20.04 fixes this newly introduced 18.04 issue

Here is the task definition:

     - task: AzurePowerShell@5
       name: setImageTagScript
       env:
         buildId: $(Build.BuildId)
       inputs:
       pwsh: true
         azurePowerShellVersion: latestVersion
         FailOnStandardError: true
         scriptType: inlineScript
         azureSubscription: '$(AzDO_Service_Connection_Prod)'
         inline: |
           Write-Output "Setting output variable 'imageTag' to: $env:buildId"
           Write-Host "##vso[task.setvariable variable=imageTag;isOutput=true]$env:buildId"

Here are the relevant lines from the log:

##[debug]Processed: ##vso[task.setvariable variable=imageTag;isOutput=true]5064
##[debug]Exit code 0 received from tool '/usr/bin/pwsh'
##[debug]STDIO streams have closed for tool '/usr/bin/pwsh'
##[debug]task result: Failed
##[error]PowerShell wrote one or more lines to the standard error stream.
##[debug]Processed: ##vso[task.issue type=error;]PowerShell wrote one or more lines to the standard error stream.
##[debug]Processed: ##vso[task.complete result=Failed;]PowerShell wrote one or more lines to the standard error stream.

Even though the Exit Code from the AzurePowerShell@5 task is zero (0) which should indicate successful execution, it is acting as if it failed.

Platforms affected

  • Azure DevOps
  • GitHub Actions

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 10.15
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

20220710.1

Is it regression?

Yes - Version 20220626.1 worked

Expected behavior

Setting a pipeline variable using AzurePowerShell@5 task in Azure DevOps used to and should continue to succeed without resulting in a PowerShell error upon Exit Code 0 (success).

The following used to work in 20220626.1:

Write-Host "##vso[task.setvariable variable=imageTag;isOutput=true]$env:buildId"

It no longer works as of 20220710.1

Actual behavior

The following diagnostic pipeline execution output reveals the current behavior:

##[debug]Processed: ##vso[task.setvariable variable=imageTag;isOutput=true]5064
##[debug]Exit code 0 received from tool '/usr/bin/pwsh'
##[debug]STDIO streams have closed for tool '/usr/bin/pwsh'
##[debug]task result: Failed
##[error]PowerShell wrote one or more lines to the standard error stream.
##[debug]Processed: ##vso[task.issue type=error;]PowerShell wrote one or more lines to the standard error stream.
##[debug]Processed: ##vso[task.complete result=Failed;]PowerShell wrote one or more lines to the standard error stream.

Repro steps

Create an AzurePowerShell@5 task running under the hosted agent ubuntu-18.04 as follows. Note: We have an environment variable - we do not know if this matters or not.

    - task: AzurePowerShell@5
       name: setImageTagScript
       env:
         buildId: $(Build.BuildId)
       inputs:
       pwsh: true
         azurePowerShellVersion: latestVersion
         FailOnStandardError: true
         scriptType: inlineScript
         azureSubscription: '$(AzDO_Service_Connection_Prod)'
         inline: |
           Write-Output "Setting output variable 'imageTag' to: $env:buildId"
           Write-Host "##vso[task.setvariable variable=imageTag;isOutput=true]$env:buildId"

This should fail.

Retargeting this to ubuntu-20.04 should succeed.

External bug - Azure/azure-powershell#14207. Our recommendation is to start migration on Ubuntu 20.04.

@al-cheb While I appreciate your referring to the external bug, our issue does not relate to MSAL calls, but to a simple "Write-Host" statement within an Azure DevOps Pipeline to set a pipeline variable via the '##vsto' expression. Therefore, I have to disagree the cause being the same. That said, if the latest Azure PowerShell module upgrade to the Ubuntu 18.04 vm image rendered numerous Azure PowerShell related activities useless, it should be reverted.

Please reopen this issue.

@dariusonsched, in that case you should create a new issue in - azure-pipelines-tasks repository