jenkins 2.x案例
第一,第二章
创建pipeline项目
填入pipeline的内容
pipeline执行结果
hello world的pipeline
pipeline {
agent any
stages{
stage("build"){
steps{
echo "hello world"
}
}
}
}
增加SSH key,从SCM下载pipeline
报错
无法连接仓库:Command “git ls-remote -h – git@192.168.0.81:kubernetes/scripts.git HEAD” returned status code 128:
stdout:
stderr: No ECDSA host key is known for 192.168.0.81 and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
gitlab是pod部署的
jenkins 暂时禁用严格的主机密钥检查,结果无效,报错依旧
http请求,账号密码成功克隆
自动安装Maven,jdk
对应的pipeline
pipeline {
agent any
tools {
maven 'mvn-3.9.4'
}
stages {
stage('Build') {
steps {
//sh 'mvn clean package spring-boot:repackage'
sh 'mvn -v'
sh 'printenv' // 将环境变量打印到控制台中
}
}
}
}