Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb12
-rw-r--r--app/models/ci/pipeline.rb (renamed from app/models/ci/commit.rb)4
-rw-r--r--app/models/ci/trigger_request.rb2
-rw-r--r--app/models/commit.rb6
-rw-r--r--app/models/commit_status.rb8
-rw-r--r--app/models/merge_request.rb4
-rw-r--r--app/models/project.rb10
7 files changed, 23 insertions, 23 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 5e77fda70b9..74441eb97dc 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -45,8 +45,8 @@ module Ci
new_build.options = build.options
new_build.commands = build.commands
new_build.tag_list = build.tag_list
- new_build.gl_project_id = build.gl_project_id
- new_build.commit_id = build.commit_id
+ new_build.project = build.project
+ new_build.pipeline = build.pipeline
new_build.name = build.name
new_build.allow_failure = build.allow_failure
new_build.stage = build.stage
@@ -66,7 +66,7 @@ module Ci
# We use around_transition to create builds for next stage as soon as possible, before the `after_*` is executed
around_transition any => [:success, :failed, :canceled] do |build, block|
block.call
- build.commit.create_next_builds(build) if build.commit
+ build.pipeline.create_next_builds(build) if build.pipeline
end
after_transition any => [:success, :failed, :canceled] do |build|
@@ -80,7 +80,7 @@ module Ci
end
def retried?
- !self.commit.statuses.latest.include?(self)
+ !self.pipeline.statuses.latest.include?(self)
end
def retry
@@ -89,7 +89,7 @@ module Ci
def depends_on_builds
# Get builds of the same type
- latest_builds = self.commit.builds.latest
+ latest_builds = self.pipeline.builds.latest
# Return builds from previous stages
latest_builds.where('stage_idx < ?', stage_idx)
@@ -114,7 +114,7 @@ module Ci
def merge_request
merge_requests = MergeRequest.includes(:merge_request_diff)
- .where(source_branch: ref, source_project_id: commit.gl_project_id)
+ .where(source_branch: ref, source_project_id: pipeline.gl_project_id)
.reorder(iid: :asc)
merge_requests.find do |merge_request|
diff --git a/app/models/ci/commit.rb b/app/models/ci/pipeline.rb
index f22b573a94c..74347cf142f 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/pipeline.rb
@@ -1,5 +1,5 @@
module Ci
- class Commit < ActiveRecord::Base
+ class Pipeline < ActiveRecord::Base
extend Ci::Model
include Statuseable
@@ -47,7 +47,7 @@ module Ci
end
def short_sha
- Ci::Commit.truncate_sha(sha)
+ Ci::Pipeline.truncate_sha(sha)
end
def commit_data
diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb
index 872d5fb31de..47632c4b40a 100644
--- a/app/models/ci/trigger_request.rb
+++ b/app/models/ci/trigger_request.rb
@@ -3,7 +3,7 @@ module Ci
extend Ci::Model
belongs_to :trigger, class_name: 'Ci::Trigger'
- belongs_to :commit, class_name: 'Ci::Commit'
+ belongs_to :commit, class_name: 'Ci::Pipeline'
has_many :builds, class_name: 'Ci::Build'
serialize :variables
diff --git a/app/models/commit.rb b/app/models/commit.rb
index f96c7cb34d0..b5637bc4fbc 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -214,13 +214,13 @@ class Commit
@raw.short_id(7)
end
- def ci_commits
- @ci_commits ||= project.ci_commits.where(sha: sha)
+ def pipelines
+ @pipeline ||= project.pipelines.where(sha: sha)
end
def status
return @status if defined?(@status)
- @status ||= ci_commits.status
+ @status ||= pipelines.status
end
def revert_branch_name
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index f774b6e0efb..3752bf09f16 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -4,10 +4,10 @@ class CommitStatus < ActiveRecord::Base
self.table_name = 'ci_builds'
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
- belongs_to :commit, class_name: 'Ci::Commit', touch: true
+ belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id, touch: true
belongs_to :user
- validates :commit, presence: true
+ validates :pipeline, presence: true
validates_presence_of :name
@@ -44,11 +44,11 @@ class CommitStatus < ActiveRecord::Base
end
after_transition [:pending, :running] => :success do |commit_status|
- MergeRequests::MergeWhenBuildSucceedsService.new(commit_status.commit.project, nil).trigger(commit_status)
+ MergeRequests::MergeWhenBuildSucceedsService.new(commit_status.pipeline.project, nil).trigger(commit_status)
end
after_transition any => :failed do |commit_status|
- MergeRequests::AddTodoWhenBuildFailsService.new(commit_status.commit.project, nil).execute(commit_status)
+ MergeRequests::AddTodoWhenBuildFailsService.new(commit_status.pipeline.project, nil).execute(commit_status)
end
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 722c258244c..6c7668778ba 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -579,8 +579,8 @@ class MergeRequest < ActiveRecord::Base
diverged_commits_count > 0
end
- def ci_commit
- @ci_commit ||= source_project.ci_commit(last_commit.id, source_branch) if last_commit && source_project
+ def pipeline
+ @pipeline ||= source_project.pipeline(last_commit.id, source_branch) if last_commit && source_project
end
def diff_refs
diff --git a/app/models/project.rb b/app/models/project.rb
index 525a82c7534..e0ea1026b9c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -119,7 +119,7 @@ class Project < ActiveRecord::Base
has_one :import_data, dependent: :destroy, class_name: "ProjectImportData"
has_many :commit_statuses, dependent: :destroy, class_name: 'CommitStatus', foreign_key: :gl_project_id
- has_many :ci_commits, dependent: :destroy, class_name: 'Ci::Commit', foreign_key: :gl_project_id
+ has_many :pipelines, dependent: :destroy, class_name: 'Ci::Pipeline', foreign_key: :gl_project_id
has_many :builds, class_name: 'Ci::Build', foreign_key: :gl_project_id # the builds are created from the commit_statuses
has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject', foreign_key: :gl_project_id
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
@@ -930,12 +930,12 @@ class Project < ActiveRecord::Base
!namespace.share_with_group_lock
end
- def ci_commit(sha, ref)
- ci_commits.order(id: :desc).find_by(sha: sha, ref: ref)
+ def pipeline(sha, ref)
+ pipelines.order(id: :desc).find_by(sha: sha, ref: ref)
end
- def ensure_ci_commit(sha, ref)
- ci_commit(sha, ref) || ci_commits.create(sha: sha, ref: ref)
+ def ensure_pipeline(sha, ref)
+ pipeline(sha, ref) || pipelines.create(sha: sha, ref: ref)
end
def enable_ci