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.
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=, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:)
at java.lang.ProcessImpl.start(ProcessImpl.java:)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:)
Caused: java.io.IOException: Cannot run program "git" (in directory "/var/lib/jenkins/caches/git-c25d623df84deea801370f6c265e18c9"): error=, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:)
at hudson.Proc$LocalProc.<init>(Proc.java:)
at hudson.Proc$LocalProc.<init>(Proc.java:)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:)
at hudson.Launcher$ProcStarter.start(Launcher.java:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:)
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:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$.execute(CliGitAPIImpl.java:)
Caused: hudson.plugins.git.GitException: Could not init /var/lib/jenkins/caches/git-c25d623df84deea801370f6c265e18c9
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$.execute(CliGitAPIImpl.java:)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.init(CliGitAPIImpl.java:)
at hudson.plugins.git.GitAPI.init(GitAPI.java:)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:)
at hudson.model.ResourceController.execute(ResourceController.java:)
at hudson.model.Executor.run(Executor.java:)
Finished: FAILURE 解决方法: 系统设置,全局工具设置,更改git的位置。

3.没有安装saltstack插件

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

Jenkins Pipeline高级用法-ShareLibrary的更多相关文章

  1. Jenkins高级用法 - Pipeline 安装

    一.总体介绍 总体介绍内容摘自 玩转Jenkins Pipeline(大宝鱼) 1.核心概念 Pipeline,简而言之,就是一套运行于Jenkins上的工作流框架,将原本独立运行于单个或者多个节点的 ...

  2. Jenkins高级用法 - Jenkinsfile 介绍及实战经验

    系列目录 1.Jenkins 安装 2.Jenkins 集群 3.Jenkins 持续集成 - ASP.NET Core 持续集成(Docker&自由风格&Jenkinsfile) 4 ...

  3. jenkins2 pipeline高级

    jenkins2 pipeline里groovy的高级用法.翻译自:https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL. ...

  4. 基于Jenkins Pipeline的ASP.NET Core持续集成实践

    最近在公司实践持续集成,使用到了Jenkins的Pipeline来提高团队基于ASP.NET Core API服务的集成与部署效率,因此这里总结一下. 一.关于持续集成与Jenkins Pipelin ...

  5. Jenkins pipeline:pipeline 使用之语法详解

    一.引言 Jenkins 2.0的到来,pipline进入了视野,jenkins2.0的核心特性. 也是最适合持续交付的feature. 简单的来说,就是把Jenkins1.0版本中,Project中 ...

  6. 转~Jenkins pipeline:pipeline 使用之语法详解

    一.引言 Jenkins 2.0的到来,pipline进入了视野,jenkins2.0的核心特性. 也是最适合持续交付的feature. 简单的来说,就是把Jenkins1.0版本中,Project中 ...

  7. Jenkins pipeline 入门到精通系列文章

    Jenkins2 入门到精通系列文章. Jenkins2 下载与启动jenkins2 插件安装jenkins2 hellopipelinejenkins2 pipeline介绍jenkins2 jav ...

  8. Jenkins pipeline:pipeline 语法详解

    jenkins  pipeline 总体介绍 pipeline 是一套运行于jenkins上的工作流框架,将原本独立运行于单个或者多个节点的任务连接起来,实现单个任务难以完成的复杂流程编排与可视化. ...

  9. Jenkins pipeline 语法详解

    原文地址http://www.cnblogs.com/fengjian2016/p/8227532.html pipeline 是一套运行于jenkins上的工作流框架,将原本独立运行于单个或者多个节 ...

随机推荐

  1. Windows服务System权限下在当前用户桌面创建快捷方式C#实例程序

    Windows服务一般运行在System权限下,这样权限比较高,方便执行一些高权限的操作. 但是,Environment.GetFolderPath等函数获取的也是System用户下的,而不是当前用户 ...

  2. c++预声明类引发的无法解析外部符号问题

    在VisualStudio下开发C++程序常遇到链接问题就是:LNK2019 无法解析外部符号. 这个问题一般我们认为是没有将引用的代码链接到当前项目造成,也有例外,就是下面我要说的预声明类导致的. ...

  3. Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Proxy7解决方法

    报错 三月 07, 2017 8:09:52 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepare ...

  4. 前后端分离djangorestframework——权限组件

    权限permissions 权限验证必须要在认证之后验证 权限组件也不用多说,读了源码你就很清楚了,跟认证组件很类似 具体的源码就不展示,自己去读吧,都在这里: 局部权限 设置model表,其中的ty ...

  5. 【PAT】B1011 A+B 和 C

    注意数据的范围,使用long long就行了 #include<stdio.h> int main(){ int N;scanf("%d",&N); for(i ...

  6. 我的第一个SolidWorks图

    1. 学习到的知识点 2. 完成的工程图 3. 感受 学习是一种快乐,学到新的知识要学会分享,只要坚持,就有那么一点点的成就. 4. 参考 SolidWorks帮助文档

  7. 《Java大学教程》—第11章 案例研究--第1部分

    自测题:1.    图11-1的UML设计中各个类之间的关系.Hostel与TenantList是关联关系:TenantList和PaymentList与ObjectList是泛化关系.TenantL ...

  8. 12.scrapy框架之递归解析和post请求

    今日概要 递归爬取解析多页页面数据 scrapy核心组件工作流程 scrapy的post请求发送 今日详情 1.递归爬取解析多页页面数据 - 需求:将糗事百科所有页码的作者和段子内容数据进行爬取切持久 ...

  9. C#字节数组与字符串转换

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  10. 设计模式のStrategyPattern(策略模式)----行为模式

    一.问题产生背景 当我们进行一系列处理时(员工工资核算,会员管理,计算器,优惠活动),会有很多相似的算法和处理过程,只是由于具体的算法的差异,导致必须不同处理.这些处理和客户端无关,我们可以把这些算法 ...