azure-devops - DevOps Pipeline 如何修复此“允许脚本访问 OAuth 令牌”
问题描述
我有一个 Azure DevOps 管道,我想标记 Azure Git 存储库
task: AssembyInfoReader@2
displayName: Set Version numbers
inputs:
searchPattern: 'JLReyLibrary/Properties/GlobalAssemblyInfo.cs'
获取程序集信息变量。
然后这个任务会导致错误:
task: GitTag@2
displayName: Tag Repo to $(AssemblyInfo.AssemblyInformationVersion)
inputs:
tag: '$(AssemblyInfo.AssemblyInformationalVersion)'
forceTagCreation: true
##[error]OAuth token not found. Make sure to have 'Allow Scripts to Access OAuth Token' enabled in the build definition.
如何设置 OAuth 令牌?
澄清
我尝试了下面的建议。
现在我有以下问题。
- 如何获取 OAuth 令牌?
- 我如何在
env: Systems_AccessToken: $(System.AccessToken)
我找到了`DevOps->Organizational Settings->OAuth Configurations
- 我在哪里可以找到设置中字段的描述?
我仍然收到以下错误消息:
Allow Scripts to Access OAuth Token
解决方案
您需要将此添加到任务中:
env:
System_AccessToken: $(System.AccessToken)
所以,在你的情况下:
- task: GitTag@2
displayName: Tag Repo to $(AssemblyInfo.AssemblyInformationVersion)
inputs:
tag: '$(AssemblyInfo.AssemblyInformationalVersion)'
forceTagCreation: true
env:
System_AccessToken: $(System.AccessToken)
推荐阅读
- c - 在我的程序中,为什么“if and else 语句”会遇到分段错误?
- sql - 为什么我的 CROSS APPLY 列没有显示?
- teradata - 3706 teradata 中的语法错误预期在 ')' 和 'AS' 关键字之间
- javascript - 插入已填充空数组的二维数组的行时,元素被添加到每一行
- json - 如何使用 Azure 数据工厂管道将嵌套的 JSON 对象映射到 SQL Server 表
- jax-rs - 如何接受任意 JSON 对象?
- odata - 如何展开嵌套的 odata 表
- flutter - 继承后的类构造函数
- logic - 返回逻辑如何工作 ERROR = '1'; 成功 = '0';
- accounting - BankEntryLine 的精确更改 GLAccount