Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
minio-scs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhaozhenxing
minio-scs
Commits
192178d9
提交
192178d9
authored
9月 16, 2022
作者:
yueyang.lv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ci(jenkins): 添加Jenkinsfile
上级
42441209
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
122 行增加
和
0 行删除
+122
-0
Jenkinsfile
Jenkinsfile
+122
-0
没有找到文件。
Jenkinsfile
0 → 100644
浏览文件 @
192178d9
pipeline
{
agent
any
environment
{
_node_modules_cache_dir
=
"../${JOB_NAME}_cache/"
_node_modules_zip_name
=
"node_modules.tar.gz"
_cache_file
=
"${_node_modules_cache_dir}${_node_modules_zip_name}"
_wx_web_hook
=
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=88740cdf-7e83-48b7-8049-3e4cb1ced1ff"
}
options
{
buildDiscarder
logRotator
(
artifactDaysToKeepStr:
''
,
artifactNumToKeepStr:
''
,
daysToKeepStr:
'7'
,
numToKeepStr:
'15'
)
}
parameters
{
booleanParam
(
defaultValue:
false
,
name:
'UPDATE_CACHE'
,
description:
'是否更新缓存(初次创建流水线请勾选此选项)'
)
booleanParam
(
defaultValue:
true
,
name:
'PRIVATE_BUILD'
,
description:
'使用私有部署方式打包'
)
string
defaultValue:
'https://test-cc.kube.ucas'
,
name:
'REMOTE_URL'
,
trim:
true
,
description:
'租户模块远程地址(不要以“/”结尾)\ndev:https://test-cc.kube.ucas'
}
stages
{
stage
(
'加载缓存'
)
{
when
{
expression
{
params
.
UPDATE_CACHE
==
false
}
}
steps
{
sh
"echo ${_cache_file}"
sh
"tar -xvf ${_cache_file} -C ./"
}
}
stage
(
'安装依赖'
)
{
when
{
expression
{
params
.
UPDATE_CACHE
==
true
}
}
steps
{
sh
"""
export CI=false
yarn --registry=https://registry.npmjs.org
if [ ! -d ${_node_modules_cache_dir} ]; then
echo "缓存目录不存在,创建"
mkdir -p ${_node_modules_cache_dir}
fi
echo "删除缓存文件"
rm -rf "${_cache_file}"
echo "压缩 node_modules"
tar -czf ${_node_modules_zip_name} node_modules
echo "移动到缓存文件夹"
mv ${_node_modules_zip_name} ${_node_modules_cache_dir}
"""
}
}
stage
(
'打包(租户版)'
)
{
when
{
expression
{
params
.
PRIVATE_BUILD
==
false
}
}
steps
{
sh
"""
export CI=false
REMOTE_URL=${params.REMOTE_URL} npm run server_build
"""
}
}
stage
(
'打包(私有部署)'
)
{
when
{
expression
{
params
.
PRIVATE_BUILD
==
true
}
}
steps
{
sh
"""
export CI=false
npm run server_build:private
"""
}
}
}
post
{
success
{
sh
"""
curl "${_wx_web_hook}" \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"content": "## ${JOB_NAME} 打包完成
>**分支**: ${BRANCH_NAME}
>**模块**: ${params.PACKAGE} \n[任务详情](${BUILD_URL})"
}
}'
"""
}
failure
{
sh
"""
curl "${_wx_web_hook}" \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"content": "## ${JOB_NAME} 打包完成
>**分支**: ${BRANCH_NAME}
>**模块**: ${params.PACKAGE} \n[失败原因](${BUILD_URL}/console)"
}
}'
"""
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论