我有Jobs在YAML管道中正常工作,但是当我将其更改为Deployment Job时,该路径无法工作。
jobs:
- job: InfrastructureAsCodeDeployment
pool:
name: Azure Pipelines
vmImage: windows-2019
steps:
- task: "AzurePowerShell@2"
displayName: 'Azure PowerShell script: Remove Keyvault'
inputs:
azureSubscription: 'Connection name'
ScriptType: 'FilePath'
ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
azurePowerShellVersion: 'LatestVersion'
continueOnError: true
部署到部署作业后:-
jobs:
- deployment: InfrastructureAsCodeDeployment
pool:
name: Azure Pipelines
vmImage: windows-2019
environment: 'DEV'
strategy:
runOnce:
deploy:
steps:
- task: "AzurePowerShell@2"
displayName: 'Azure PowerShell script: Remove Keyvault'
inputs:
azureSubscription: 'Connection name'
ScriptType: 'FilePath'
ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
azurePowerShellVersion: 'LatestVersion'
continueOnError: true
尝试将“ System.DefaultWorkingDirectory”添加到Deployment中,但仍然无法正常工作。
答案 0 :(得分:0)
需要从头开始的额外步骤
steps:
- checkout: self
看起来像这样
jobs:
- deployment: InfrastructureAsCodeDeployment
pool:
name: Azure Pipelines
vmImage: windows-2019
environment: 'DEV'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: "AzurePowerShell@2"
displayName: 'Azure PowerShell script: Remove Keyvault'
inputs:
azureSubscription: 'Connection name'
ScriptType: 'FilePath'
ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
azurePowerShellVersion: 'LatestVersion'
continueOnError: true
不幸的是,文档没有这么说。 但是与作业管道相比,我发现了这一点(部署管道没有可视化步骤。