Giter Club home page Giter Club logo

puppet-jenkins_job_builder's Introduction

Jenkins Job Builder module for Puppet

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with jenkins_job_builder
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

Install jenkins_job_builder to allow you to manage your Jenkins jobs.

Module Description

The openstack jenkins_job_builder tool manages the configuration of jobs in your Jenkins instance. This module wraps that tool and allows you to control all the configuration of your Jenkins jobs from within hiera.

Setup

What jenkins_job_builder affects

  • Install the jenkins_job_builder pip package
  • Creates temporary files for each jenkins job you want to manage

Beginning with jenkins_job_builder

Installing jenkins_job_builder to a specified version

class { 'jenkins_job_builder':
  version => 'latest'
}

Usage

Classes and Defined Types

Class: jenkins_job_builder

Parameters within jenkins_job_builder:

version

The version of the the plugin to be installed.

jobs

A hash of the configuration for all the jobs you want to configure in your Jenkins instance.

user

The user used to authenticate to the Jenkins instance. (optional)

password

The password used to authenticate to the Jenkins instance. (optional)

timeout

(Optional) The connection timeout (in seconds) to the Jenkins server. If timeout is unset it will remove any existing timeout values in the config file.

hipchat_token

If using the jenkins hipchat plugin, this is the token that should be specified in the global config.

jenkins_url

The full url (including port) to the jenkins instance.

Define: jenkins_job_builder::job

Parameters within jenkins_job_builder::job:

config

A hash of the configuration for all the job you want to configure in your Jenkins instance.

delay

The time (in seconds) to delay the creatation of the Jenkins job. This is to avoid issues where Jenkins restarts during a puppet run.

service_name

The name of the jenkins service to restart when configuration changes are made. Defaults to 'jenkins'

Reference

Classes

Public Classes

Definitions

Limitations

This module is tested on the following platforms:

  • CentOS 5
  • CentOS 6
  • Ubuntu 13.10
  • Ubuntu 14.04

It is tested with the OSS version of Puppet only.

Development

Contributing

Please read CONTRIBUTING.md for full details on contributing to this project.

puppet-jenkins_job_builder's People

Contributors

alexjfisher avatar bastelfreak avatar bbriggs avatar cdenneen avatar choffee avatar deanwilson avatar dhollinger avatar dhoppe avatar ekohl avatar ffrank avatar gregswift avatar hunner avatar igalic avatar juniorsysadmin avatar kenyon avatar liamjbennett avatar llowder avatar madandroid avatar mkrakowitzer avatar mterzo avatar nibalizer avatar sacres avatar sandra-thieme avatar slashbunny avatar smortex avatar spredzy avatar stack72 avatar tragiccode avatar vinzent avatar wyardley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-jenkins_job_builder's Issues

Job creation does not work

A simple job as defined in the spec test of

{ 'test' => { 'name' => 'test' } }

Should produce

---
- job:
    name: "test"

but instead produces

---
 -job:
    test:
 -job:
     name: "test"

Jenkins git_url HTTPS error

  • Puppet: 4.3.2
  • Ruby: 2.1.8
  • Distribution: Centos 7
  • Module version: 2.0.0

Currently the default parameters are:

  $git_url          = 'https://git.openstack.org/openstack-infra/jenkins-job-builder'

But when run it complains:

==> jenkins2: Error: Could not get latest version: HTTP-Error: 403 Must access using HTTPS instead of HTTP
==> jenkins2: Error: /Stage[main]/Jenkins_job_builder::Install/Package[jenkins-job-builder]/ensure: change from 1.6.1 to latest failed: Could not get latest version: HTTP-Error: 403 Must access using HTTPS instead of HTTP

Job creation should have a re-try mechanism

We've seen job creation fail if/when Jenkins is unavailable - there should be a mechanism whereby the job creation is retried for a number attempts, and these tries should be configurable.

Archiving this module

The discussion came up of this module should get archived. Should someone want to keep this module around, just comment here.
If no comments to keep this around arise in the new weeks, we will move forward with archiving.

Job update operation is not idempotent

Since we're using a refreshonly => true operation for the job update exec, this can lead to a situation where when a job update fails, and the job yaml file is not subsequently updated, the next puppet run will appear to be successful, even though the job update operation is in a broken state.

python-argparse is virtual on Ubuntu

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 3.8.7
  • Ruby: 1.9.3p484
  • Distribution: Ubuntu 14.04.5 LTS (affects all versions packages.ubuntu.com)
  • Module version: 2.1.0 (also affects master)

What are you seeing

When using this module on Ubuntu, the following occurs every puppet run:

Notice: /Stage[main]/Jenkins_job_builder::Install/Package[python-argparse]/ensure: ensure changed 'purged' to 'present'

This is because the package is virtual, so Puppet doesn't see it as installed. It will always try to reinstall it:

