代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/apinto 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
stages:
- notice
- check
- build
- deploy
- publish
variables:
PATH: /usr/local/sonar-scanner/sonar-scanner-4.4.0.2170-linux/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/data/golang/go/bin/:/root/go/bin
GOROOT: /data/golang/go
GOPROXY: https://goproxy.cn
APP: apinto
VERSION: $CI_COMMIT_SHORT_SHA
SAVE_DIR: /opt/apinto
APP_PRE: ${APP}-${VERSION}
default:
before_script:
- pwd
merge-informer: # 飞书回调
stage: notice
variables:
DIFF_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID/diffs"
rules:
- if: $CI_PIPELINE_SOURCE=="merge_request_event"
script:
- rm -rf out/apinto-*
- |
curl -X POST -H "Content-Type: application/json" \
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \
https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c
checker:
stage: check
rules:
- if: $CI_COMMIT_BRANCH=="develop"
script:
- set +e
- go mod tidy
- go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.data -timeout=1m ./...
- golangci-lint run --timeout=3m --out-format checkstyle --issues-exit-code 0 ./... > report.xml
- sonar-scanner
builder:
stage: build
rules:
- if: $CI_COMMIT_BRANCH=="develop"
when: on_success
- if: $CI_COMMIT_BRANCH=="test"
when: on_success
script:
- sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod
- go mod tidy
- cd build/cmd && ./package.sh $VERSION
cache:
paths:
- out/
deployer:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH=="develop"
variables:
DEPLOY_SERVER: root@172.18.189.43
DEPLOY_DESC: "DEV 环境"
- if: $CI_COMMIT_BRANCH=="test"
variables:
DEPLOY_SERVER: root@172.18.65.60
DEPLOY_DESC: "TEST 环境"
dependencies:
- builder
script:
- set -e
- scp out/${APP_PRE}.linux.x64.tar.gz ${DEPLOY_SERVER}:${SAVE_DIR}
- ssh ${DEPLOY_SERVER} "set -e; cd ${SAVE_DIR}; mkdir -p ${APP_PRE};tar -zxvf ${APP_PRE}.linux.x64.tar.gz -C ${APP_PRE};cd ${APP_PRE}/${APP}; ./install.sh upgrade;cd ${SAVE_DIR}; ./clean.sh ${APP_PRE}"
- |
curl -X POST -H "Content-Type: application/json" \
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:apinto\\n环境:${DEPLOY_DESC}\\n更新部署完成.\"}}" \
https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c
when: on_success
cache:
paths:
- out/
publisher:
stage: publish
only:
- tags
script:
- sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod
- go mod tidy
- GOVERSION=$(go version) EoscVersion=$(sed -n 's/.*eosc v/v/p' go.mod) goreleaser release --skip-validate --rm-dist --skip-publish
- mkdir -p /data/pkg/apinto/${CI_COMMIT_TAG}
- cp -if dist/*.tar.gz /data/pkg/apinto/${CI_COMMIT_TAG}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。