Skip to content

Commit 89d4ce3

Browse files
author
微信公众号:储凡
authored
Merge pull request #132 from mmdapl/feat/add-jenkins
2 parents 81ac66b + 442a57b commit 89d4ce3

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

code/docker/jenkins/docker-compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ services:
1313
jenkins:
1414
image: jenkins/jenkins
1515
container_name: jenkins
16+
## 权限问题 使用root用户
17+
user: root
18+
privileged: true
1619
hostname: jenkins_dev
1720
restart: unless-stopped
1821
ports:
1922
- "6080:8080"
2023
- "6081:50000"
21-
## 文件映射
2224
volumes:
2325
- /etc/localtime:/etc/localtime:ro
2426
- $(pwd)/jenkins:/var/jenkins_home
2527
## 支持容器内使用Mac本机docker服务
26-
## - /usr/local/bin/docker:/usr/bin/docker
28+
## - /usr/bin/docker:/usr/bin/docker
2729
## - /var/run/docker.sock:/var/run/docker.sock
2830
environment:
2931
JENKINS_OPTS: "--prefix=/jenkins"
3032
JENKINS_ARGS: "--prefix=/jenkins"
31-
# 用户名
32-
user: root

scripts/.exec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ exports.execShell = async commands => {
2929
runCommands = commands
3030
}
3131

32+
// 执行多条
3233
for (let index = 0; index < runCommands.length; index++) {
3334
const command = runCommands[index]
3435
const count = index + 1
3536
console.log(`step${count}:\n${command} \nstep${count}(start): === `)
3637
// await syncExec(command)
3738
const execResult = await exec(command)
3839
// 打印输出结果
39-
console.log(execResult.stdout);
40+
// console.log(1111,execResult.stdout);
4041
console.log(`step${count}(ending): === \n`)
4142
// 指令异常,不执行后续指令,非0退出
4243
if (execResult.code !== 0) {
4344
exit(1)
4445
break;
4546
}
4647
}
47-
}
48+
}

scripts/bundle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ async function getScriptCommand() {
164164

165165

166166
;(async() => {
167-
const scriptCommand = await getScriptCommand()
168-
await execShell(scriptCommand)
167+
try{
168+
const scriptCommand = await getScriptCommand()
169+
await execShell(scriptCommand)
170+
}catch (e) {
171+
console.log('异常信息:',e)
172+
}
173+
169174
})()
170175

0 commit comments

Comments
 (0)