• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sheehan/job-dsl-gradle-example: An example Job DSL project that uses Gradle for ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

sheehan/job-dsl-gradle-example

开源软件地址(OpenSource Url):

https://github.com/sheehan/job-dsl-gradle-example

开源编程语言(OpenSource Language):

Groovy 96.9%

开源软件介绍(OpenSource Introduction):

Jenkins Job DSL Gradle Example

An example Job DSL project that uses Gradle for building and testing. Check out this presentation for a walkthrough of this example (starts around 14:00).

File structure

.
├── src
│   ├── jobs                # DSL script files
│   ├── main
│   │   ├── groovy          # support classes
│   │   └── resources
│   │       └── idea.gdsl   # IDE support for IDEA
│   ├── scripts             # scripts to use with "readFileFromWorkspace"
│   └── test
│       └── groovy          # specs
└── build.gradle            # build file

Script Examples

  • Example 1 - shows basic folder/job creation
  • Example 2 - shows how to create a set of jobs for each github branch, each in its own folder
  • Example 3 - shows how to use the configure block
  • Example 4 - shows a way to reuse job definitions for jobs that differ only with a few properties
  • Example 5 - shows how to pull out common components into static methods
  • Example 6 - shows how to include script resources from the workspace
  • Example 7 - shows how to create jobs using builders
  • Example 8 - shows how to use DSL extensions provided by other plugins

Testing

./gradlew test runs the specs.

JobScriptsSpec will loop through all DSL files and make sure they don't throw any exceptions when processed. All XML output files are written to build/debug-xml. This can be useful if you want to inspect the generated XML before check-in. Plugins providing auto-generated DSL must be added to the build dependencies.

If you prefer to stub the auto-generated DSL, you can use JobScriptsSpecAlternative, though you may miss some syntax errors.

Seed Job

You can create the example seed job via the Rest API Runner (see below) using the pattern jobs/seed.groovy.

Or manually create a job with the same structure:

  • Invoke Gradle script
    • Use Gradle Wrapper: true
    • Tasks: clean test
  • Process Job DSLs
    • DSL Scripts: src/jobs/**/*Jobs.groovy
    • Additional classpath: src/main/groovy
  • Publish JUnit test result report
    • Test report XMLs: build/test-results/**/*.xml

Note that starting with Job DSL 1.60 the "Additional classpath" setting is not available when Job DSL script security is enabled.

Other Resources

Gradle Plugins

Plugins that automatically apply the functionality laid out in this example repo.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap