diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-10-02 13:10:56 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-10-02 13:11:23 +0200 |
commit | 1490933090166d71ce009708a70a16b156415052 (patch) | |
tree | f6df951d43e378d95103ee7586680322e407f289 /app/models/ci | |
parent | 1c4187e38e09c8dfc4d0cdbd4c702aff5d695acb (diff) | |
download | gitlab-ce-1490933090166d71ce009708a70a16b156415052.tar.gz |
Expose paths modified by a push from a pipeline class
Diffstat (limited to 'app/models/ci')
-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 6dac577c514..c0fb79a37e2 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -627,6 +627,18 @@ module Ci end end + def branch_updated? + strong_memoize(:branch_updated) do + push_details.branch_updated? + end + end + + def modified_paths + strong_memoize(:changes) do + push_details.modified_paths + end + end + private def ci_yaml_from_repo @@ -650,6 +662,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? |