windows作为jenkins slave使用问题

 

1、windows agent 添加

1.1 ssh方式添加管理agent

安装cygwin 环境

参考 https://github.com/jenkinsci/ssh-agents-plugin/blob/main/doc/CYGWIN.md

下载安装程序

安装openssh,注意要选择版本,否则策略是跳过,倒三角图标处选择版本

下一步

 

安装cygrunsrv

 

 配置ssh

启动cygssh进程

 

Check that your firewall allow TCP port 22

Java must be available from your SSH client: for example, add a symbolic link, e.g :  cd /usr/local/bin && ln -s /cygdrive/c/Program\\ Files\\(x86\\)/Java/jre1.8.0\_211/bin/java.exe java

When you use SSH launcher to launch an agent on Cygwin-enabled Windows, you should still specify Windows style path as the remote FS root (such as c:\jenkins). This is because the agent JVM that eventually gets launched doesn't receive the Cygwin path translation. If you specify Unix style path (such as /cygdrive/c/jenkins), then Jenkins will end up trying to create both c:\jenkins (when it copies over agent.jar via SFTP) and c:\cygdrive\c\jenkins (when agent JVM actually starts and copy more files.)

If you run Jenkins on behalf of other users, you'll discover that some of your users will not understand when and where the path translation happens, and will inevitably write build scripts that break. You can explain to them what's going on, or you can surrender and use mklink to create a symlink or junction point that maps c:\cygdrive\c\jenkins to c:\jenkins. This will make those broken scripts work happily.

 

jenkins  master配置

注意路径要是windows格式反斜杠

 

账户密码就是windows的原有账户密码

 

 

 

 

 

 

 

2、Git出现“filename too long”错误处理

GIt使用了旧版本的Windows API,导致它限制文件名不能超过260个字符。所以Git的Windows客户端默认是禁用长名称支持的。我们开启长名称支持即可。

打开PowerShell或者Cmd,在命令行窗口中运行:

git config --system core.longpaths true
posted @ 2024-01-16 10:18  fanggege  阅读(79)  评论(0编辑  收藏  举报