Code Monkey home page Code Monkey logo

jenkins-workflow-library's Introduction

jenkins-workflow-library

This project provides a library that makes it easier to interface with Puppet Enterprise services in a project's Jenkinsfile.

Setup

You'll need to generate a Puppet Enterprise RBAC token that has permission to use the orchestrator and deploy code. If you install the pe-client-tools on the Jenkins master, you can generate the token with the following command run as the jenkins user: puppet access login --service-url $(puppet config print master --config /etc/puppetlabs/puppet/puppet.conf)

The token MUST be saved in ~jenkins/.puppetlabs/token (the command above saves it at that location)

Finally, you'll need to copy the Puppet Master's CA certificate to /var/lib/jenkins/ca.pem This command will do that for you run as root: cp /etc/puppetlabs/puppet/ssl/certs/ca.pem /var/lib/jenkins/ca.pem

Using

Place the puppet_enterprise.groovy file in the same directory as your Jenkinsfile

In your Jenkinsfile, load the library and save the result to a variable. For example:

puppet = load 'puppet_enterprise.groovy'

Methods

deployCode

The deployCode method uses Puppet Enterprise's code management to deploy Puppet code to the requested environment.

For example:

puppet.deployCode 'production'

Multiple environments can be specified with an array:

puppet.deployCode(['qa','staging'])

run

The run method uses Puppet Enterprise's application orchestration to run Puppet across an entire environment, or a subset of.

Options

  • target - Target an application, instance, or an application component in an environment. Defaults to the entire environment
  • noop - Perform a noop run. Defaults to false
  • concurrency - Set the maximum concurrency. Defaults to unlimited.

For example:

puppet.run 'production'
puppet.run 'production', target: 'Rgbank', concurrency: 10, noop: true

Roadmap

  • Add ability to wait until an orchestrator job has completed and fail if the job failed.
  • Turn into an actual Jenkins plugin. Will provide config settings for RBAC token and Puppet Enterprise master URL
  • Automatically pull CA certificate from Puppet Master
  • Add ability to manage Node Manager functions such as modifying classes, parameters, and rules

jenkins-workflow-library's People

Contributors

ccaum avatar

Watchers

James Cloos avatar  avatar

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.