diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 23:38:02 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 23:38:02 +0900 |
commit | 7542a5d102bc48f5f7b8104fda22f0975b2dd931 (patch) | |
tree | 9a94528103422fa5baaab096091e34ae6463d507 /app/models/ci/pipeline.rb | |
parent | 8deb9c010fb4ab24b56a68470ecbf4b875467248 (diff) | |
parent | 88fa9a3c31d250ae9b88bb3250204b39eabc14b4 (diff) | |
download | gitlab-ce-7542a5d102bc48f5f7b8104fda22f0975b2dd931.tar.gz |
Merge branch 'master-ce' into scheduled-manual-jobs
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r-- | app/models/ci/pipeline.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index d986e33280d..17024e8a0af 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -633,6 +633,18 @@ module Ci end end + def branch_updated? + strong_memoize(:branch_updated) do + push_details.branch_updated? + end + end + + def modified_paths + strong_memoize(:modified_paths) do + push_details.modified_paths + end + end + def default_branch? ref == project.default_branch end @@ -660,6 +672,22 @@ module Ci Gitlab::DataBuilder::Pipeline.build(self) end + def push_details + strong_memoize(:push_details) do + Gitlab::Git::Push.new(project, before_sha, sha, push_ref) + end + end + + def push_ref + if branch? + Gitlab::Git::BRANCH_REF_PREFIX + ref.to_s + elsif tag? + Gitlab::Git::TAG_REF_PREFIX + ref.to_s + else + raise ArgumentError, 'Invalid pipeline type!' + end + end + def latest_builds_status return 'failed' unless yaml_errors.blank? |