Jenkins-部署与维护
安装Jenkins
cd /usr/local
wget http://fs.as4k.com:7778/chfs/shared/bare-metal/dp265/jdk-8u231-linux-x64.tar.gz
tar xf jdk-8u231-linux-x64.tar.gz
mv jdk1.8.0_231/ java
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -xf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 maven
echo $PATH
cat << 'EOF' >> /etc/profile
export JAVA_HOME=/usr/local/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export MAVEN_HOME=/usr/local/maven
PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
EOF
source /etc/profile
echo $PATH
java -version
mvn -version
cd /root
wget http://fs.as4k.com:7778/chfs/shared/soft/jenkins-2.204.3-1.1.noarch.rpm
rpm -ivh jenkins-2.204.3-1.1.noarch.rpm
rpm -ql jenkins
修改jenkins工作目录
[root@hkjenkins data]# cat /etc/sysconfig/jenkins | grep JENKINS_HOME
#JENKINS_HOME="/var/lib/jenkins"
JENKINS_HOME="/data/jenkins"
# permissions of $JENKINS_HOME and /var/log/jenkins.
# $JENKINS_HOME location. Do not enable this, "true", unless
id jenkins
chown -R jenkins:jenkins /data/jenkins/
ls -l /data/
systemctl start jenkins
tailf /var/log/jenkins/jenkins.log
sleep 30; systemctl status jenkins
首次登录UI密码 cat /data/jenkins/secrets/initialAdminPassword
http://localhost:8080 (localhost可换成相应的公网IP地址)
安装的时候选择安装推荐插件,然后在线等待安装完成
管理员账号密码
user: admin
pw: as4k:1801
http://jenkins.as4k.com:8080/
安装docker
mkdir /root/dpdocker && cd /root/dpdocker
wget download.as4k.com/DP_init.tgz
tar xf DP_init.tgz
bash centos.sh
构建测试
mkdir /data/xtest
chown -R jenkins:jenkins /data/xtest
su -s /bin/bash jenkins
cd /data/xtest
git clone https://github.com/as4kInc/xxrepo.git
cd /data/xtest/xxrepo
bash -x jenkins/ci/ci.sh
原有的Jenkins插件
http://jenkins.as4k.com:8080/pluginManager/installed
Pipeline: REST API
Pipeline: SCM Step
Pipeline: Shared Groovy Libraries
Pipeline: Stage Step
Pipeline: Stage Tags Metadata
SSH x
SSH Agent x
SSH Credentials x
Structs Plugin
Subversion
Timestamper
Token Macro
Workspace Cleanup
相关信息
user: admin
pw: as4k:1801
http://jenkins.as4k.com:8080/
jenkins 用户切换
sudo su -s /bin/bash jenkins
yum localinstall netcat-0.7.1-1.i386.rpm
yum install mysql git python-pip
pip install --upgrade pip
pip install shadowsocks
groupadd docker
useradd -d /data/jenkins
usermod -aG docker jenkins
chown -R jenkins.jenkins /data/jenkins
chown root.docker /var/run/docker.sock
chmod +w /etc/sudoers
vim /etc/sudoers
jenkins ALL=(ALL) NOPASSWD:ALL
chmod -w /etc/sudoers
jenkins用户的免密
安装java和maven
jenkins用户登录registry.as4k.com
docker login registrt.as4k.com -uroot -pas4k123
# 设置ss
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
# 设置代理(不好使)
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
# 设置代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
github白名单列表(2020-01-08jenkins安全组添加白名单)
192.30.252.0/22,185.199.108.0/22,140.82.112.0/20
参考资料
https://jenkins.io/doc/book/installing/#fedora
https://pkg.jenkins.io/redhat-stable/jenkins-2.204.3-1.1.noarch.rpm
jenkins插件网站
http://updates.jenkins-ci.org/download/plugins/
http://mirror.xmission.com/jenkins/plugins/
安装maven
https://www.cnblogs.com/jimisun/p/8054819.html
jenkins版本下载地址
https://pkg.jenkins.io/redhat-stable/
jenkins搭建
https://www.linuxidc.com/Linux/2015-06/118606.htm
http://www.showerlee.com/archives/1880
jenkins主从配置
https://blog.csdn.net/ruangong1203/article/details/78687450
https://blog.csdn.net/zhu_tianwei/article/details/68277374
jenkins开放github地址的白名单
https://help.github.com/en/github/authenticating
-to-github/about-githubs-ip-addresses(点击meta)
https://api.github.com/meta
https://pkg.jenkins.io/redhat-stable/
https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
https://blog.csdn.net/xys2015/article/details/112785256