Commit 34dbe4e4 authored by mingyard's avatar mingyard

feat:git ci rancher 自动部署

parent 6c09e710
...@@ -7,6 +7,8 @@ variables: ...@@ -7,6 +7,8 @@ variables:
CONTENT: ${CI_COMMIT_TITLE// /-} CONTENT: ${CI_COMMIT_TITLE// /-}
VIEW_URL: "https://beta.laihua.com" VIEW_URL: "https://beta.laihua.com"
PIPELINES_URL: "https://gitlab.laihua.com/qinmingyuan/translation-server/pipelines" PIPELINES_URL: "https://gitlab.laihua.com/qinmingyuan/translation-server/pipelines"
RANCHER_ACCESS_KEY: "token-vhjc8"
RANCHER_SECRET_KEY: "x2x4lffw58mxn9pxvsc6ckbxztj25mx4vvf74c6g6dqdbqsbqfzj9w"
# 定义阶段的执行顺序 分为 3个阶段 # 定义阶段的执行顺序 分为 3个阶段
stages: stages:
...@@ -49,7 +51,12 @@ deploy_job: ...@@ -49,7 +51,12 @@ deploy_job:
only: only:
- dev - dev
script: script:
- echo "请在rancher中部署..." - echo "开始Rancher部署..."
# 根据返回的结果判断是否部署成功
- response=$(curl -s -o /dev/null -w "%{http_code}" -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
"https://rancher.laihua.com/v3/project/local:p-b6lgm/workloads/deployment:test-domestic:translation-server?action=redeploy")
- if [ "$response" -eq 200 ]; then echo "Rancher部署成功!"; else echo "Rancher部署失败!"; exit 1; fi
dependencies: dependencies:
- docker_job - docker_job
......
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