Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FM-6170) Addition of branch check for build number creation #190

Merged
merged 1 commit into from
May 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/puppetlabs_spec_helper/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,18 @@ def max_thread_limit
end

sha = `git rev-parse HEAD`[0..7]
branch = `git rev-parse --abbrev-ref HEAD`

# If we're in a CI environment include our build number
# If the branch is a release branch we append an 'r' into the new_version,
# this is due to the release branch buildID conflicting with master branch when trying to push to the staging forge.
# More info can be found at https://tickets.puppetlabs.com/browse/FM-6170
if build = ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER']
new_version = sprintf('%s-%04d-%s', version, build, sha)
if branch.eql? "release"
new_version = sprintf('%s-%s%04d-%s', version, "r", build, sha)
else
new_version = sprintf('%s-%04d-%s', version, build, sha)
end
else
new_version = "#{version}-#{sha}"
end
Expand Down