在我的构建管道中,我使用了多个 bash 脚本,参考了
Bash@3
任务,如下所示。
现在我尝试在
deployment
中使用脚本,但我似乎找不到脚本文件。我已经使用 tree
命令从多个路径(甚至从根目录)搜索了代理磁盘,但找不到 bash_scripts
目录。
请参阅下面片段中的
#
注释以获取解释。
trigger: none
pool:
vmImage: ubuntu-latest
variables:
- template: ./variables/dev-variables.yml # Works
- template: ./variables/common-variables.yml # Works
stages:
- stage: DeployToDev
displayName: Deploy to Dev Environment
jobs:
- template: ./jobs/get-docker-tags.yml # Works
- deployment: DeployToACR
displayName: Deploy to ACR
dependsOn: GetDockerImageTagsJob
environment:
name: $(adoEnvironment)
strategy:
runOnce:
deploy:
steps:
- script: ls $(System.DefaultWorkingDirectory)
- script: tree /home/vsts/work/
- script: tree $(System.DefaultWorkingDirectory)
- script: tree $(Agent.WorkFolder)
- script: tree $(Pipeline.Workspace)
- script: tree /
- task: Bash@3
displayName: 'Get Image With Tag'
name: GetImageWithTag
inputs:
targetType: 'filePath'
filePath: 'bash_scripts/getImageToDeploy.sh' # Doesn't work
... Deployment
在
deployment
作业中,默认情况下不会检出源代码。
将以下任务添加到您的步骤中:
steps:
- checkout: self
# other tasks here