diff options
-rw-r--r-- | app/models/merge_request.rb | 13 | ||||
-rw-r--r-- | db/migrate/20160907131111_add_environment_type_to_environments.rb | 20 | ||||
-rw-r--r-- | doc/ci/yaml/README.md | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/config/node/environment.rb | 7 |
4 files changed, 8 insertions, 41 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b215f02e4b7..75f48fd4ba5 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -744,21 +744,10 @@ class MergeRequest < ActiveRecord::Base @pipeline ||= source_project.pipeline_for(source_branch, diff_head_sha) end - def all_commits_sha - merge_request_diffs.map(&:commits).flatten.map(&:sha).sort.uniq - end - - def latest_pipelines - @latest_pipelines ||= - if diff_head_sha && source_project - source_project.pipelines.order(id: :desc).where(sha: commits_sha, ref: source_branch) - end - end - def all_pipelines @all_pipelines ||= if diff_head_sha && source_project - source_project.pipelines.order(id: :desc).where(sha: all_commits_sha, ref: source_branch) + source_project.pipelines.order(id: :desc).where(sha: commits_sha, ref: source_branch) end end diff --git a/db/migrate/20160907131111_add_environment_type_to_environments.rb b/db/migrate/20160907131111_add_environment_type_to_environments.rb index d22b3f4d2d1..fac73753d5b 100644 --- a/db/migrate/20160907131111_add_environment_type_to_environments.rb +++ b/db/migrate/20160907131111_add_environment_type_to_environments.rb @@ -1,28 +1,8 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - class AddEnvironmentTypeToEnvironments < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers - # Set this constant to true if this migration requires downtime. DOWNTIME = false - # When a migration requires downtime you **must** uncomment the following - # constant and define a short and easy to understand explanation as to why the - # migration requires downtime. - # DOWNTIME_REASON = '' - - # When using the methods "add_concurrent_index" or "add_column_with_default" - # you must disable the use of transactions as these methods can not run in an - # existing transaction. When using "add_concurrent_index" make sure that this - # method is the _only_ method called in the migration, any other changes - # should go in a separate migration. This ensures that upon failure _only_ the - # index creation fails and can be retried or reverted easily. - # - # To disable transactions uncomment the following line and remove these - # comments: - # disable_ddl_transaction! - def change add_column :environments, :environment_type, :string end diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 4772565fac9..a4cf0ec468a 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -577,9 +577,9 @@ The `deploy to production` job will be marked as doing deployment to Introduced in GitLab 8.12. `environment` can also represent a configuration hash with `name` and `url`. -These parameters can use any of defined CI variables (including predefined, secure variables and .gitlab-ci.yml variables). +These parameters can use any of the defined CI variables (including predefined, secure variables and `.gitlab-ci.yml` variables). -The common use case is to create a dynamic environments for branches and use them as review apps. +The common use case is to create dynamic environments for branches and use them as review apps. --- @@ -594,9 +594,10 @@ deploy as review app: url: https://$CI_BUILD_REF_NAME.review.example.com/ ``` -The `deploy to production` job will be marked as doing deployment to -`production` environment. +The `deploy as review app` job will be marked as deployment to +dynamically created `review-apps/branch-name` environment. +This environment should be accessible under `https://branch-name.review.example.com/`. ### artifacts diff --git a/lib/gitlab/ci/config/node/environment.rb b/lib/gitlab/ci/config/node/environment.rb index 85302589ce6..580fcda7549 100644 --- a/lib/gitlab/ci/config/node/environment.rb +++ b/lib/gitlab/ci/config/node/environment.rb @@ -36,14 +36,11 @@ module Gitlab end def name - case @config.type - when String then @config - when Hash then @config[:name] - end + value[:name] end def url - @config[:url] if hash? + value[:url] end def value |