gitlab & jenkins & tomcat

  

JDK:

  1. jdk下载网址:https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
  2. JAVA_HOME ==> C:\Program Files\Java\jdk-14.0.1
  3. CLASSPATH ==> .,%JAVA_HOME%\lib
  4. PATH ==> %JAVA_HOME%\bin
  5. IDEA部署tomcat

https://blog.csdn.net/czc9309/article/details/80304074

 

 

Tomcat:

  1. CATALINA_HOME ==> C:\Program Files\apache-tomcat-9.0.36
  2. PATH ==> %CATALINA_HOME%\bin
  3. apache-tomcat-9.0.36 ==> Properties ==> security ==> Users ==> Full control    否则404
  4. catalina.bat start

 

 

gitlab:

  1. /etc/gitlab/gitlab.rb
  2. external_url 'http://IP:888'
  3. nginx['listen_port']=888
  4. gitlab-ctl reconfigure
  5. gitlab-ctl restart
  6. firewall-cmd --zone=public --permanent --add-port=82/tcp
  7. firewall-cmd reload
  8. root   ==>   password
  9. create group ==> notary_group
  10. create project ==> notary_group/web_demo(private)
  11. create user ==> artifact1(regular)
    add artifact1 to web_demo
    • Guest: create issue,leave comment,can not clone or download the project code
    • Reporter: clone download the project code,can not submit
    • Developer: normal developer
    • Maintainer: core developer
  12. VCS ==> Enable Version Control Intergration ==> git
  13. project ==> git ==> add(本地缓存区)
  14. project ==> git ==> commit(本地仓库)
  15. project ==> git ==> Repository ==> Remotes ==> Add gitlab http://192.168.8.6:888/notary_group/web_demo.git
  16. project ==> git ==> Repository ==> Push

 

 

 

Jenkins:

 

 

配置文件/etc/sysconfig/jenkins

启动脚本/etc/rc.d/init.d/jenkins

JENKINS_USER="jenkins"

JENKINS_PORT="8080"

镜像加速:

sed -ri -e 's@http://updates.jenkins-ci.org/download@https://mirrors.tuna.tsinghua.edu.cn/jenkins@g' -e 's@http://www.google.com@http://www.baidu.com@g' default.json

Update Site:      https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

 

Plugin1: Role-based Authorization Strategy

 

Configure Global Security ==> Authorization ==> Role-Based Strategy

Manage and Assign Roles ==> Manage Roles:

 

 

 

 

 

 

1
2
3
4
5
Global roles:  baseRole (Overall => read)
 
Item roles:      role1(Pattern:  project1.*)
 
Item roles:      role2(Pattern:  project2.*)

Manager Users ==> create user ==> user1 & user2  

Manage and Assign Roles ==> Assign Roles   

 

 

 

Plugin2: Credentials Binding

 

Plugin3: git

Plugin4: 

  1. JAVA_HOME=/usr/lib/jvm/java

 

 

  1. MAVEN_HOME=/usr/local/maven
  2. PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
  3. mvn -v && java -version
  4. Global Tool Configuration:   JDK && MAVEN
  5. Confiugre System ==> Global properties ==> Environmen variables
1
2
3
4
5
JAVA_HOME ==> /usr/lib/jvm/java
 
M2_HOME ==> /usr/local/maven
 
PATH+EXTRA ==> $M2_HOME/bin

  

1
2
3
4
5
6
7
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
<localRepository>/usr/local/maven/repo</localRepository>         #注意repo目录权限

https://developer.aliyun.com/mirror/maven?spm=a2c6h.13651102.0.0.3e221b11SMxdFv

 

Build ==> Execute shell ==> echo 'start build';mvn clean package;echo 'build complete'

Tomcat:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
conf/tomcat-users.xml
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,tomcat,admin-gui,admin-script"/>
</tomcat-users>
 
 
webapps/manager/META-INF/context.xml
  <!--
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
  -->

  

Plugin:5 Deploy To Container

Post-build Actions:

Deploy war/ear to a container ==> WAR/EAR ==> target/*.war ==> Containers ==> TomcatURL ==> http://IP:8080

 

Plugin:6 Maven intergration

build ==> Goals and options ==> clean package (无需加maven)

 

Plugin:7 pipeline

示例一:

复制代码
pipeline {
    agent any

    stages {
        stage('pull code') {
            steps {
                echo 'pull code'
            }
        }
        stage('build project') {
            steps {
                echo 'build project'
            }
        }
        stage('publish project') {
            steps {
                echo 'publish project'
            }
        }
        
    }
}
复制代码

Sample Step: pipeline syntax ==> 片段生成器

  • checkout: Checkout from version control
  • sh: Shell Script ==> mvn clean package
  • deploy: Deploy war/ear to a container

 

Pipeline ==> Pipeline script from SCM ==> SCM ==> git

 

 

 

 

 

 

 

构建触发器:

1:Trigger builds remotely

 

 2:build after other project are built

 

 

3: Poll SCM

 

 

4:  Gitlab webhook     plugin(Gitlab Gitlab Hook)

 

 

 

 

gitlab:

 

 

 

 

     

 

 

 

 

 

        

 

posted @   ascertain  阅读(198)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示