提交 06fb7d45 authored 作者: 闫鹏's avatar 闫鹏

合并分支 'yp-dev' 到 'pre'

Yp dev 查看合并请求 !277
流水线 #201 已通过 于阶段
in 3 分 2 秒
...@@ -14,7 +14,9 @@ build_pre: ...@@ -14,7 +14,9 @@ build_pre:
stage: build stage: build
image: node:20-bullseye image: node:20-bullseye
tags: tags:
- risk-monitor-frontend - docker
- frontend
- linux
only: only:
- pre - pre
script: script:
...@@ -37,39 +39,17 @@ deploy_pre: ...@@ -37,39 +39,17 @@ deploy_pre:
stage: deploy stage: deploy
image: alpine:3.20 image: alpine:3.20
tags: tags:
- risk-monitor-frontend - docker
- frontend
- linux
only: only:
- pre - pre
dependencies: dependencies:
- build_pre - build_pre
script: script:
- apk add --no-cache rsync curl jq - apk add --no-cache rsync
# 只允许“最新一次 pre pipeline”部署到 nginx(加二次确认,避免短时间多次推送导致重复 rsync) - test -d dist || (echo "dist not found" && exit 1)
- > - test -d /nas/kjb_service/zm/pre-project/html || (echo "deploy target path not found" && exit 1)
LATEST_PIPELINE_ID="$(
curl --silent --show-error --fail
--header "JOB-TOKEN: $CI_JOB_TOKEN"
"$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
| jq -r '.[0].id'
)"
- >
if [ -z "$LATEST_PIPELINE_ID" ] || [ "$LATEST_PIPELINE_ID" != "$CI_PIPELINE_ID" ]; then
echo "skip deploy: not latest pipeline (latest=$LATEST_PIPELINE_ID current=$CI_PIPELINE_ID)";
exit 0;
fi
- sleep 20
- >
LATEST_PIPELINE_ID="$(
curl --silent --show-error --fail
--header "JOB-TOKEN: $CI_JOB_TOKEN"
"$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
| jq -r '.[0].id'
)"
- >
if [ -z "$LATEST_PIPELINE_ID" ] || [ "$LATEST_PIPELINE_ID" != "$CI_PIPELINE_ID" ]; then
echo "skip deploy: not latest pipeline after debounce (latest=$LATEST_PIPELINE_ID current=$CI_PIPELINE_ID)";
exit 0;
fi
- rsync -avz --delete dist/ /nas/kjb_service/zm/pre-project/html/ - rsync -avz --delete dist/ /nas/kjb_service/zm/pre-project/html/
# 非 protected 分支:push 时先做 build 校验(避免合并 pre 时出现 build 报错) # 非 protected 分支:push 时先做 build 校验(避免合并 pre 时出现 build 报错)
...@@ -77,7 +57,9 @@ build_check: ...@@ -77,7 +57,9 @@ build_check:
stage: build stage: build
image: node:20-bullseye image: node:20-bullseye
tags: tags:
- risk-monitor-frontend - docker
- frontend
- linux
# 只在 push 时做构建校验,且排除 protected 分支与目标分支 pre # 只在 push 时做构建校验,且排除 protected 分支与目标分支 pre
only: only:
- pushes - pushes
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论