这篇文章将继续给大家介绍Jenkins Ansible GitLab持续交付平台搭建。
Jenkins Ansible GitLab持续交付平台搭建-第1篇
Jenkins Ansible GitLab持续交付平台搭建-第2篇
Jenkins Ansible GitLab持续交付平台搭建-第3篇
Jenkins Ansible GitLab持续交付平台搭建-第4篇
Jenkins Ansible GitLab持续交付平台搭建-第5篇
Jenkins Ansible GitLab持续交付平台搭建-第6篇
Jenkins Ansible GitLab持续交付平台搭建-第7篇
jenkins使用
1.jenkins插件下载:
http://updates.jenkins.io/update-center.json
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
2.jenkins中文字符设置
首先下载插件:Locale plugin
配置如下:jienkins->【系统管理】->【系统设置】->【Locale】,输入:zh_CN,这里还有很多语言,比如:en_US等都是国际化标志;
问题归纳
GitLab
- 关闭Git ssh安全认证
# git config --global http.sslverify false
- Could not resolve host
stderr: fatal: unable to access 'https://gitlab.example.com/root/ansible-playbooks.git/': Could not resolve host: gitlab.example.com; Name or service not known
在jenkins主机hosts文件添加目标DNS地址
Ansible
代码语言:javascript复制[deploy@localhost .ssh]$ ssh-copy-id -i /home/deploy/.ssh/id_rsa root@report.example.com
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: The RSA host key for report.example.com has changed,
ERROR: and the key for the corresponding IP address 172.16.87.105
ERROR: is unknown. This could either mean that
ERROR: DNS SPOOFING is happening or the IP address for the host
ERROR: and its host key have changed at the same time.
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
ERROR: It is also possible that a host key has just been changed.
ERROR: The fingerprint for the RSA key sent by the remote host is
ERROR: 38:9e:83:75:a8:d2:87:f1:d4:be:df:61:ab:47:3e:5f.
ERROR: Please contact your system administrator.
ERROR: Add correct host key in /home/deploy/.ssh/known_hosts to get rid of this message.
ERROR: Offending ECDSA key in /home/deploy/.ssh/known_hosts:7
ERROR: RSA host key for report.example.com has changed and you have requested strict checking.
ERROR: Host key verification failed.
解决:
就是把~/.ssh/known_hosts,里面源于 ioschina的那行删除,重新验证即可;
ssh-copy-id -i /home/deploy/.ssh/id_rsa root@report.example.com
jenkins
- jenkins获取GitLab链接不到仓库源码地址
解决:
把https://gitlab.example.com/root/test-repo.git 换行真实ip地址
- jenkins构建报java.io.IOException: error=2, 没有那个文件或目录Caused: java.io.IOException: Cannot run program "" (in directory "/home/deploy/.jenkins/workspace/ansible-freestyle-job"): error=2, 没有那个文件或目录
解决:
$ /bin/sh shell脚本包含空格
- chown failed: failed to look up user deploy
解决:
目标主机没有deploy用户、{{ root }}这个变量应该在配置文件里面的配的deploy因为linux下安装的所有APP都不推荐用root用户启动,所以创建一个普通用户deploy启动
- Permissions 0755 for '/home/lonecloud/.ssh/id_rsa' are too open.
解决:
chmod -R 700 ~/.ssh/