首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向Azure DevOps管道添加Bash或PowerShell脚本

如何向Azure DevOps管道添加Bash或PowerShell脚本
EN

Stack Overflow用户
提问于 2019-05-09 20:10:27
回答 1查看 1.4K关注 0票数 1

我是CI的新手,并且正在尝试使用Azure DevOps。

我想在CI管道中使用自动化测试工具,该工具使用在CI管道内运行的Bash脚本和PowerShell脚本来触发测试工具。

如何在Azure DevOps中将Bash或PowerShell脚本添加到我的管道中,以便脚本运行并触发测试工具?

EN

回答 1

Stack Overflow用户

发布于 2019-05-09 20:43:54

您可以将内置的PowerShell/Bash任务添加到您的管道中。

您可以将.ps1.sh添加到存储库,并在任务中指定脚本文件,或放置内联脚本。

如果您使用.yaml构建,则可以通过以下方式添加它们:

代码语言:javascript
复制
# PowerShell
# Run a PowerShell script on Windows, macOS, or Linux.
- task: PowerShell@2
  inputs:
    #targetType: 'filePath' # Optional. Options: filePath, inline
    #filePath: # Required when targetType == FilePath
    #arguments: # Optional
    #script: '# Write your powershell commands here.' # Required when targetType == Inline
    #errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
    #failOnStderr: false # Optional
    #ignoreLASTEXITCODE: false # Optional
    #pwsh: false # Optional
    #workingDirectory: # Optional

# Bash
# Run a Bash script on macOS, Linux, or Windows
- task: Bash@3
  inputs:
    #targetType: 'filePath' # Optional. Options: filePath, inline
    #filePath: # Required when targetType == FilePath
    #arguments: # Optional
    #script: '# Write your commands here# Use the environment variables input below to pass secret variables to this script' # Required when targetType == Inline
    #workingDirectory: # Optional
    #failOnStderr: false # Optional
    #noProfile: true # Optional
    #noRc: true # Optional

如果您使用可视化设计器,则可以通过以下方式添加任务:

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56059144

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档