从管道工作中删除gitlab环境

发布于 2025-02-04 15:26:13 字数 548 浏览 2 评论 0原文

目前,我正在为每个合并请求创建gitlab环境,以部署临时页面。合并请求后,这些环境立即停止,但是我想在管道中添加一个额外的步骤,以完全从“停止”环境中“删除环境”。我不想使用GUI,我发现的唯一选项是API方法:

delete/projection/:id/emovents/:emovention_id

https://docs.gitlab.com/ee/ee/eapi/environments.html#delete-delete-ntml#delete-an-en-en-vironment

,这里的问题是它需要:emoventing_id变量,我无法找到并获得。

以不同的方法或如何获得:emoventim_id的任何帮助将不胜感激。

Currently, I am creating GitLab environments for each merge request to deploy temporary pages. These environments stop as soon as merge request is merged, but I want to add an additional step to the pipeline to "Remove environment" completely from "Stopped" environments. I don't want to use GUI and only option I found was an API method:

DELETE /projects/:id/environments/:environment_id

https://docs.gitlab.com/ee/api/environments.html#delete-an-environment

But, problem here is that it required :environment_id variable, which I couldn't manage to find and get.

Any help with a different approach or how to get :environment_id will be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不弃不离 2025-02-11 15:26:13

您可以删除时间表停止审查应用程序环境:

DELETE /projects/:id/environments/review_apps

或者您可以列出您的环境搜索您需要使用name搜索 param删除的一个。然后,您可以获取emovention_id删除该环境。您可以添加状态参数以获取停止的环境:

GET /projects/:id/environments?states=stopped&name=review%2Fxxx

然后,只需对结果进行循环即可调用delete endpoint。您可以使用 jq 在结果中获取emovention_id

You can schedule for deletion all stopped review apps environment :

DELETE /projects/:id/environments/review_apps

Or you can list your environments and search for the one you need to delete with name or search param. Then you can get the environment_id to delete that environment. You can add the states param to get only stopped environments :

GET /projects/:id/environments?states=stopped&name=review%2Fxxx

Then just make a loop on the result to call the DELETE endpoint. You can use jq to get the environment_id in the result.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文