一·、全局工具配置
一、JDK 配置
which java
/usr/local/java/bin/java ####查看JDK安装路径
二、mvnen配置
which maven
/usr/bin/which: no maven in (/data/maven/apache-maven-3.8.6/bin:/usr/local/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/u
sr/bin:/root/bin)
新建任务
无法连接仓库:Command "git ls-remote -h git@192.168.190.172:root/my_procent_project.git HEAD" returned status code 128: stdout: stderr: Host key verification failed. fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Credentials?
需要在全局凭据中添加jenkins 的私钥 若是没有安装git 需要安装git
yum -y install git
whereis git
三、git 配置
Git Parameter
这是一个参数构建扩展,可以在构建的时候选择git的某一个分支来构建服务。
在参数化构建步骤当中,可添加Git的branch或者tag来作为参数进行构建
四、插件 Publish over SSH使用
jenkins自动部署,可能存jenkins在服务器A,代码部署在服务器B,这时候会将代码拉到A服务器,在推给B服务器,就需要使用Send build artifacts over SSH 插件
Send build artifacts over SSH插件
这个插件是jenkins连接linux系统的时候使用
插件名:Publish over SSH
查看插件并进行安装
系统配置中找到 SSH Servers
配置 服务器的账号密码,指定路径。
构建
工作区路径:/var/lib/jenkins/workspace/centos_project/traget/
Deploy to container Plugin
subversion plugin-in
ssh