minion java上传文件_Jenkins Pipeline高级用法-ShareLibrary

本文介绍了如何在Jenkins中配置并使用SaltStack插件,包括GitHub上的Jenkinsfile配置、Jenkins中的SaltStack插件安装及配置过程,并解决了配置过程中遇到的一些常见问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Github配置

1.1 上传jenkinsfile到github

https://github.com/zeyangli/ShareLibrary-jenkins.git

d5bf1a7878922ea56e75c1e5cc93e90c.png

2.Jenkins配置

2.1 添加gitlab凭据

凭据管理-->凭据-->系统 -->添加凭据

d900c2b35f3f64e82b91f58f885b6da2.png

2.2 ShareLibrary配置

系统管理-->系统设置-->Global Pipeline librarys

5c87e50df3255343a15ba601d850c0d4.png

2.3 安装插件

saltstack

ansicolor

3.发布配置

3.1 master安装salt-master salt-api

yum -y install salt salt-master salt-api

vim /etc/salt/master #添加以下内容 salt 2015.5.10

rest_cherrypy:

port: 9000

disable_ssl: True

external_auth:

pam:

saltapi:

- .*

- '@wheel'

- '@runner

file_roots:

base:

- /srv/salt

service salt-master start

service salt-apo start

useradd saltapi

passwd saltapi  #123456

3.2 应用服务器部署salt-minion

yum -y install salt-minionecho "master: 10.10.1.1" > /etc/salt/minion

3.2 测试

salt-key -L

salt-key -a xxxxxxx

salt xxx test.ping

curl http://127.0.0.1:9000/login -d username='saltapi' -d password='123456' -d eauth='pam'

{"return": [{"perms": [".*", "@wheel", "@runner"], "start": 1552134573.2227211, "token": "fa089bbd2c641a3136b2fb3bf305ab5111c54343", "expire": 1552177773.2227211, "user": "saltapi", "eauth": "pam"}]}[root@VM_7_14_centos auth]#

FAQ

1.[更新Git版本]centos6 默认yum装的git 版本1.7.1 太低了导致出错。

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

wget https://github.com/git/git/archive/v2.3.0.zip

unzip v2.3.0.zip

cd git-2.3.0make prefix=/usr/local/git all

vim/etc/profile

export PATH=/usr/local/git/bin:$PATH

source/etc/profile

2.[重新安装Git,项目构建出错]

Started by user admin

java.io.IOException: error=2, No such fileor directory

at java.lang.UNIXProcess.forkAndExec(Native Method)

at java.lang.UNIXProcess.(UNIXProcess.java:247)

at java.lang.ProcessImpl.start(ProcessImpl.java:134)

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

Caused: java.io.IOException: Cannot run program"git" (in directory "/var/lib/jenkins/caches/git-c25d623df84deea801370f6c265e18c9"): error=2, No such fileor directory

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

at hudson.Proc$LocalProc.(Proc.java:249)

at hudson.Proc$LocalProc.(Proc.java:218)

at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)

at hudson.Launcher$ProcStarter.start(Launcher.java:455)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2038)

Caused: hudson.plugins.git.GitException: Error performing command: git init/var/lib/jenkins/caches/git-c25d623df84deea801370f6c265e18c9

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2049)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:811)

Caused: hudson.plugins.git.GitException: Could not init/var/lib/jenkins/caches/git-c25d623df84deea801370f6c265e18c9

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:813)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.init(CliGitAPIImpl.java:286)

at hudson.plugins.git.GitAPI.init(GitAPI.java:217)

at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:324)

at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)

at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)

at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)

at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)

at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)

at hudson.model.ResourceController.execute(ResourceController.java:97)

at hudson.model.Executor.run(Executor.java:429)

Finished: FAILURE

解决方法: 系统设置,全局工具设置,更改git的位置。

3.没有安装saltstack插件

java.lang.NoSuchMethodError: No such DSL method 'salt' found among steps

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值