jenkins automated deployment gitlab maven program

Deployment process: code from the pull down gitlab using maven package, the jar packetized sent to the server by SSH, the program running jar

Note: This article will need to install some plugins Publish Over SSH

1. Create a new task

In the home page click on the "New Task"

Enter the name of the task "gis-server" (whatever the name may be)

Select "Build a maven project"

determine

 

2. Configure page - source code management

2.1. Enter "Repository URL", which is the address of a code repository gitlab, for example, in FIG.

SSH Address: [email protected]: 3dgis / server3d.git

HTTP address: http: //172.16.1.144: 9000 / 3dgis / server3d.git

Note: You may wonder, without the http address this on my gitlab? This is because the site is gitlab within our company uses open source code repository gitlab build, not gitlab public warehouse public Internet.

2.2. Enter the "Credentials"

Start without the optional certificate, we need to create a new credential

Click the "Add" - "" click Jenkins ", adding credentials to enter the page, usually using the" username password "or" ssh mode "

2.2.1 for username and password (and SSH Address: [email protected]: 3dgis / server3d.git correspondence)

Select the "type" = "Username with password"

Enter your user name and password

Input Description: The username and password on gitlab (optional)

Click Add

 

2.2.1.ssh embodiment (the HTTP address: http: //172.16.1.144: 9000 / 3dgis / server3d.git correspondence)

Select the "type" = "SSH Username with private key"

Input Description: gitlab-ssh (optional)

Enter the user name and password (gitlab login user name and password)

Select Enter dirctly

输入Key,(复制windwos系统下C:\Users\peng\.ssh\id_rsa文件里的内容,这种方式需要已经将公钥C:\Users\peng\.ssh\id_rsa.pub添加进gitlab里了)

点击添加

 

 2.3.输入“Branch Specifier”

 这是输入仓库的分支,如果没有分支可选,默认为master

设置完后的样式

 

 3.配置页面-构建触发器

 选择“Build whenever a SNAPSHOT dependency is built”

 当job依赖的快照版本被build时,执行本job。

 

 4.配置页面-Build

输入“Root Pom”,(这里输入源码里pom.xml路径,源码一般被下载到“安装录目\workspace\gis-server”)

输入“Goals and options”

clean package -Dmaven.test.skip=true

 

 

 5.配置页面-Post Steps

创建Send files or execute commands over SSH

  

 

 

 创建SSH Server

系统管理->系统设置->Publish over SSH->新增

 source files应该怎么写,可以点击后面的“?”查看,他有个指引连接,http://ant.apache.org/manual/dirtasks.html#patterns

 

 Exec command 里的gis-server.sh文件可以参考另一篇博客:https://www.cnblogs.com/SmilingEye/p/11341595.html

 

Guess you like

Origin www.cnblogs.com/SmilingEye/p/11345912.html