gpt4 book ai didi

azure devops管道找不到文件

转载 作者:行者123 更新时间:2023-12-03 05:19:39 25 4
gpt4 key购买 nike

我有以下简单的管道,我想使用参数文件运行二头肌文件:

name: "BRCi.HMRC.Scaffolding"
trigger: none
pool:
vmImage: "ubuntu-latest"
stages:
- stage: DeployTest
variables:
env: Test
jobs:
- deployment: deploy
environment: Test
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: CmdLine@2
displayName: List files2
inputs:
script: |
echo "Structure of work folder of this pipeline:"
tree $(Pipeline.Workspace)
- task: AzureCLI@2
displayName: Deploy Template
inputs:
azureSubscription: brci-devops-sc-tst-BRCi.HMRC
scriptType: pscore
scriptLocation: inlineScript
inlineScript: az deployment group create `
--resource-group brci-hmrc2-rg-tst
--template-file $(Pipeline.Workspace)/Bicep/Main.bicep `
--parameters $(Pipeline.Workspace)/Bicep/Hmrc.Parameters.Test.json

List files2 作业的输出看起来不错:

/home/vsts/work/1 
├── TestResults
├── a
├── b
└── s
├── Bicep
│ ├── Hmrc.Parameters.Test.json
│ ├── Main.bicep
│ └── giftaidLogicApp.bicep
├── README.md
└── azure-pipelines.yml

但是,尝试运行 az 部署组创建的行失败并出现以下错误:

ERROR: An error occurred reading file. Could not find a part of the path '/home/vsts/work/1/Bicep/Main.bicep'.

最佳答案

请将任务的工作目录设置为$(Pipeline.Workspace):AzureCLI@2

我运行了这个:

- deployment: DeployWeb
displayName: deploy Web App
environment: 'Dev'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- script: |
pwd
echo "$(Pipeline.Workspace)"

得到了

/home/vsts/work/1/s
/home/vsts/work/1

因此您的任务在 /home/vsts/work/1/s 中执行,这就是您需要切换工作目录的原因。

关于azure devops管道找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73248685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com