首页 > 其他分享 >Jenkins Pipeline 流水线 - 添加节点 使用代理

Jenkins Pipeline 流水线 - 添加节点 使用代理

时间:2022-11-01 17:47:16浏览次数:65  
标签:11 Pipeline 01 java 22 URLClassLoader version 流水线 Jenkins

Jenkins 安装在 Windows 上
Docker 在Linux 上

流程

  • 将 Docker 在 Jenkins 节点中维护
  • Pipeline 中指定某些阶段使用哪个节点

添加节点

image
image
image
image
image

Checking Java version in the PATH
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
[11/01/22 15:47:11] [SSH] Checking java version of /opt/jenkins/jdk/bin/java
Couldn't figure out the Java version of /opt/jenkins/jdk/bin/java
bash: /opt/jenkins/jdk/bin/java: 娌℃湁閭d釜鏂囦欢鎴栫洰褰?

[11/01/22 15:47:11] [SSH] Checking java version of java
[11/01/22 15:47:11] [SSH] java -version returned 1.8.0_345.
[11/01/22 15:47:11] [SSH] Starting sftp client.
[11/01/22 15:47:12] [SSH] 正在拷贝最新版本的 remoting.jar...
Source agent hash is 8D575C4C8219E6AB2039295EC545C6C3. Installed agent hash is 8D575C4C8219E6AB2039295EC545C6C3
Verified agent jar. No update is necessary.
Expanded the channel window size to 4MB
[11/01/22 15:47:12] [SSH] Starting agent process: cd "/opt/jenkins" && java  -jar remoting.jar -workDir /opt/jenkins -jar-cache /opt/jenkins/remoting/jarCache
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Agent JVM has terminated. Exit code=1
[11/01/22 15:47:12] Launch failed - cleaning up connection
[11/01/22 15:47:12] [SSH] 连接关闭。

image
image
image

Pipeline 指定节点执行

pipeline {
    agent none // stage 中指定了agent 这边必须使用 none 不指定
 
    stages { 
        stage('执行构建') {
            agent {	label 'DockerAgent-label' }  //这边使用节点名称或节点标签,都可以运行
            steps {
                sh 'docker --version' 
                echo '构建完成'
            }
        }
    }
}

image

标签:11,Pipeline,01,java,22,URLClassLoader,version,流水线,Jenkins
From: https://www.cnblogs.com/vipsoft/p/16848538.html

相关文章

  • Jenkins Pipeline 流水线 - 拉代码(SVN) + Maven 编译打包
    JenkinsPipeline流水线步骤拉取SVN代码->Maven构建->Docker编译->发布至阿里云仓库->K8S更新Jenkins插件安装Localization:Chinese(Simplified)Subve......
  • Jenkins Blue Ocean
    介绍BlueOcean是pipeline的可视化UI。同时兼容经典的自由模式的job。JenkinsPipeline从头开始设计,但仍与自由式作业兼容,BlueOcean减少了经典模式下的混乱并为团......
  • Jenkins Pipeline 流水线-Demo
    JenkinsPipeline流水线流水线既能作为任务的本身,也能作为Jenkinsfile使用流水线可以让我们的任务从UI手动操作,转换为代码化,像dockerfile一样。从shell命令到配置文......
  • gitlab+jenkins+harbor+k8s部署微服务-准备工作
    DevOps,字面意思是Development&Operations的缩写,也就是开发&运维。一、Code阶段工具在code阶段,我们需要将不同版本的代码存储到一个仓库中,常见的版本控制工具就是SVN或者......
  • Jenkins Pipeline
    内置支持片段生成器:http://localhost:8080/pipeline-syntax/ConceptJenkinsPipelineisasuiteofpluginswhichsupportsimplementingandintegratingcontinuousdel......
  • Jenkins Plugin Developer Guide
    Plugintutorial​​Plugintutorial​​重要接口ExtensionPoint&Describable:apluginmaysimplyimplementextensionpoints,[email protected]......
  • Jenkins Kubernetes Plugin
    JenkinsKubernetesPlugintorundynamicagentsinaKubernetescluster.BasedontheScalingDockerwithKubernetesarticle,automatesthescalingofJenkinsag......
  • Jenkins pipeline Git 检出的 Step
    在Jenkins中,可以使用下面的定义来检出需要编译的代码。stage("PullSourceCode"){steps{gitbranch:'main',credentialsId:'d8a95129-......
  • Jenkins配置JDK和Maven
    一、进入全局工具配置   二、新增JDK      三、登录oracle账号密码账号密码已经给你们准备好了:账号:[email protected]密码:Oracle123   ......
  • war包形式安装jenkins
    (1)下载war包  输入命令:java-jarjenkins.war--httpPort=8080,更改端口  重新登录之后,输入密码创建用户等完成设置 (2)结合Tomcat安装:  将jenkins.war放在tom......