首页 > 解决方案 > Azure 管道调试日志记录

问题描述

使用 YAML 模板,我的理解是,当我使用 system.debug 运行代码时,下面的代码应该记录参数:true。有人能告诉我我做错了什么吗?

parameters:
- name: branchName
  displayName: 'Repository branch name'
  type: string
- name: WebAppName
  displayName: 'Application name'
  type: string
- name: ServiceConnection
  displayName: 'ServiceConnection name'
  type: string
- name: Workspace
  displayName: 'Workspace name'
  type: string
  
  ##[group]Beginning of a DeployTemplate Parameters
  ##[debug]Debug branchName: ${{parameters.branchName}}
  ##[debug]Debug WebAppName: ${{parameters.WebAppName}}
  ##[debug]Debug ServiceConnection: ${{parameters.ServiceConnection}}
  ##[debug]Debug Workspace: ${{parameters.Workspace}}
  ##[debug]Build.SourceBranchName: variables['Build.SourceBranchName']
  ##[endgroup]

标签: azure-pipelines

解决方案


我测试了以下脚本,在我这边,参数值在日志中正常显示。您是否在模板文件中为参数设置了默认值或将值传递给管道 yaml 中的参数?

参数模板yaml:

在此处输入图像描述

管道yaml:

在此处输入图像描述

日志:

在此处输入图像描述


推荐阅读