登录
首页 >  Golang >  Go问答

解决GOCD问题的材质代币更改

来源:stackoverflow

时间:2024-02-06 18:57:25 234浏览 收藏

哈喽!今天心血来潮给大家带来了《解决GOCD问题的材质代币更改》,想必大家应该对Golang都不陌生吧,那么阅读本文就都不会很困难,以下内容主要涉及到,若是你正在学习Golang,千万别错过这篇文章~希望能帮助到你!

问题内容

我们有许多管道设置,其中添加了 azure git 作为材料。几天后,添加到 git 材料中的令牌就会过期。因此我们更新了所有管道中的 git 令牌。当尝试再次执行管道时,但仍然出现错误 -

[go] job started: 2023-09-29 08:38:09 cest
[go] start to prepare pipeline1/281/build-stage/1/pipeline1-job-runonall-1 on win-2d15lva1htp [c:\program files (x86)\go agent]
[go] start to update materials.
[go] start updating files at revision revision from https://@dev.azure.com/git-repo-url
[git] fetching changes
stderr: fatal: verification code expired before contacting the server
stderr: bash: line 1: /dev/tty: no such device or address
stderr: error: failed to execute prompt script (exit code 1)
stderr: fatal: could not read password for 'https://e3yfws****@dev.azure.com/git-repo-url': no such file or directory
git fetch failed for [https://@dev.azure.com/git-repo-url]

环境 去版本:23.1.0 操作系统:windows

重现步骤

  1. 创建管道并向该管道添加材质信息。
  2. 现在在设置一些作业后触发管道。应该可以正常工作。
  3. 现在假设该材料令牌已过期,则需要更改其令牌。
  4. 现在将材料的标记值更改为新值。
  5. 运行管道。
  6. 它将始终选择旧的 git 材料凭证令牌,并给出如上所述的错误。

代码片段/屏幕截图

[go] Job Started: 2023-09-29 08:38:09 CEST
[go] Start to prepare Pipeline1/281/Build-Stage/1/Pipeline1-Job-runOnAll-1 on WIN-2D15LVA1HTP [C:\Program Files (x86)\Go Agent]
[go] Start to update materials.

[go] Start updating files at revision REVISION from https://@dev.azure.com/git-repo-url
[GIT] Fetching changes
STDERR: fatal: Verification code expired before contacting the server
STDERR: bash: line 1: /dev/tty: No such device or address
STDERR: error: failed to execute prompt script (exit code 1)
STDERR: fatal: could not read Password for 'https://e3yfws****@dev.azure.com/git-repo-url': No such file or directory
git fetch failed for [https://@dev.azure.com/git-repo-url]

预期结果 它应该选择最新的材料凭证令牌而不是旧的。

实际结果 它始终选择初始凭证令牌。

尝试过的方法 - 尝试重新启动 gocd 代理和 gocd 服务器。结果是一样的。 尝试从现有的克隆管道并更改此克隆管道中的 git 材料标记值。并且执行后,效果很好。


正确答案


不是在 URL 本身中传递令牌,而是在管道材料设置中传递用户名/密码。所有管道都运行良好。

参考链接 - https://github.com/gocd/gocd/issues/12058

今天带大家了解了的相关知识,希望对你有所帮助;关于Golang的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>