diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-08 11:35:36 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-08 12:01:15 +0100 |
commit | ad3be46b9fe7d6d42b30d257a923b0070f79da94 (patch) | |
tree | 6684c983fb05c6bccdf88f4da62f5c9f74b17010 /lib/gitlab/ci/pipeline/chain/build.rb | |
parent | b30e0e0691716c2ef0b858b81dd5cef8d4728c59 (diff) | |
download | gitlab-ce-ad3be46b9fe7d6d42b30d257a923b0070f79da94.tar.gz |
Implement and use Gitlab::Ci::Pipeline::Chain::Command
Diffstat (limited to 'lib/gitlab/ci/pipeline/chain/build.rb')
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/build.rb | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/build.rb b/lib/gitlab/ci/pipeline/chain/build.rb index d47ebf70068..70732d26bbd 100644 --- a/lib/gitlab/ci/pipeline/chain/build.rb +++ b/lib/gitlab/ci/pipeline/chain/build.rb @@ -6,15 +6,15 @@ module Gitlab def perform! @pipeline.assign_attributes( source: @command.source, - project: @project, - ref: ref, - sha: sha, - before_sha: before_sha, - tag: tag_exists?, + project: @command.project, + ref: @command.ref, + sha: @command.sha, + before_sha: @command.before_sha, + tag: @command.tag_exists?, trigger_requests: Array(@command.trigger_request), - user: @current_user, + user: @command.current_user, pipeline_schedule: @command.schedule, - protected: protected_ref? + protected: @command.protected_ref? ) @pipeline.set_config_source @@ -23,36 +23,6 @@ module Gitlab def break? false end - - private - - def ref - @ref ||= Gitlab::Git.ref_name(origin_ref) - end - - def sha - @project.commit(origin_sha || origin_ref).try(:id) - end - - def origin_ref - @command.origin_ref - end - - def origin_sha - @command.checkout_sha || @command.after_sha - end - - def before_sha - @command.checkout_sha || @command.before_sha || Gitlab::Git::BLANK_SHA - end - - def protected_ref? - @project.protected_for?(ref) - end - - def tag_exists? - project.repository.tag_exists?(ref) - end end end end |