`
sillycat
  • 浏览: 2564674 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Jenkins 2019 in Docker(2)Set Up Some Tools and Projects

 
阅读更多
Jenkins 2019 in Docker(2)Set Up Some Tools and Projects
Set Up User
Go to ‘Manage Jenkins’ —> ‘Configure Global Security’ —> enable sign up and give the user permissions one by one
Set Up Tools
Go to ‘Manage Jenkins’ —> ‘Global Tool Configuration’
I found I may need JDK 10 for Jenkins to support my projects.
Website to download JDK10
https://jdk.java.net/java-se-ri/10
wget https://download.java.net/openjdk/jdk10/ri/openjdk-10+44_linux-x64_bin_ri.tar.gz -P install/
I follow this step install openJDK 10 on Docker
#install the software
RUN yum -y update
RUN yum install -y freetype
RUN      mkdir -p /tool/
#install /tool/jdk-10
ADD        install/openjdk-10+44_linux-x64_bin_ri.tar.gz /tool/
WORKDIR /tool/
ENV JAVA_HOME /tool/jdk-10
ENV PATH="${JAVA_HOME}/bin:${PATH}"
But it seems not working for jenkins.
I directly run this command with my oracle jdk, it works fine.
> java --add-modules java.xml.bind -jar install/jenkins.war --enable-future-java
We can always download the Oracle JDK here
https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase10-4425482.html
Here is the start.sh
#!/bin/sh -ex
cd /tool/
java -Duser.home=/var/jenkins_home --add-modules java.xml.bind -jar jenkins.war \
     --enable-future-java
Here is the Dockerfile
#Set Up Jenkins CI
#Prepre the OS
FROM centos:7
MAINTAINER Yiyi Kang <yiyikangrachel@gmail.com>
#install the software
RUN yum -y update
RUN yum install -y freetype
RUN yum install -y git
RUN yum install -y wget make
RUN      mkdir -p /tool/
#install /tool/jdk-10
ADD        install/jdk-10.0.2_linux-x64_bin.tar.gz /tool/
WORKDIR /tool/
ENV JAVA_HOME /tool/jdk-10.0.2
ENV PATH="${JAVA_HOME}/bin:${PATH}"
#install jenkins
ADD        install/jenkins.war /tool/
#start the application
EXPOSE  8080 50000
RUN     mkdir -p /app/
ADD     start.sh /app/
WORKDIR /app/
CMD    [ "./start.sh" ]
After that, I directly configure
JDK Name: jdk10.0.2
       JAVA_HOME: /tool/jdk-10.0.2
Git       Name: Git1.8
Gradle Name: Gradle5.1.1 install automatically
Ant      Name: Ant1.10.5 install automatically
Maven Name: MAVEN3.6.0 install automatically
Set Up TimeZone for Jenkins
Lis the timezone in America
> sudo timedatectl list-timezones | grep America
Austin is the same as Chicago
> sudo timedatectl set-timezone America/Chicago
> date
Fri Jan 25 09:16:08 CST 2019
Add this to start.sh in Jenkins
#!/bin/sh -ex
cd /tool/
java -Duser.home=/var/jenkins_home \
     -Duser.timezone=America/Chicago \
     --add-modules java.xml.bind \
     -jar jenkins.war \
     --enable-future-java

If any permission issue happens
> sudo chmod -R 777 ./jenkins_home
Check every 5 minutes
H/5 * * * *

References:
https://www.jianshu.com/p/0391e225e4a6
https://www.server-world.info/en/note?os=CentOS_7&p=jdk11&f=2
https://jenkins.io/blog/2018/06/17/running-jenkins-with-java10-11/
https://tecadmin.net/install-java-non-lts-on-centos/
https://www.mysterydata.com/how-to-install-java-10-on-centos-rhel-7-6-based-system/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics