Commit 3a07a752 authored by luchaowu's avatar luchaowu

update ci

parent da2d20c5
variables:
# 构建后的镜像名
DEPLOY_DOCKER_NAME: harbor.int.yidian-inc.com/open-tech/open-$CI_PROJECT_NAME-pipeline-$CI_PIPELINE_ID-image
PORT: "8055"
# 定义 stages
stages:
#- install_deps
#- build
- assemble
- deploy
- over
build_docker:
stage: assemble
before_script:
- docker login -u harbor_ops -p pssreO3P2S1., harbor.int.yidian-inc.com
script:
- ls -la
- pwd
- npm run web-build
- docker ps
- docker build -t $DEPLOY_DOCKER_NAME .
- docker push $DEPLOY_DOCKER_NAME
tags:
- superfe_docker
when: manual
#services:
# - docker:dind
only:
- web
deploy_test:
stage: deploy
dependencies:
- build_docker
script:
- export CONTAINER_NAME_PREFIX="open-$CI_PROJECT_NAME-test-$PORT"
# 移除旧版本container
- bash deploy/remove_old_docker.sh $CONTAINER_NAME_PREFIX
- docker pull $DEPLOY_DOCKER_NAME
- docker run -d -t -i -e TZ=Asia/Shanghai --name $CONTAINER_NAME_PREFIX-$CI_JOB_ID-image --net=host -p $PORT:$PORT $DEPLOY_DOCKER_NAME /bin/sh -c "cd /home/worker/opservice.yidian-inc.com/htdocs && pm2 start pm2-test.json"
#- bash deploy/check_port.sh $PORT
tags:
- 11_shell
environment:
name: test
url: http://venus.int.yidian-inc.com:$PORT
when: manual
only:
- web
report_success:
stage: over
dependencies:
- deploy_test
script:
- sh deploy/dingdingrobot.sh "gitlab-ci pipeline【成功】" "#### 【$GITLAB_USER_NAME】 triggered pipeline [$CI_PROJECT_NAME - $CI_PIPELINE_ID]($CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID) on branch [$CI_COMMIT_REF_NAME], Deployed to [http://venus.int.yidian-inc.com:$PORT](http://venus.int.yidian-inc.com:$PORT)"
tags:
- superfe_shell
when: manual
only:
- web
# report_error:
# stage: over
# script:
# - sh deploy/dingdingrobot.sh "gitlab-ci pipeline【失败】" "pipeline run failed:[$CI_PROJECT_NAME - $CI_PIPELINE_ID]($CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID) "
# tags:
# - 10_103_35_79_shell
# when: on_failure
\ No newline at end of file
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