日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Jenkins Pipeline高级用法-ShareLibrary

發布時間:2024/7/5 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Jenkins Pipeline高级用法-ShareLibrary 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

1.Github配置

1.1 上傳jenkinsfile到github

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

?

2.Jenkins配置

2.1 添加gitlab憑據

憑據管理-->憑據-->系統 -->添加憑據

?

2.2 ShareLibrary配置

系統管理-->系統設置-->Global Pipeline librarys

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-minion echo "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.0 make 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 file or directoryat java.lang.UNIXProcess.forkAndExec(Native Method)at java.lang.UNIXProcess.<init>(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 file or directoryat java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)at hudson.Proc$LocalProc.<init>(Proc.java:249)at hudson.Proc$LocalProc.<init>(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-c25d623df84deea801370f6c265e18c9at 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-c25d623df84deea801370f6c265e18c9at 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

?

轉載于:https://www.cnblogs.com/mascot1/p/10502768.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Jenkins Pipeline高级用法-ShareLibrary的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。