File tree Expand file tree Collapse file tree 3 files changed +24
-16
lines changed Expand file tree Collapse file tree 3 files changed +24
-16
lines changed Original file line number Diff line number Diff line change 1- #!/usr/ bin/env ruby
1+ #!/opt/puppetlabs/puppet/ bin/ruby
22require 'json'
3+ require 'socket'
34
45environmentpath = ARGV [ 0 ]
56environment = ARGV [ 1 ]
67
8+ # Get the hostname of the Puppet master compiling the catalog.
9+ compiling_master = Socket . gethostname
10+
11+ # Get the path to the Code Manager deployment info file.
712r10k_deploy_file_path = File . join ( environmentpath , environment , '.r10k-deploy.json' )
813
9- #output the sha1 from the control-repo
10- puts JSON . parse ( File . read ( r10k_deploy_file_path ) ) [ 'signature' ]
14+ # Get the first 12 characters of the commit ID out of the deployment file.
15+ commit_id = JSON . parse ( File . read ( r10k_deploy_file_path ) ) [ 'signature' ] [ 0 ...11 ]
16+
17+ # Show the compiling master, environment name, and commit ID.
18+ puts "#{ compiling_master } -#{ environment } -#{ commit_id } "
Original file line number Diff line number Diff line change 11#!/usr/bin/env ruby
22begin
33 require 'rugged'
4+ require 'socket'
45rescue LoadError => e
56 t = Time . new
67 puts t . to_i
78else
8-
99 environmentpath = ARGV [ 0 ]
1010 environment = ARGV [ 1 ]
1111
12- repo = Rugged ::Repository . discover ( File . join ( environmentpath , environment ) )
13- head = repo . head
14-
15- #sha1 hash of the newest commit
16- head_sha = head . target_id
12+ # Get the hostname of the Puppet master compiling the catalog.
13+ compiling_master = Socket . gethostname
1714
18- #the commit message associated the newest commit
19- commit = repo . lookup ( head_sha )
15+ # Get the path to the environment being compiled.
16+ repo = Rugged ::Repository . discover ( File . join ( environmentpath , environment ) )
17+ head = repo . head
2018
21- #add something to find the remote url
19+ # First 12 characters of the sha1 hash of the newest commit.
20+ commit_id = head . target_id [ 0 ...11 ]
2221
23- puts head_sha
22+ # Show the compiling master, environment name, and commit ID.
23+ puts "#{ compiling_master } -#{ environment } -#{ commit_id } "
2424end
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ if [ -e $1/$2/.r10k-deploy.json ]
33then
44 /opt/puppetlabs/puppet/bin/ruby $1 /$2 /scripts/code_manager_config_version.rb $1 $2
55elif [ -e /opt/puppetlabs/server/pe_version ]
6- then
7- /opt/puppetlabs/puppet/bin/ruby $1 /$2 /scripts/config_version.rb $1 $2
6+ then
7+ /opt/puppetlabs/puppet/bin/ruby $1 /$2 /scripts/config_version.rb $1 $2
88else
99 /usr/bin/git --version > /dev/null 2>&1 &&
1010 /usr/bin/git --git-dir $1 /$2 /.git rev-parse HEAD ||
1111 date +%s
12- fi
12+ fi
You can’t perform that action at this time.
0 commit comments