# apt-cache show python-argparse
N: Can't select versions from package 'python-argparse' as it is purely virtual
N: No packages found
# apt-get install python-argparse
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libpython2.7-stdlib' instead of 'python-argparse'
libpython2.7-stdlib is already the newest version.

According to packages.ubuntu.com, this is virtual package is satisfied by libpython2.7-stdlib in all documented versions (trusty through zesty, and artful).

Incorrect formatting for "Trigger parameterized builds" plugin

Hullo,

I'm using 1.1.0 of your Puppet module (thank you :) and when I provide Puppet hiera YAML for a Jenkins job genersys:

          publishers:
            - trigger-parameterized-builds:
              - project: "genersys-outgoing-promotion-filewriter. genersys-outgoing-promotion-ftp-reader, genersys-outgoing-promotion-ftp-writer, genersys-outgoing-promotion-service"
                condition: UNSTABLE_OR_BETTER
                predefined-parameters: PKG_VERSION=$PKG_VERSION

I get this output in /tmp/jenkins-genersys.yaml:

       publishers:
        - trigger-parameterized-builds:
           - condition: "UNSTABLE_OR_BETTER"
           - predefined-parameters: "PKG_VERSION=$PKG_VERSION"
           - project: "genersys-outgoing-promotion-filewriter. genersys-outgoing-promotion-ftp-reader, genersys-outgoing-promotion-ftp-writer, genersys-outgoing-promotion-service"

The jenkins-jobs run fails with KeyError: 'project' :(

I found that I need to manipulate the /tmp/jenkins-genersys.yaml to look like this in order for it to be processed successfully by jenkins-jobs

       publishers:
        - trigger-parameterized-builds:
           - project: "genersys-outgoing-promotion-filewriter, genersys-outgoing-promotion-ftp-reader, genersys-outgoing-promotion-ftp-writer, genersys-outgoing-promotion-service"
             predefined-parameters: PKG_VERSION=$PKG_VERSION
             condition: "UNSTABLE_OR_BETTER"

Is there a different way in Puppet hiera that I need to express the configuration to get the desired output?

Cheers,
Gavin.

Sleep command no longer required

Since there are now parameters for the exec, that implement retry options, the /bin/sleep part of the command executed is no longer required. We should deprecate this functionality, and remove it in a future release.

Unexpected results from jenkins-job-yaml.erb template

When I define my config in hiera, the resulting YAML created on disk at /tmp/jenkins-job_name.yaml can differ considerably from the structure in hiera, and I sometimes have unexpected results when setting variables in hiera as well; for example, if I create a nested field with a literal ", it doesn't get created in the job correctly ..
Example:

my_amazing_job:
  delay: 15
  config:
    - job:
        name: my_amazing_job
        description: 'my_amazing_job'
        project-type: freestyle
        scm:
          - git:
              wipe-workspace: false
              credentials-id: 88888888-4444-4444-4444-888888888888
              url: "[email protected]:puppet-community/puppet-jenkins_job_builder.git"
              git-config-name: "User Deploy"
              git-config-email: "[email protected]"
              branches:
                - "*/master"
        wrappers:
          - ansicolor
        builders:
          - sbt:
              name: 'sbt'
              actions: "\"release with-defaults\""
              sbt-flags: '-Dsbt.log.noformat=true -Dsbt.override.build.repos=false'

results in a config file on disk with:

[root@jenkins ~]# cat /tmp/jenkins-my_amazing_job.yaml

---
  - job:
       builders:
        - sbt:
           actions: "release with-defaults\""
           name: "sbt"
           sbt-flags: "-Dsbt.log.noformat=true -Dsbt.override.build.repos=false"
       description: "my_amazing_job"
       name: "my_amazing_job"
       project-type: "freestyle"
       scm:
        - git:
           branches:
             - "*/master"
           credentials-id: "88888888-4444-4444-4444-888888888888"
           git-config-email: "[email protected]"
           git-config-name: "User Deploy"
           url: "[email protected]:puppet-community/puppet-jenkins_job_builder.git"
           wipe-workspace: "false"
       wrappers:
         - "ansicolor"

The config from hiera is being sorted .. and although this is not a bad thing in itself, the quoted string with escaped " is being incorrectly interpreted:

"\"release with-defaults\""

becomes:

"release with-defaults\""

and results in a string in the job with only a closing ", and not the entire string quoted

A proposed fix would be the one suggested by @choffee in #7 - to use to_yaml method in template, instead of the sort_yaml which is currently being used

Support for sourcing jobs

Would it make sense to source in the jobs directory (could be it's own repo) and then have this plugin support building all the jobs in that directory?

similar to:
jenkins-jobs -l DEBUG --conf jenkins_job.ini --ignore-cache update -r jobs

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.