summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2016-04-21 08:10:37 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2016-04-21 08:10:37 +0000
commitd2406668003f610139b60c036bc6fd9be982a580 (patch)
tree17cc8f3adf5ee7d5f086b2a3ce668a38ba9c7c4b /app/models/commit.rb
parent2ade37e2534108c72d28605cb131dacf771d27d3 (diff)
parent27e0c7723ca1eb85222210a20fd3fee1d77733f7 (diff)
downloadgitlab-ce-d2406668003f610139b60c036bc6fd9be982a580.tar.gz
Merge branch 'ci-commit-as-pipeline' into 'master'
Ci::Commit becomes a Pipeline object 1. Ci::Commit receives context: ref, :tag. 1. One Ci::Commit describes a one Pipeline 1. Pipeline is created from `.gitlab-ci.yml` 1. Pipeline is a ordered group of builds 1. We test MR against Pipeline 1. Pipelines have a separate view (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703) 1. Pipeline can be triggered from UI (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703) 1. Later we change `Trigger -> TriggerRequest -> Build` to `Trigger -> Pipeline` (future) 1. We add a Pipeline Hook that will be triggered on Pipeline status change (future) 1. We extend notifications to use `Pipeline Hook` to send summary on pipeline changes (future) After merging that I'll prepare a separate MR that will unify naming, database columns, table names: ``` Ci::Commit -> Pipeline Ci::Build -> Build CommitStatus -> Job GenericCommitStatus -> ExternalJob ci_commits -> pipelines ci_builds -> jobs ``` This MR implements first 5 points. This is made to solve this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/14149. See merge request !3653
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 6bb018b086f..562c3ed15b2 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -207,12 +207,13 @@ class Commit
@raw.short_id(7)
end
- def ci_commit
- project.ci_commit(sha)
+ def ci_commits
+ @ci_commits ||= project.ci_commits.where(sha: sha)
end
def status
- ci_commit.try(:status) || :not_found
+ return @status if defined?(@status)
+ @status ||= ci_commits.status
end
def revert_branch_name