Questions tagged [jenkins-job-builder]

Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML or JSON format and uses them to configure Jenkins. You can keep your job descriptions in human readable text format in a version control system to make changes and auditing easier. It also has a flexible template system, so creating many similarly configured jobs is easy.

Jenkins Job builder creates Jenkins XML configuration file from a YAML/JSON definition file and uploads it to Jenkins. JJB provides a convenient test command to allow you to validate the XML before you attempt to upload it to Jenkins.

An example job definition

- job:
    name: job-name
    project-type: freestyle
    defaults: global
    description: 'Do not edit this job through the web!'
    disabled: false
    display-name: 'Fancy job name'
    concurrent: true
    workspace: /srv/build-area/job-name
    quiet-period: 5
    block-downstream: false
    block-upstream: false
    retry-count: 3
    node: NodeLabel1 || NodeLabel2
    logrotate:
      daysToKeep: 3
      numToKeep: 20
      artifactDaysToKeep: -1
      artifactNumToKeep: -1

Once you’ve tested your job definition and are happy with it then you can use the update command to deploy the job to Jenkins.

jenkins-jobs update tests/yamlparser/fixtures/templates002.yaml

It will then appear in the UI of your Jenkins instance and can be run, viewed etc as any other job.

Online documentation: http://docs.openstack.org/infra/jenkins-job-builder/

83 questions
20
votes
2 answers

Jenkins - Git Submodule Credentials Different from Parent Repo

Background Jenkins is being used to build an artifact from a Git repo that has a Git submodule. The submodule(s) are not in the same repo or even at the same endpoint as the parent project. The problem is that parent repo checks out fine because the…
DanCat
  • 2,504
  • 2
  • 19
  • 26
9
votes
1 answer

Jenkins Job-Builder: How to correctly include job-templates from external file?

I am investigating using Jenkins Job-Builder (from OpenStack) as our means of managing jenkins job configurations. In doing so I am trying to figure out the right (best?) way to include a job-template from an external file using the !include custom…
Kenneth Baltrinic
  • 2,941
  • 2
  • 28
  • 45
7
votes
3 answers

Jenkins job builder gitlab trigger is ignored

I have a following Jenkins Job definition: - scm: name: some-project scm: - git: url: git@gitlab.****/some-project.git credentials-id: some-ssh-username-with-private-key branches: - origin/master - project: …
6
votes
2 answers

How to use `inject-passwords` in Jenkins job Builder?

I am using a yaml file to configure a jenkins job, and I came across the feature inject-passwords (see here). However, this documentation neither describes on how to use the variable within the jenkins environment, nor what 'encrypted' password…
Alex
  • 41,580
  • 88
  • 260
  • 469
4
votes
4 answers

Jenkins job failed with error java.lang.NoClassDefFoundError

We have scheduled a Jenkins Build to create AWS VM, VM is successfully online but while archiving the Artifacts, job got failed with below error message. Archiving artifacts ERROR: Step ‘Archive the artifacts’ aborted due to exception:…
SeJaPy
  • 284
  • 1
  • 6
  • 18
4
votes
1 answer

How to override an attribute for a specific job when working with Jenkins Job Builder (JJB)

We have got a Jenkins setup (at the moment not managed with the Jenkins Job Builder) where every web project has 5 very similar Jenkins jobs. This is a simplified Jenkins Job Builder yaml file which could work for our needs: - defaults: name:…
mostwanted
  • 1,549
  • 3
  • 13
  • 21
4
votes
3 answers

How to convert jenkins job configuration config.xml to YAML format in python to be used jenkins-job-builder?

jenkins-job-builder is a nice tool to help me to maintain jobs in YAML files. see example in configuration chapter. Now I had lots of old jenkins jobs, it will be nice to have a python script xml2yaml to convert the existing jenkins job config.xml…
Larry Cai
  • 55,923
  • 34
  • 110
  • 156
3
votes
1 answer

Difference between lightweight checkout and shallow clone in Jenkins

In the pipeline SCM configuration of Jenkins job builder, we have two options- lightweight checkout and shallow clone. What is the difference between these options and when do we use each option?
Manish
  • 1,999
  • 2
  • 15
  • 26
3
votes
1 answer

Create Jenkins Job remotely with REST API

I can't create Job remotely (REST API + Postman), I try POST: http://localhost:8080/createItem?name=NEWJOB OR http://localhost:8080/job/NEWJOB/build and always have 403 error(GET methods work). Here I see that I need to create config.xml for…
Anna
  • 349
  • 4
  • 20
3
votes
2 answers

For loop in JJB templates

Is there a way to use for loops in YAML templates for Jenkins Job Builder? Like it Ansible with jinja2 Something like jobs: job1, job2, job3 - trigger-builds: - project: {% for j in jobs %} project_{{ j }} {%…
Igor Zilberman
  • 1,048
  • 1
  • 11
  • 16
3
votes
0 answers

Jenkins Job Builder error - TypeError: cannot serialize {'repo': None} (type dict)

I am trying to build my config.xml files for pushing into Jenkins using the Jenkins Job Builder and I face an error. Shown below is the project.yml file: - project: name: my_nice_checkout_jobs repo: - scripts: …
Müller
  • 973
  • 6
  • 19
  • 38
3
votes
1 answer

Jenkins Job Builder: Project Level Variables

Within JJB, you can define project-level variables like this: - defaults: name: global git_url: "git@....." - project name: some-test jobs: - test-{name} - job-template name: test-{name} scm: - git: …
Perry Hoekstra
  • 2,687
  • 3
  • 33
  • 52
2
votes
0 answers

With Jenkins Job Builder (JJB) what's the preferred way to inject values into a static set of job configuration files?

I have a working set of JJB YAML files successfully creating jobs and folders. I now want to make certain values I use inside those YAML files configurable i.e. when running jenkins-jobs test|update -r jobfolder I want to set values for folder…
frans
  • 8,868
  • 11
  • 58
  • 132
2
votes
1 answer

Can't add jenkins-job-builder in jenkins docker image

I'm new in docker. I want to create a docker container with Newman, Jenkins, Jenkins-job-builder. Please help me. I built a docker image which bases on official Jenkins image https://hub.docker.com/r/jenkins/jenkins. I used DockerFile. The build…
MaryG
  • 23
  • 3
2
votes
1 answer

Jenkins Job Builder tries to expand parameter in a text field

I'm having some issues with a Jenkins Job Builder YAML file which contains an attribute (message-content) with "{}" characters in it: - job-template: id: senderjob name: '{job-prefix}{id}' command: 'echo "executed with $PARAMETER"' …
Francesco Marchioni
  • 4,091
  • 1
  • 25
  • 40
1
2 3 4 5 6