Coder Social home page Coder Social logo

puppet-blacksmith's Introduction

puppet-blacksmith

Build Status

Ruby Gem with several Puppet Module utilities

I don't always release my Puppet modules, but when I do I push them directly to the Forge

Rake tasks

Installation

Install the gem

$ gem install puppet-blacksmith

Add to your Rakefile

require 'puppet_blacksmith/rake_tasks'

And you can start using the Rake tasks. Note that you might have to delete .rake_t_cache before the tasks appear in the output of rake -T.

Tasks

Rake tasks included:

task description
module:build Build the module using puppet-modulebuilder
module:bump Bump module version to the next patch
module:bump:patch Bump module version to the next patch
module:bump:minor Bump module version to the next minor version
module:bump:major Bump module version to the next major version
module:bump:full Bump module version to the version set in the BLACKSMITH_FULL_VERSION env variable
module:bump_commit Bump version and git commit
module:bump_commit:patch Bump module version to the next patch and git commit
module:bump_commit:minor Bump module version to the next minor version and git commit
module:bump_commit:major Bump module version to the next major version and git commit
module:bump_commit:full Bump module version to the version set in the BLACKSMITH_FULL_VERSION env variable and git commit
module:bump_to_version[:new_version] Bump module version to new_version
module:clean Runs clean again
module:dependency[modulename, version] Updates the module version of a specific dependency
module:push Push module to the Puppet Forge
module:release Release the Puppet module, doing a clean, build, bump_commit, tag, push and git push
module:tag Git tag with the current module version
module:version Get the current module version
module:version:next Get the next patch module version
module:version:next:patch Get the next patch module version
module:version:next:minor Get the next minor module version
module:version:next:major Get the next major module version

Full release

Do everything needed to push to the Forge with just one command

$ rake module:release

Bump the version of a module

Bump your metadata.json to the next version

$ rake module:bump

Push a module to a repository

Run rake. Ensure you are doing it in a clean working folder or the puppet module builder will package all the unnecessary files.

$ rake module:push

Configuring to push a module to the Puppet Forge

Configure your credentials in ~/.puppetforge.yml

---
username: myuser
password: mypassword

Or set the equivalent environment variables in your shell

export BLACKSMITH_FORGE_USERNAME=myuser
export BLACKSMITH_FORGE_PASSWORD=mypassword

Configuring to push a module to a JFrog Artifactory

Configure your credentials in ~/.puppetforge.yml or within the project's root directory in ./puppetforge.yml

---
url: https://artifactory.example.com
forge_type: artifactory
username: myuser
password: mypassword

Or set the equivalent environment variables in your shell

export BLACKSMITH_FORGE_URL=https://artifactory.example.com
export BLACKSMITH_FORGE_TYPE=artifactory
export BLACKSMITH_FORGE_USERNAME=myuser
export BLACKSMITH_FORGE_PASSWORD=mypassword

Alternatively to username and password, Artifactory supports using an API Key obtained from its front-end. This can be set in the puppetforge.yml

---
url: https://artifactory.example.com
forge_type: artifactory
api_key: myAPIkey

Or via an environment variable:

export BLACKSMITH_FORGE_API_KEY=myAPIkey

Customizing tasks

In your Rakefile:

require 'puppet_blacksmith/rake_tasks'
Blacksmith::RakeTask.new do |t|
  t.tag_pattern = "v%s" # Use a custom pattern with git tag. %s is replaced with the version number.
  t.build = false # do not build the module nor push it to the Forge, just do the tagging [:clean, :tag, :bump_commit]
end

GPG signed tags

In your Rakefile:

require 'puppet_blacksmith/rake_tasks'
Blacksmith::RakeTask.new do |t|
  t.tag_message_pattern = "Version %s" # Signed tags must have a message
  t.tag_sign = true # enable GPG signing
end

Building blacksmith

bundle install
bundle exec rake

To cut a release: builds the gem, tags with git, pushes to rubygems and bumps the version number

bundle exec rake module:release

puppet-blacksmith's People

Contributors

ekohl avatar carlossg avatar bastelfreak avatar deric avatar alexjfisher avatar eputnam avatar ghoneycutt avatar fatmcgav avatar jlyheden avatar petems avatar tilladamdmde avatar dhollinger avatar domcleal avatar felixbechstein0000 avatar jamtur01 avatar jyaworski avatar justinstoller avatar lucywyman avatar bodgit avatar 3flex avatar tragiccode avatar yano3 avatar rtib 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.