This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== DevOps Practice from Alibaba Cloud ===== ==== Install Jekins ==== [[jenkins_debian_10|steps here]] ==== Install Maven ==== [[install_maven_debian_10|steps here]] ==== Install Docker ==== [[docker_debian|steps here]] ==== Configuration ==== === sudo for jenkins user === <code> usermod -aG sudo jenkins </code> Modify sudoers with visudo as follows: <code> %sudo ALL=(ALL:ALL) NOPASSWD: ALL </code> === create build path === <code> mkdir /var/lib/jenkins/build chown jenkins.jenkins /var/lib/jenkins/build </code> === Jenkins configuration === Enter to web page and follow steps as show on images: {{::shot-2020-09-03_17-06-36.jpg?800|}} {{::shot-2020-09-03_18-07-44.jpg?800|}} <code> /usr/lib/jvm/java-11-openjdk-amd64/ </code> {{::shot-2020-09-03_18-12-34.jpg?800|}} <code> /usr/share/maven/ </code> Create a new Freestyle project job: {{::shot-2020-09-03_18-19-04.jpg?800|}} {{::shot-2020-09-03_18-23-38.jpg?800|}} {{::shot-2020-09-03_18-24-51.jpg?800|}} {{::shot-2020-09-03_18-41-43.jpg?800|}} <code> #Variables JENKINS_WAR_HOME='/var/lib/jenkins/workspace/alibabadevops/target' DOCKERFILE_HOME='/var/lib/jenkins/build' HARBOR_IP='registry-intl.cn-hongkong.aliyuncs.com/coursedevops/r_coursedevops' REPOSITORIES='coursedevops/r_coursedevops' HARBOR_USER='' HARBOR_USER_PASSWD='' #Copy the newest war to docker-file directory \cp -f ${JENKINS_WAR_HOME}/MyMavenApp.war ${DOCKERFILE_HOME}/MyMavenApp.war #Delete image early version sudo docker login -u ${HARBOR_USER} -p ${HARBOR_USER_PASSWD} ${HARBOR_IP} IMAGE_ID=sudo docker images | grep ${REPOSITORIES}| awk '{print $3}' if [ -n "{IMAGE_ID}"];then sudo docker rm ${IMAGE_ID} fi #Build image cd ${DOCKERFILE_HOME} TAG=$(date +%Y%m%d-%H%M%s) sudo docker build -t ${HARBOR_IP}/${REPOSITORIES}:${TAG} . #Push to the harbor registry sudo docker push ${HARBOR_IP}/${REPOSITORIES}:${TAG} </code> ==== Install Terraform ==== [[terraform_debian|steps here]]