Как добавить сценарий Bash или PowerShell в конвейер DevOps Azure - PullRequest
0 голосов
/ 09 мая 2019

Я довольно новичок в CI и экспериментирую с Azure DevOps.

Я хочу использовать инструмент автоматического тестирования в моем конвейере CI, который использует либо сценарий Bash, либо сценарий PowerShell, который запускается внутри конвейера CI для запуска инструмента тестирования.

Как добавить сценарий Bash или PowerShell в мой конвейер в DevOps Azure, чтобы скрипт запускался и запускал инструмент тестирования?

1 Ответ

1 голос
/ 09 мая 2019

Есть встроенные PowerShell / Bash задач, которые вы можете добавить в свой конвейер.

Вы можете добавить .ps1 или .sh в свой репозиторий и в задаче указать файл скрипта или поместить встроенный скрипт.

Если вы используете .yaml сборки, вы можете добавить их следующим образом:

# 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

Если вы используете визуальный дизайнер, вы можете добавить задачи следующим образом:

enter image description here

enter image description here

...