明树Git Lab

Commit 3ea3023d authored by Administrator's avatar Administrator

Update .gitlab-ci.yml

parent ea197305
Pipeline #103657 failed with stages
in 1 second
#-----------------------------------------------gzb-10.40.8.7-------------------------------------------------------- #-----------------------------------------------master-10.40.8.7--------------------------------------------------------
# 自动部署到cloud环境 # 自动部署到master环境
stages: stages:
- package - package
- deploy - deploy
package to gzb: package to master:
stage: package stage: package
image: lgatica/openssh-client image: lgatica/openssh-client
script: script:
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY_CLOUD" | tr -d '\r' > ~/.ssh/id_rsa - echo "$SSH_PRIVATE_KEY_master" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa - chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)" - eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa - ssh-add ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\nHost *\n\tPubkeyAcceptedKeyTypes=+ssh-dss\n\n" > ~/.ssh/config - echo -e "Host *\n\tStrictHostKeyChecking no\n\nHost *\n\tPubkeyAcceptedKeyTypes=+ssh-dss\n\n" > ~/.ssh/config
- ssh-add -l - ssh-add -l
- ssh root@10.40.8.7 " - ssh root@10.40.8.7 "
cd /srv/hpaas/ts_custom && cd /srv/jt_backend &&
git checkout ./package.json && git checkout ./package.json &&
git pull && git pull &&
npm install --registry https://registry.npmmirror.com && npm install --registry https://registry.npmmirror.com &&
rm -rf ./dist && rm -rf ./dist &&
npm run build npm run build
" "
environment:
name: master
only:
- master
tags:
- gzb-runner
deploy to master:
stage: deploy
image: lgatica/openssh-client
script:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY_master" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\nHost *\n\tPubkeyAcceptedKeyTypes=+ssh-dss\n\n" > ~/.ssh/config
- ssh-add -l
- ssh root@10.40.8.7 "
cd /srv/jt_backend &&
pm2 stop ts_custom && pm2 delete ts_custom && pm2 start --name ts_custom npm -- run master || pm2 start --name ts_custom npm -- run master
"
when: always
environment: environment:
name: master name: master
only: only:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment