GithubHelp home page GithubHelp logo

binario200 / jenkins-job-dsl Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 70 KB

Creates a Jenkins server using Job DSL plugin to deploy the job configuration programmatically using cradle and docker

License: MIT License

Groovy 100.00%
gradle docker jenkins-job-dsl jenkins-server

jenkins-job-dsl's Introduction

jenkins-job-dsl

Creates a Jenkins server using Job DSL plugin to deploy the job configuration programmatically using Gradle and Docker.

Uses the Job DSL Plugin and the Java API for GitHub to generate Jenkins jobs based on github repos for the organization specified at managedJobs.groovy

How does it work?

  1. When the docker image is built, the seed job and the dsl script are copied over to Jenkins home.
  2. When running the docker image, the startup script builds the seed job.
  3. The seed job runs the DSL job managedJobs.groovy which generates the job generate-org-jobs
  4. When running the job generate-org-jobs for a github organization, it searches the github organization for gradle files and generate Jenkins jobs for each repo found.

Project structure

.
├── jenkins-home
│   ├── init.groovy.d
│   │   └── startup.groovy                  # install gradle, deploy config files, run the seed job
│   ├── jobs
│   │   └── seed                            # seed job definition (should be the only config.xml)
│   ├── config-file-provider
│   │   └── generate-jobs-for-org.groovy    # script to generate Jenkins jobs for a given org
│   │   └── github-lib-build.gradle         # build file to download github-api jars so it can be used by DSL
│   ├── dsl
│   │   └── managedJobs.groovy              # dsl script to create `generate-org-jobs`
│   └── plugins.txt                         # jenkins plugins
└── Dockerfile                              # build the Docker image

Quick start

  • verify if you have Java and Gradle installed java -version grandle -v

  • If not install it from Java Gradle Docker

  • Verify is you have Docker hub account just in case if you want to push the image created, then do a docker login Also you will need to create a repository in Docker hub to push you docker image there, the docker repository has to be the same name specified at gradle.properties, the same case for the image tag, that will be taken from the version gradle property value.

  • Build the image, run the container and if you want publish to the docker hub using Gradle

    ./gradlew dockerBuild
    ./gradlew dockerRun # Build the docker image locally and start Jenkins at http://localhost:8080/
    
    

    if you want to publish do

    docker login # first
    
    ./gradlew dockerPush # will push version tagged docker image 
    ./gradlew dockerPushLatest
    
    

jenkins-job-dsl's People

Contributors

binario200 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vinodimdevops

jenkins-job-dsl's Issues

Add CI/CD server for jenkins-job-dsl project?

should we add CI/CD server for creating a Docker image for a CI/CD server (jenkins)?
Which CI/CD server?
Add job pipeline for lint, image build, image testing, images publishing ?

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.