Skip to content

Instantly share code, notes, and snippets.

@hashar
Created December 10, 2012 15:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashar/4251317 to your computer and use it in GitHub Desktop.
Save hashar/4251317 to your computer and use it in GitHub Desktop.
Jenkins Job Builder, override a parameter at project level
# Testing Jenkins Job Builder
#
# git clone git://gist.github.com/4251317.git
# mkdir testoutput
# jenkins-jobs -l debug test 4251317 -o testoutput
# grep command outtemplate/*
# Basic macro, takes a 'parameters' parameter
- builder:
name: resolve-deps
builders:
- shell: "echo {parameters}"
# The template that wich takes two parameters: name & db
- job-template:
name: '{name}-{db}-compile'
builders:
- resolve-deps:
parameters: "{parameters}"
- job-group:
name: jobs-for-dumb-project
jobs:
- '{name}-{db}-compile'
- project:
name: dumb-project
parameters: "GLOBAL DEFAULT"
db:
- mysql
- postgresql
- sqlite
jobs:
# Realize the three jobs:
- jobs-for-dumb-project
# We want to override some parameter for sqlite:
- '{name}-{db}-compile':
name: dumb-project
db: sqlite
parameters: "Set per JOB"
Copy link

ghost commented Sep 7, 2015

Should this snippet work? I get this error message:

jenkins_jobs.errors.JenkinsJobsException: Duplicate definitions for job 'dumb-project-sqlite-compile' specified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment