GithubHelp home page GithubHelp logo

cobrijani / jenkins-job-dsl-maven-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maikheene/jenkins-job-dsl-maven-example

0.0 1.0 0.0 294 KB

Just a little example to create a job dsl with maven and use a yaml file as configuration

License: Apache License 2.0

Groovy 98.36% Shell 1.64%

jenkins-job-dsl-maven-example's Introduction

Create a jenkins job dsl with maven and use a yaml configuration

Create a seed job

  • Create a new Freestyle project
  • In the Source Code Management select the git option
    • Add the Repository URL and selected your credentials
  • In the Build section, add the build step Process Job DSL
    • Select the option Look on File system
    • Add your filename to the DSL Scripts field
      • For this example enter src/main/groovy/jobs/**/*.groovy
    • Open Advanced section and put src/main/groovy and src/main/lib/*.jar to the Additional classpath field in spepareated rows. (Imports the snakeYaml libary and other classes)
  • Save

File structure

.
├── src
│   ├── main
│   │   ├── groovy          
|   |   |   └── jobs        # DSL script files
|   |   |   └── utilities   # created classes for job DSL
|   |   |   └── lib         # libs that the job DSL is use 
│   │   └── resources       # resources (like scripts etc.) for job DSL
│   └── test
│       └── groovy          # unit tests
└── pom.xml                 # maven build file

Yaml configuration file

In the job_buildscript.grovy file you find the constant:

final YAML_FILE_CONFIG_PATH = "/your/path/to/the/yaml/file"

Here is an example for the current configuration:

ProjectName:
  git:
    - url: {git url}
    - branches_to_build: 
      - develop
      - release
      - master
    - credential_key_id: {credential_id_from_jenkins}
  java: 
    - jdk_version: 8
  builds:
    - keep_builds: 5
    - keep_day: 90

jenkins-job-dsl-maven-example's People

Contributors

cobrijani avatar maikwolf avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.