diff options
author | Jonathon Reinhart <Jonathon.Reinhart@gmail.com> | 2017-11-28 22:50:29 -0500 |
---|---|---|
committer | Jonathon Reinhart <Jonathon.Reinhart@gmail.com> | 2018-12-31 13:57:53 -0500 |
commit | ba781484c7b1bea2829f3429990a7cf39bb37ff8 (patch) | |
tree | 4f09b375a23a4f96deff70138c7870aa9ffa47d5 /app/workers/post_receive.rb | |
parent | 4d875a2bc365d1c5eb9c0965f91e688efae1e143 (diff) | |
download | gitlab-ce-ba781484c7b1bea2829f3429990a7cf39bb37ff8.tar.gz |
Add support for Git push options, specifically ci.skip
gitlab-org/gitlab-shell!166 added support for collecting push options
from the environment, and passing them along to the
/internal/post_receive API endpoint.
This change handles the new push_options JSON element in the payload,
and passes them on through to the GitPushService and GitTagPushService
services.
Futhermore, it adds support for the first push option, ci.skip. With
this change, one can use 'git push -o ci.skip' to skip CI pipe
execution. Note that the pipeline is still created, but in the "skipped"
state, just like with the 'ci skip' commit message text.
Implements #18667
Diffstat (limited to 'app/workers/post_receive.rb')
-rw-r--r-- | app/workers/post_receive.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 72a1733a2a8..bbd4ab159e4 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -3,7 +3,7 @@ class PostReceive include ApplicationWorker - def perform(gl_repository, identifier, changes) + def perform(gl_repository, identifier, changes, push_options = []) project, is_wiki = Gitlab::GlRepository.parse(gl_repository) if project.nil? @@ -15,7 +15,7 @@ class PostReceive # Use Sidekiq.logger so arguments can be correlated with execution # time and thread ID's. Sidekiq.logger.info "changes: #{changes.inspect}" if ENV['SIDEKIQ_LOG_ARGUMENTS'] - post_received = Gitlab::GitPostReceive.new(project, identifier, changes) + post_received = Gitlab::GitPostReceive.new(project, identifier, changes, push_options) if is_wiki process_wiki_changes(post_received) @@ -38,9 +38,21 @@ class PostReceive post_received.changes_refs do |oldrev, newrev, ref| if Gitlab::Git.tag_ref?(ref) - GitTagPushService.new(post_received.project, @user, oldrev: oldrev, newrev: newrev, ref: ref).execute + GitTagPushService.new( + post_received.project, + @user, + oldrev: oldrev, + newrev: newrev, + ref: ref, + push_options: post_received.push_options).execute elsif Gitlab::Git.branch_ref?(ref) - GitPushService.new(post_received.project, @user, oldrev: oldrev, newrev: newrev, ref: ref).execute + GitPushService.new( + post_received.project, + @user, + oldrev: oldrev, + newrev: newrev, + ref: ref, + push_options: post_received.push_options).execute end changes << Gitlab::DataBuilder::Repository.single_change(oldrev, newrev, ref) |