Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
customer-recall
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tools
customer-recall
Commits
4e3549f2
Commit
4e3549f2
authored
Aug 10, 2025
by
罗启
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update .gitlab-ci.yml
parent
0be910a6
Pipeline
#3148
passed with stage
in 1 minute 16 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
.gitlab-ci.yml
+7
-19
No files found.
.gitlab-ci.yml
View file @
4e3549f2
# 定义工作流的各个阶段
# .gitlab-ci.yml
stages
:
-
deploy
# 定义一个名为 "deploy_to_production" 的任务
deploy_to_production
:
deploy_to_production
:
# 将这个任务归属到 "deploy" 阶段
stage
:
deploy
stage
:
deploy
# 指定运行此任务的 Docker 镜像
image
:
alpine:latest
image
:
alpine:latest
# 在主脚本运行前执行的准备工作
# --- 在这里添加 tags 部分 ---
tags
:
-
jarvis
# 指定使用带有 "jarvis" 标签的 Runner
# ---------------------------
# before_script, script, only 这些部分保持不变
before_script
:
before_script
:
-
'
which
ssh-agent
||
(
apk
add
--update
--no-cache
openssh-client
)'
-
'
which
ssh-agent
||
(
apk
add
--update
--no-cache
openssh-client
)'
-
eval $(ssh-agent -s)
-
eval $(ssh-agent -s)
...
@@ -20,25 +19,15 @@ deploy_to_production:
...
@@ -20,25 +19,15 @@ deploy_to_production:
-
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
-
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
# 任务的核心执行脚本
script
:
script
:
-
|
-
|
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST "
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST "
echo '✅ 连接服务器成功,开始执行部署脚本...'
echo '✅ 连接服务器成功,开始执行部署脚本...'
echo '进入项目目录: customer-recall'
cd customer-recall
cd customer-recall
echo '正在从 GitLab (origin) 拉取最新代码...'
git pull origin master
git pull origin master
echo '正在使用 Docker Compose 部署...'
docker compose up -d --build
docker compose up -d --build
echo '🚀 部署流程执行完毕!'
echo '🚀 部署流程执行完毕!'
"
"
# 使用 "only" 关键字来控制触发分支
# 这段配置表示,这个任务只会在 "master" 分支上运行
only
:
only
:
-
master
-
master
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment