{"id":14984631,"url":"https://github.com/sheehan/job-dsl-gradle-example","last_synced_at":"2025-04-04T08:08:34.019Z","repository":{"id":13899088,"uuid":"16597608","full_name":"sheehan/job-dsl-gradle-example","owner":"sheehan","description":"An example Job DSL project that uses Gradle for building and testing.","archived":false,"fork":false,"pushed_at":"2022-04-21T02:40:44.000Z","size":322,"stargazers_count":448,"open_issues_count":14,"forks_count":326,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-03-28T07:08:08.696Z","etag":null,"topics":["groovy","jenkins","job-dsl"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sheehan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-06T23:12:38.000Z","updated_at":"2025-03-25T14:06:52.000Z","dependencies_parsed_at":"2022-08-28T20:40:07.906Z","dependency_job_id":null,"html_url":"https://github.com/sheehan/job-dsl-gradle-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheehan%2Fjob-dsl-gradle-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheehan%2Fjob-dsl-gradle-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheehan%2Fjob-dsl-gradle-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheehan%2Fjob-dsl-gradle-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheehan","download_url":"https://codeload.github.com/sheehan/job-dsl-gradle-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142066,"owners_count":20890652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["groovy","jenkins","job-dsl"],"created_at":"2024-09-24T14:09:24.843Z","updated_at":"2025-04-04T08:08:33.991Z","avatar_url":"https://github.com/sheehan.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins Job DSL Gradle Example \n\nAn example [Job DSL](https://github.com/jenkinsci/job-dsl-plugin) project that uses Gradle for building and testing. Check out [this presentation](https://www.youtube.com/watch?v=SSK_JaBacE0) for a walkthrough of this example (starts around 14:00). \n\n## File structure\n\n    .\n    ├── src\n    │   ├── jobs                # DSL script files\n    │   ├── main\n    │   │   ├── groovy          # support classes\n    │   │   └── resources\n    │   │       └── idea.gdsl   # IDE support for IDEA\n    │   ├── scripts             # scripts to use with \"readFileFromWorkspace\"\n    │   └── test\n    │       └── groovy          # specs\n    └── build.gradle            # build file\n\n# Script Examples\n\n* [Example 1](src/jobs/example1Jobs.groovy) - shows basic folder/job creation\n* [Example 2](src/jobs/example2Jobs.groovy) - shows how to create a set of jobs for each github branch, each in its own folder\n* [Example 3](src/jobs/example3Jobs.groovy) - shows how to use the configure block\n* [Example 4](src/jobs/example4Jobs.groovy) - shows a way to reuse job definitions for jobs that differ only with a few properties\n* [Example 5](src/jobs/example5Jobs.groovy) - shows how to pull out common components into static methods\n* [Example 6](src/jobs/example6Jobs.groovy) - shows how to include script resources from the workspace\n* [Example 7](src/jobs/example7Jobs.groovy) - shows how to create jobs using builders\n* [Example 8](src/jobs/example8Jobs.groovy) - shows how to use DSL extensions provided by other plugins\n\n## Testing\n\n`./gradlew test` runs the specs.\n\n[JobScriptsSpec](src/test/groovy/com/dslexample/JobScriptsSpec.groovy) \nwill 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`. \nThis 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.\n\nIf you prefer to stub the auto-generated DSL, you can use [JobScriptsSpecAlternative](src/test/groovy/com/dslexample/JobScriptsSpecAlternative.groovy),\nthough you may miss some syntax errors.\n\n## Seed Job\n\nYou can create the example seed job via the Rest API Runner (see below) using the pattern `jobs/seed.groovy`.\n\nOr manually create a job with the same structure:\n\n* Invoke Gradle script\n   * Use Gradle Wrapper: `true`\n   * Tasks: `clean test`\n* Process Job DSLs\n   * DSL Scripts: `src/jobs/**/*Jobs.groovy`\n   * Additional classpath: `src/main/groovy`\n* Publish JUnit test result report\n   * Test report XMLs: `build/test-results/**/*.xml`\n\nNote that starting with Job DSL 1.60 the \"Additional classpath\" setting is not available when\n[Job DSL script security](https://github.com/jenkinsci/job-dsl-plugin/wiki/Script-Security) is enabled.\n\n## Other Resources\n\n* [Job DSL Playground](http://job-dsl.herokuapp.com/) - App for debugging Job DSL scripts.\n* [Job DSL API Viewer](https://jenkinsci.github.io/job-dsl-plugin/) - Full Job DSL syntax reference.\n* [Job DSL REST Example](https://github.com/sheehan/job-dsl-rest-example) - Example that shows how to make Job DSL updates via the Jenkins REST API. Originally part of this repo, later split off.\n\n#### Gradle Plugins\nPlugins that automatically apply the functionality laid out in this example repo.\n* [Gradle Job DSL Support Plugin](https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin) - Plugin for easy management of Jenkins Job DSL scripts with Gradle.\n* [Gradle Jenkins Job DSL Plugin](https://github.com/heremaps/gradle-jenkins-jobdsl-plugin) - Plugin to manage Jenkins Job DSL projects in a Gradle project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheehan%2Fjob-dsl-gradle-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheehan%2Fjob-dsl-gradle-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheehan%2Fjob-dsl-gradle-example/lists"}