Jenkins Linux Agent 设置

准备 Java 运行环境

检查是否安装了 Java

# 执行如下命令
$ java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

如果没有安装,查看这篇文章教你如何安装

新建 Node

Jenkins 首页->Manage Node->New Node

Linux agent 设置,例如:

Items Settings
Name Linux-build-machine
Description used for Linux build
of executors 1
Remote root directory /home/agent
Labels Linux, build
Usage Use this node as much as possible
Launch method Launch agent agents via SSH
Host 192.168.1.112
Credentials username/password
Host Key Verification Strategy Manually trusted key Verification Strategy
Availability Keep this agent online as much as possible

设置 credentials

credentials configuration
Domain Global credentials (unrestricted)
Kind Username with password
Scope Global(Jenkins, nodes, items, all child items, etc)
Username root
Password mypassword
Description Linux agent username & password

保存然后连接

Remoting version: 3.29
This is a Unix agent
Evacuated stdout
Agent successfully connected and online
SSHLauncher{host='192.168.1.112', port=22, credentialsId='d1cbab74-823d-41aa-abb7-8584859503d0', jvmOptions='', javaPath='/usr/bin/java',
prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15,
sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[05/11/19 01:33:37] [SSH] Opening SSH connection to 192.168.1.112:22.
[05/11/19 01:33:37] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
[05/11/19 01:33:37] [SSH] Authentication successful.
[05/11/19 01:33:37] [SSH] The remote user's environment is:

解决问题

问题 如何解决
[04/22/19 23:15:07] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file. ssh-keyscan HOSTNAME >> known_hosts
/var/lib/jenkins/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/lib/jenkins/.ssh/known_hosts. changing the Host key verification strategy in LAUNCH METHOD from "Known Hosts file verification strategy" to "Manually trusted key verification strategy"
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,418评论 0 10
  • =========================================================...
    _灯火阑珊处阅读 2,448评论 0 3
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,906评论 0 0
  • 基于CentOS 6.5 服务器上已装 JDK ,Tomcat 。 1. 在Linux服务器上下载安装Jenki...
    LeonardoEzio阅读 1,519评论 1 0
  • 勿待泪流 勿待追忆 勿待一切的一切成为泡影 曾想我就是我 却不想这只是一个奢求 曾想我不去改变 却发现时时都在改变...
    梦落凡尘阅读 363评论 0 1