From 32503b0731b912d803f14e2b8807bba62294fe01 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 20 Jul 2016 16:38:48 +0200 Subject: [PATCH 1/2] Use HEROKU_SLUG_COMMIT instead of last-commit-sha-buildpack We used last-commit-sha-buildpack in order to fetch the sha of the last deployed commit during building the app and save it to use it later. This was done using undocumented Heroku properties, for example it assumed a certain path to git files. It turns out that there's another way to do it now. We can enable dyno-metadata[1] feature on heroku and use HEROKU_SLUG_COMMIT [1] https://devcenter.heroku.com/articles/dyno-metadata --- .buildpacks | 1 - lib/travis/api/app.rb | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.buildpacks b/.buildpacks index 36201cad..4d7e2859 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,3 +1,2 @@ https://github.com/heroku/heroku-buildpack-ruby.git -https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index d61a498b..d6e872a9 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -26,6 +26,7 @@ require 'metriks/reporter/logger' require 'metriks/librato_metrics_reporter' require 'travis/support/log_subscriber/active_record_metrics' require 'fileutils' +require 'securerandom' module Travis::Api end @@ -81,11 +82,7 @@ module Travis::Api end def self.deploy_sha - @deploy_sha ||= File.exist?(deploy_sha_path) ? File.read(deploy_sha_path)[0..7] : 'deploy-sha' - end - - def self.deploy_sha_path - File.expand_path('../../../../.deploy-sha', __FILE__) + @deploy_sha ||= ENV['HEROKU_SLUG_COMMIT'] || SecureRandom.hex(5) end attr_accessor :app From c7161cec8165649b11cb10a7ab2a6477859a65f6 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Fri, 12 Aug 2016 14:37:05 +0200 Subject: [PATCH 2/2] also send the travis domain to customer.io --- lib/travis/api/app/endpoint/authorization.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index 30d85546..4d6feec3 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -179,7 +179,8 @@ class Travis::Api::App :created_at => user.created_at.to_i, :github_id => user.github_id, :education => user.education, - :first_logged_in_at => user.first_logged_in_at.to_i + :first_logged_in_at => user.first_logged_in_at.to_i, + :travis_domain => Travis.config.client_domain } customerio.identify(payload)