Reputation: 1765
I'm quite new to CI and am experimenting with Azure DevOps.
I want to use an automated testing tool in my CI pipeline that uses either a Bash script and a PowerShell script that's run inside the CI pipeline to trigger the testing tool.
How do I add either the Bash or PowerShell script into my pipeline in Azure DevOps so that the script runs and triggers the testing tool?
Upvotes: 1
Views: 4041
Reputation: 41545
There are built-in PowerShell/Bash tasks that you can add to your pipeline.
You can add .ps1
or .sh
to your repository and in the task specify the script file, or put an inline script.
If you using .yaml
builds you can add them in this way:
# 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
If you using the visual designer you can add the tasks in this way:
Upvotes: 5