Unity Jenkins打包(3) Pipeline

Jenkins Pipeline 官方文档 https://jenkins.io/doc/book/pipeline/

1. 创建一个Pipeline项目 Getting Started with Pipeline

1.1 前提 prerequisites:Jenkins 2.x以上+Pipeline plugin(已包含在推荐的插件中)
1.2 创建Pipline项目步骤 Defining a Pipeline in the Web UI

2. pipeline script 语法

2.1 pipeline script与 Groovy语言有点关系. 可以简单看一下语法 Groovy syntax.
2.2 Pipeline Syntax可以生成代码
2.3 Using a Jenkinsfile包含一些例子,node /stage/sh/Deploy 的currentBuild.result == null || currentBuild.result == 'SUCCESS'

3. 执行pipeline script

Jenkins job执行pipeline script,有两种方式:

  1. By entering a script directly in the Jenkins web UI,直接在Script输入框(web UI)里面输入pipeline script,语法参考Pipeline Syntax。
Unity Jenkins打包(3) Pipeline_第1张图片
pipeline_script.png
  1. pipeline script from SCM,脚本文件要存放在Git/SVN工程地址下。脚本名字默认叫Jenkinsfile,在Git/SVN工程根目录下。Script Path可配置。测试使用:github UnityJenkins工程地址

Relative location (/-separated regardless of platform) within the checkout of your Pipeline script. Note that it will always be run inside a Groovy sandbox. Jenkinsfile is conventional and allows you to switch easily to a multibranch project (just use checkout scm to retrieve sources from the same location as is configured here).

Unity Jenkins打包(3) Pipeline_第2张图片
pipeline_scm.png
Unity Jenkins打包(3) Pipeline_第3张图片
pipeline_scm_github_dir.png

报错处理

pipeline script from SCM方式下:

Started by user ***
java.io.FileNotFoundException
    at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:167)
    at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:159)
    at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193)
    ...
Finished: FAILURE
Unity Jenkins打包(3) Pipeline_第4张图片
pipeline_SCM_error.png

原因是git工程下,没有找到Script Path路径下的脚本文件。

相关文章

  1. Unity Jenkins打包(1) Mac部署
  2. Unity Jenkins打包(2) Mac git配置

你可能感兴趣的:(Unity Jenkins打包(3) Pipeline)