在Azure任务上设置变量,以通过Azure Pipeline的另一个任务
我能够在PowerShell或Bash脚本上设置一个变量,并通过使用## VSO [task.set.setVariable actible = abc;] xyz将变量传递给另一个任务。但是找不到任何文档可以在Azure任务上设置变量,例如Azure WebApp部署任务或sqlazuredacpacdeployment任务。我想通过传递变量值来捕获错误。有没有有效的方法来捕获下一个任务的Azure任务错误日志?
- task: SqlAzureDacpacDeployment@1
displayName: 'Insertion SQL Task'
inputs:
azureSubscription: 'Org (xxxxx-xxxx-xxxx-xxxx-xxxx)'
ServerName: 'tcp:abc.database.windows.net'
DatabaseName: test_db
SqlUsername: '$(user)'
SqlPassword: $(pass)
deployType: SqlTask
SqlFile: 'SQL/test.sql'
enabled: true
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy: $(AppName)'
inputs:
azureSubscription: 'Org (xxxxx-xxxx-xxxx-xxxx-xxxx)'
appType: webApp
ResourceGroupName: 'Test'
appName: '$(AppName)'
package: '$(Build.ArtifactStagingDirectory)\app/*.zip'
deploymentMethod: zipDeploy
enabled: true
I am able to set a variable on powershell or bash script and pass the variable to another task by using ##vso[task.setvariable variable=abc;]xyz. But couldn't find any documentation to set variable on azure tasks like azure webapp deploy task or SqlAzureDacpacDeployment task. I want to catch the error by passing the variable value. Is there any effective way to catch the azure task error log for the next task?
- task: SqlAzureDacpacDeployment@1
displayName: 'Insertion SQL Task'
inputs:
azureSubscription: 'Org (xxxxx-xxxx-xxxx-xxxx-xxxx)'
ServerName: 'tcp:abc.database.windows.net'
DatabaseName: test_db
SqlUsername: '$(user)'
SqlPassword: $(pass)
deployType: SqlTask
SqlFile: 'SQL/test.sql'
enabled: true
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy: $(AppName)'
inputs:
azureSubscription: 'Org (xxxxx-xxxx-xxxx-xxxx-xxxx)'
appType: webApp
ResourceGroupName: 'Test'
appName: '$(AppName)'
package: '$(Build.ArtifactStagingDirectory)\app/*.zip'
deploymentMethod: zipDeploy
enabled: true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为任务设置名称。
对于 Azure SQL数据库部署任务,您可以使用
sqldeploymentOutputfile
输出变量名称。Azure Web应用程序任务不提供相同的机制。您总是可以致电管道 - 获取日志api 以获取所需的东西:
You will need to set a name for the task.
For Azure SQL Database Deployment task, you can use the
SqlDeploymentOutputFile
output variable name.The Azure Web App task does not provide the same mechanism. You could always call the Pipelines - Get Logs API to get what you need: