代码拉取完成,页面将自动刷新
#!groovy
@Library("library@master") _
build_script = '''
echo "------build_start------"
echo "${WORKSPACE}"
docker pull ${BUILD_IMAGE_TOOL}
docker run -t --init --cap-add=SYS_ADMIN --rm -v ${WORKSPACE}:/app ${BUILD_IMAGE_TOOL} bash -c "cd /app && apt-get install g++ make python3 && \
npm install node-gyp --registry=https://registry.npmmirror.com && \
yarn config set registry https://registry.npmmirror.com && \
yarn config set disturl https://npmmirror.com/mirrors/node/ && \
yarn config set iltorb_binary_host https://mirrors.apusic.com/src/iltorb
yarn && \
yarn site && \
yarn build && \
ls"
echo "------build_end------"
'''
deploy_script = '''
echo "------deploy_start------"
cd ${DEPLOY_DIR}
tar xvf _site.tgz
echo "------deploy_end------"
'''
def _config = [
agent:[
label:'ubuntu-node'
],
environment: [
DISABLE_PROXY: true ,
BUILD_IMAGE_TOOL: 'harbor.apusic.com/library/node:16' ,
DEPLOY_HOST: '172.18.100.65',
DEPLOY_DIR: '/root/lao/apusic-ui',
],
parameters: [
[
string: [
defaultValue: 'dev',
description: '分支名称',
name:'branch'
],
booleanParam: [
defaultValue: false,
description: '清空工作空间',
name:'clean'
],
]
],
triggers:[
gitee: "dev",
cron: 'H 23 * * *'
],
checkout: [
url: "https://gitee.com/apusic-frontend/apusic-ui.git",
disableSubmodules: true
],
stages:[
[
stage:"build_UI",
alwaysPass:false,
timeout:15,
steps:[
localScript:[
[text: build_script]
]
]
],
[
stage:"archive_UI",
alwaysPass:false,
timeout:15,
when: [
not:[
[triggeredBy: "TimerTrigger"]
]
],
steps:[
archiveArtifacts: [
artifacts: "_site",
packaging: "tgz" ,
filepath: "_site.tgz"
]
]
],
[
stage:"deploy_UI",
alwaysPass:false,
timeout:20,
when:[not:[triggeredBy:"TimerTrigger"]],
steps:[
sshCopy:[
src:'_site.tgz',
dest:'${DEPLOY_DIR}',
hosts:'${DEPLOY_HOST}'
],
sshScript:[
text: deploy_script,
hosts:'${DEPLOY_HOST}'
]
]
]
]
]
pipelineLoad(_config);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。