如何在仓库名称更改后更新GitLab CI/CD变量?

huangapple go评论58阅读模式
英文:

How to update GitLab CI/CD variables after repository name change?

问题

我最近在GitLab中更改了我的存储库名称。有没有办法确保库存的GitLab CI/CD变量更新以反映新的存储库名称,而不是在我的CI/CD管道中手动覆盖它们?

假设,原存储库名称为'A',新名称为'B'。一旦我更改了存储库的名称,由GitLab自动设置的GitLab CI/CD变量保持不变。例如,CI_PROJECT_NAME变量仍然是A,而我希望它现在是B,以反映新的存储库名称。

英文:

I have recently changed my repository name in GitLab. Is there any way I can make sure that the stock GitLab CI/CD variables are updated to reflect the new repository name without manually overriding them in my CI/CD pipelines?

Hypothetically, lets say the repository's original name is 'A' and its new name is 'B'. Once I've changed the repository's name, the GitLab CI/CD variables that are set automatically by GitLab remain unchanged. For example the stock CI/CD variable CI_PROJECT_NAME is still A when I want it to now be B to reflect the new repository name.

答案1

得分: 1

根据文档,变量CI_PROJECT_NAME是从项目的目录派生的。这可以在设置 -> 常规 -> 高级 -> 更改路径下进行更改。在此处编辑项目路径后,CI_PROJECT_NAME的值会相应更改。

在您的情况下,我会猜测您只是在设置 -> 常规 -> 项目名称下更改了项目名称,这仅用于在用户界面中显示。

英文:

According to the docs, the variable CI_PROJECT_NAME is derived from the directory of the project. This can be changed under Settings -> General -> Avanced -> Change path. After editing the project path here, CI_PROJECT_NAME changes its value accordingly.

In your case I would blindly guess that you just changed the project name
under Settings -> General -> Project name, which is only used for displaying in the UI.

huangapple
  • 本文由 发表于 2023年4月17日 14:43:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032335.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定