Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
a470dd3e
提交
a470dd3e
编辑于
3 years ago
作者:
Lin Jen-Shin
浏览文件
操作
下载
差异文件
Merge branch 'fix-review-cleanup' into 'master'
ci: Require a missing file in review-cleanup See merge request gitlab-org/gitlab!76734
上级
783ce2d8
dfa4770e
No related branches found
No related tags found
无相关合并请求
变更
3
隐藏空白变更内容
行内
左右并排
显示
3 个更改的文件
.gitlab/ci/review-apps/main.gitlab-ci.yml
+1
-1
1 个添加, 1 个删除
.gitlab/ci/review-apps/main.gitlab-ci.yml
.gitlab/ci/review.gitlab-ci.yml
+2
-1
2 个添加, 1 个删除
.gitlab/ci/review.gitlab-ci.yml
scripts/review_apps/review-apps.sh
+28
-6
28 个添加, 6 个删除
scripts/review_apps/review-apps.sh
有
31 个添加
和
8 个删除
.gitlab/ci/review-apps/main.gitlab-ci.yml
+
1
−
1
浏览文件 @
a470dd3e
...
...
@@ -105,4 +105,4 @@ review-stop:
stage
:
deploy
needs
:
[]
script
:
-
delete_
k8s_release_
namespace
-
delete_namespace
此差异已折叠。
点击以展开。
.gitlab/ci/review.gitlab-ci.yml
+
2
−
1
浏览文件 @
a470dd3e
...
...
@@ -9,12 +9,13 @@ review-cleanup:
action
:
stop
before_script
:
-
source scripts/utils.sh
-
source scripts/review_apps/review-apps.sh
-
source scripts/review_apps/gcp_cleanup.sh
-
install_gitlab_gem
-
setup_gcp_dependencies
script
:
-
delete_release
-
delete_
k8s_release_
namespace
-
delete_namespace
-
ruby -rrubygems scripts/review_apps/automated_cleanup.rb
-
gcp_cleanup
...
...
此差异已折叠。
点击以展开。
scripts/review_apps/review-apps.sh
+
28
−
6
浏览文件 @
a470dd3e
[[
"
$TRACE
"
]]
&&
set
-x
function
namespace_exists
()
{
local
namespace
=
"
${
1
}
"
local
namespace_exists
echoinfo
"Checking if
${
namespace
}
exists..."
true
kubectl describe namespace
"
${
namespace
}
"
>
/dev/null 2>&1
namespace_exists
=
$?
if
[
$namespace_exists
-eq
0
]
;
then
echoinfo
"Namespace
${
namespace
}
found."
else
echoerr
"Namespace
${
namespace
}
NOT found."
fi
return
$namespace_exists
}
function
deploy_exists
()
{
local
namespace
=
"
${
1
}
"
local
release
=
"
${
2
}
"
...
...
@@ -73,17 +91,20 @@ function delete_failed_release() {
# Cleanup and previous installs, as FAILED and PENDING_UPGRADE will cause errors with `upgrade`
if
previous_deploy_failed
"
${
namespace
}
"
"
${
release
}
"
;
then
echoinfo
"Review App deployment in bad state, cleaning up namespace
${
release
}
"
delete_
k8s_release_
namespace
delete_namespace
else
echoinfo
"Review App deployment in good state"
fi
fi
}
function
delete_
k8s_release_
namespace
()
{
function
delete_namespace
()
{
local
namespace
=
"
${
CI_ENVIRONMENT_SLUG
}
"
kubectl delete namespace
"
${
namespace
}
"
--wait
if
namespace_exists
"
${
namespace
}
"
;
then
echoinfo
"Deleting namespace
${
namespace
}
..."
true
kubectl delete namespace
"
${
namespace
}
"
--wait
fi
}
function
get_pod
()
{
...
...
@@ -170,9 +191,10 @@ function check_kube_domain() {
function
ensure_namespace
()
{
local
namespace
=
"
${
1
}
"
echoinfo
"Ensuring the
${
namespace
}
namespace exists..."
true
kubectl describe namespace
"
${
namespace
}
"
||
kubectl create namespace
"
${
namespace
}
"
if
!
namespace_exists
"
${
namespace
}
"
;
then
echoinfo
"Creating namespace
${
namespace
}
..."
true
kubectl create namespace
"
${
namespace
}
"
fi
}
function
label_namespace
()
{
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录