Commit 71d1d479 authored by itsuugo's avatar itsuugo
Browse files

Use BUILD_TIMESTAMP instead of BUILD_ID



As explained in #481 Jenkins has changed the format of BUILD_ID
from being a timestamp to the same value as BUILD_NUMBER.

This patch uses BUILD_TIMESTAMP instead of BUILD_ID but don't use
any fall back.

Signed-off-by: default avataritsuugo <antonio.ojea.garcia@gmail.com>
parent cf894175
......@@ -124,16 +124,16 @@ module Omnibus
build_tag
end
# We'll attempt to retrive the timestamp from the Jenkin's set BUILD_ID
# We'll attempt to retrive the timestamp from the Jenkin's set BUILD_TIMESTAMP
# environment variable. This will ensure platform specfic packages for the
# same build will share the same timestamp.
def build_start_time
@build_start_time ||= begin
if ENV["BUILD_ID"]
if ENV["BUILD_TIMESTAMP"]
begin
Time.strptime(ENV["BUILD_ID"], "%Y-%m-%d_%H-%M-%S")
Time.strptime(ENV["BUILD_TIMESTAMP"], "%Y-%m-%d_%H-%M-%S")
rescue ArgumentError
error_message = "BUILD_ID environment variable "
error_message = "BUILD_TIMESTAMP environment variable "
error_message << "should be in YYYY-MM-DD_hh-mm-ss "
error_message << "format."
raise ArgumentError, error_message
......
......@@ -112,13 +112,13 @@ module Omnibus
expect(build_version.semver).to match(/11.0.0-alpha1\+#{today_string}[0-9]+.git.207.694b062/)
end
it "uses ENV['BUILD_ID'] to generate timestamp if set" do
stub_env("BUILD_ID", "2012-12-25_16-41-40")
it "uses ENV['BUILD_TIMESTAMP'] to generate timestamp if set" do
stub_env("BUILD_TIMESTAMP", "2012-12-25_16-41-40")
expect(build_version.semver).to eq("11.0.0-alpha1+20121225164140.git.207.694b062")
end
it "fails on invalid ENV['BUILD_ID'] values" do
stub_env("BUILD_ID", "AAAA")
it "fails on invalid ENV['BUILD_TIMESTAMP'] values" do
stub_env("BUILD_TIMESTAMP", "AAAA")
expect { build_version.semver }.to raise_error(ArgumentError)
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment