首页 > 解决方案 > Azure Devops Piepeline - Yaml Powershell 脚本路径

问题描述

我想问你是否有人知道如何在 Azure Devops Pipeline Yaml 语法中创建正确的 powershell 路径。

我的 YAML 看起来如何(当前):

trigger:
- develop

pool:
  vmImage: 'ubuntu-latest'

steps:

- task: PowerShell@2
  inputs:
    filePath: './scripts/script.ps1'

我的目录看起来如何:

在此处输入图像描述

什么样的路径返回管道:

获取内容:/home/vsts/work/1/s/scripts/script.ps1:12

什么样的错误返回管道:

##[错误]PowerShell 以代码“1”退出。

标签: azureyamlazure-pipelinesazure-pipelines-yaml

解决方案


正确答案:

- task: PowerShell@2
  inputs:
    filePath: '$(Agent.BuildDirectory)/s/scripts/script.ps1'

推荐阅读