Last active
April 26, 2017 21:58
-
-
Save natemccurdy/b48962a5a0f90cc615c5894bb211e18d to your computer and use it in GitHub Desktop.
Puppet config version script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require 'json' | |
require 'socket' | |
compile_master = Socket.gethostname | |
environmentpath = ARGV[0] | |
environment = ARGV[1] | |
# Get the short SHA1 commit ID from the control repository. | |
r10k_deploy_file_path = File.join(environmentpath, environment, '.r10k-deploy.json') | |
commit_id_short = JSON.parse(File.read(r10k_deploy_file_path))['signature'][0...11] | |
# Show the compiling master, environment name, and short commit ID. | |
puts "#{compile_master}-#{environment}-#{commit_id_short}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config_version = 'scripts/config_version.rb $environmentpath $environment' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment