diff options
author | Miguel Cabeça <miguel.cabeca@custojusto.pt> | 2013-02-25 17:05:09 +0000 |
---|---|---|
committer | Miguel Cabeça <miguel.cabeca@custojusto.pt> | 2013-02-25 17:05:09 +0000 |
commit | f83c1b6549921042fa7c507aea8a42c0ae0fb428 (patch) | |
tree | 2c75d401e8c9ce138339eb8ca1241786c6d09ad5 | |
parent | 38b6a2a4478cceeb77480a6ee1dd713f3752b38d (diff) | |
download | gitlab-ci-f83c1b6549921042fa7c507aea8a42c0ae0fb428.tar.gz |
Added CI_SERVER* environment variables to build process.
The environment variable CI_SERVER can be used by the build process to
switch some specific CI configuration, like this for example:
```ruby
require 'rspec/retry'
RSpec.configure do |config|
config.default_retry_count = 3 if ENV['CI_SERVER']
end
```
The CI_SERVER_* variables were added for completeness.
-rw-r--r-- | app/views/layouts/application.html.haml | 4 | ||||
-rw-r--r-- | config/initializers/1_app.rb | 1 | ||||
-rw-r--r-- | lib/runner.rb | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 9d820b4..260d490 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,7 +11,7 @@ .navbar.navbar-fixed-top.navbar-ci .navbar-inner .container-fluid - = link_to 'GitLab CI', root_path, class: "brand" + = link_to GitlabCi::Name, root_path, class: "brand" %ul.nav - if current_user %li @@ -38,7 +38,7 @@ .right .padded %p.light - GitLab CI + = GitlabCi::Name %span= GitlabCi::Version %small= GitlabCi::Revision diff --git a/config/initializers/1_app.rb b/config/initializers/1_app.rb index ab9ef7b..cbf4464 100644 --- a/config/initializers/1_app.rb +++ b/config/initializers/1_app.rb @@ -1,4 +1,5 @@ module GitlabCi + Name = "GitLab CI" Version = File.read(Rails.root.join("VERSION")) Revision = `git log --pretty=format:'%h' -n 1` end diff --git a/lib/runner.rb b/lib/runner.rb index e6e3f8d..98db11a 100644 --- a/lib/runner.rb +++ b/lib/runner.rb @@ -84,6 +84,12 @@ class Runner @process.environment['BUNDLE_GEMFILE'] = File.join(path, 'Gemfile') @process.environment['BUNDLE_BIN_PATH'] = '' @process.environment['RUBYOPT'] = '' + + @process.environment['CI_SERVER'] = 'yes' + @process.environment['CI_SERVER_NAME'] = GitlabCi::Name + @process.environment['CI_SERVER_VERSION'] = GitlabCi::Version + @process.environment['CI_SERVER_REVISION'] = GitlabCi::Revision + @process.environment['CI_BUILD_REF'] = build.ref @process.start |