Skip to content

Commit 9b1a441

Browse files
committed
doc: update jenkins document.
1 parent 997534c commit 9b1a441

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

docs/jenkins/README.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ docker compose down # 停止并删除与 Docker Compose 配置文件相关的
100100

101101
<img src="./imgs/0-3.png" width="620" />
102102

103-
## 2. 添加凭证
103+
## 2. 添加凭据
104104

105105
<img src="./imgs/1.png" width="620" />
106106

@@ -110,6 +110,14 @@ docker compose down # 停止并删除与 Docker Compose 配置文件相关的
110110

111111
<img src="./imgs/4.png" width="620" />
112112

113+
添加 `SSH` 和 `SCP` 需要的凭据
114+
115+
<img src="./imgs/4-1.png" width="620" />
116+
117+
`ssh-keygen -t rsa` 生成 `id_rsa` 和 `id_rsa.pub` 文件,将 `id_rsa` 私钥文本复制到 `jenkins` 中
118+
119+
<img src="./imgs/4-2.png" width="620" />
120+
113121
## 3. 新建工作流
114122

115123
<img src="./imgs/5.png" width="620" />
@@ -177,19 +185,19 @@ pipeline {
177185
}
178186
}
179187
environment {
180-
def git_url="http://152.22.3.186:8081/mall/h5.git"
181-
def git_auth = "12312312-f199-4b15-b087-123123"
182-
def git_branch = "${branch}"
183-
def project_env = "${project_env}"
184-
def data_dir = "/mnt/mall/h5/h5_vip"
185-
186-
// 本地需要上传的目录 以及远程服务器的目录
187-
def localDir = "${WORKSPACE}/h5_vip/test_dir/"
188-
def vip_host = '152.22.3.186'
189-
def vip_remote_dir = "/mnt/mall/h5"
188+
def git_url="http://152.22.3.186:8081/mall/h5.git"
189+
def git_auth = "12312312-f199-4b15-b087-123123"
190+
def git_branch = "${branch}"
191+
def project_env = "${project_env}"
192+
def data_dir = "/mnt/mall/h5/h5_vip"
193+
194+
// 本地需要上传的目录 以及远程服务器的目录
195+
def localDir = "${WORKSPACE}/h5_vip/test_dir/"
196+
def vip_host = '152.22.3.186'
197+
def vip_remote_dir = "/mnt/mall/h5"
190198
}
191199
stages {
192-
stage('Git Checkout'){
200+
stage('Git Checkout') {
193201
steps {
194202
echo "🏆 WORKSPACE: 【${WORKSPACE}】"
195203
echo "🎯 branch: 【${git_branch}】"
@@ -210,16 +218,15 @@ pipeline {
210218
sh 'ls -la'
211219
}
212220
}
213-
}
214221
stage('Send Files') {
215222
when {
216223
expression {
217224
currentBuild.result == null || currentBuild.result == 'SUCCESS'
218225
}
219226
}
220-
steps {
227+
steps {
221228
sh 'pwd'
222-
script{
229+
script {
223230
switch (project_env) {
224231
case "vip":
225232
sh '''
@@ -247,7 +254,6 @@ pipeline {
247254
// sh "scp -r -o StrictHostKeyChecking=no -i /var/lib/jenkins/.ssh/id_rsa -P 22 '${WORKSPACE}/h5_vip/' '$i:${data_dir}'"
248255
// }
249256
break
250-
251257
}
252258
}
253259
}

docs/jenkins/imgs/4-1.png

181 KB
Loading

docs/jenkins/imgs/4-2.png

208 KB
Loading

0 commit comments

Comments
 (0)