在Mac上使用Jenkins
N 人看过
安装 Jenkins
自己安装Jenkins时的一些问题记录一下
-
从官网下载Max OS X版安装包
-
点击安装包安装,先按照提示设置密码和安装推荐插件
-
第二步完成之,访问 http://localhost:8080 ,登录系统
点击Credentials菜单出现异常
java.lang.AssertionError: InstanceIdentity is missing its singleton
:
解决方法:
1.在终端中用su登录,点这里查看如何开启
2.停止Jenkins:
launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
3.编辑
/Library/Application Support/Jenkins/jenkins-runner.sh
文件:a.在文件顶部增加一行
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home"
> > b.修改最后两行为:
> >
> > ```bash
echo "/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java" $javaArgs -jar "$war" $args
exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java" $javaArgs -jar "$war" $args
4.启动Jenkins:
launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
5.访问 http://localhost:8080 ,重新登录系统
Using the CLI client
- 访问http://localhost:8080/me/configure 查看当前用户的API Token
- 访问http://localhost:8080/cli/ 查看相关命令
- 点击页面jenkins-cli.jar链接下载jar文件到指定目录,也可以直接在Jenkins目录中找:
/Users/Shared/Jenkins/Home/war/WEB-INF
- 执行命令:
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth [User ID]:[API Token] list-jobs
[User ID]:[API Token] 即上面第一步所看到的
```bash
$ java -jar jenkins-cli.jar -s http://localhost:8080/ -auth admin:Your Token list-jobs
jk_1st_job
```
参考:
[HOW TO: Start, Stop, Restart or Reload Jenkins – Mac OSx](HOW TO: Start, Stop, Restart or Reload Jenkins – Mac OSx)