Giter Club home page Giter Club logo

jenkins-build-per-branch's Introduction

jenkins-build-per-branch

This is a fork of https://github.com/entagen/jenkins-build-per-branch .

It allows you to have a template job configured for one branch, and automatically check for new branches in a git repository and create jobs, based on the template, pointing to the newly discovered branches.

Requirements

Before moving on, go to Manage Jenkins > Configure System and add a Gradle installation. I currently use Gradle 2.5.

Installation

Imagine you have already a job suffixed with the branch name/placeholder, like this:

  • testing-my-repo-master
  • or testing-my-repo-origin_master (any separator works)
  • or testing_my_repo-Xbranch (Xbranch isn't a real branch, and most certainly this job is disabled)

Create a freestyle project

  • called e.g. testing-my-repo-Xbranch-sync-with-repo
  • under Source Code Management, pick Git
  • point to this jenkins-build-per-branch URL and the latest tag (it's not safe to use branch names!)
  • under Build Triggers, you could go for Build periodically and @midnight
  • under Build, add a Invoke Gradle script
  • select Gradle version, so it will be installed automatically
  • under Tasks, write syncWithRepo
  • under Switches add one per line, in this format -D<name>=<value>

All available Switches can be found in the source-code here.

I currently use something like this

-DjenkinsUrl=https://example.com/jenkins
-DallowSelfsignedSslCerts=true
[email protected]:repo.git
-DtemplateJobPrefix=testing-my-repo-
-DtemplateBranchName=Xbranch
-DbranchNameRegex=master|v.*
-DenableJobRegex=.*

NOTE: testing-my-repo-Xbranch-sync-with-repo is disabled, but has cronjob builder/poller, so that the new jobs based on it, will be enabled at once and will start on their own.

NOTE: you can use one setup for multiple template jobs e.g. one testing template my-repo-test-Xbranch, and one release template my-repo-release-Xbranch by setting -DtemplateJobPrefix=my-repo-. Both templates will be picked up, and one my-repo-test-master and one my-repo-release-master job will be created for the master branch.

Change log

Upcoming

  • Gradle 2.5

2015-08-01 - v2.0

  • remove noDelete, noViews in favour of deleteOld, views - no double negations

2015-08-01 - v1.0

  • based on upstream 547230eec39135a548b5ffacf8ee95e6577c56e3
  • change startOnCreate to take a non-Boolean value to allow buildWithParameters, pass a token or a cause PR
  • less assumptions in the regex
  • replace branch occurences, not job occurences
  • new allowSelfsignedSslCerts - add support for self signed certificates PR
  • new enable-job-regex, disable-job-regex - enable or disable jobs based on regex PR

Original docs

README.original.md

License

Apache 2.0

jenkins-build-per-branch's People

Contributors

andreineculau avatar asavoy avatar beckje01 avatar brantb avatar dhumeniuk avatar ebakke avatar jamesdh avatar jimmyw avatar kmarquardsen avatar mrohland avatar tednaleid avatar titas avatar willdurand avatar yonatanp avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

devops-workflow

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.