Commit 9aeede33 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Move rescue clause to branch creation method

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37082
we consolidated the `trigger-build-docs` script into the
`trigger-build` one. A new `cancel_latest_pipeline!` method was
created, but the rescue clause of the branch creation was misplaced.
It should actually be a part of `create_remote_branch!` instead.
parent 48662893
......@@ -274,6 +274,8 @@ module Trigger
def create_remote_branch!
Gitlab.create_branch(downstream_project_path, ref, 'master')
puts "=> Remote branch '#{ref}' created"
rescue Gitlab::Error::BadRequest
puts "=> Remote branch '#{ref}' already exists!"
end
def cancel_latest_pipeline!
......@@ -292,8 +294,6 @@ module Trigger
# Cancel the pipeline
Gitlab.cancel_pipeline(downstream_project_path, pipeline_id)
rescue Gitlab::Error::BadRequest
puts "=> Remote branch '#{ref}' already exists!"
end
def display_success_message
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment