summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-02 13:10:56 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-02 13:11:23 +0200
commit1490933090166d71ce009708a70a16b156415052 (patch)
treef6df951d43e378d95103ee7586680322e407f289 /app/models/ci/pipeline.rb
parent1c4187e38e09c8dfc4d0cdbd4c702aff5d695acb (diff)
downloadgitlab-ce-1490933090166d71ce009708a70a16b156415052.tar.gz
Expose paths modified by a push from a pipeline class
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb28
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?