lib/release_tools/deployments/merge_request_updater.rb
def add_label(label)
        scope = label_scope(label)

        each_merge_request do |mr|
          with_retries do
            logger.info(
              "Adding label #{label.inspect} to merge request #{mr.web_url}"
            )

            labels = mr.labels

            if scope
              labels.reject! { |l| l.start_with?("#{scope}#{SCOPE_SEPARATOR}") }
            end

            begin
              GitlabClient.update_merge_request(
                mr.project_id,
                mr.iid,
                labels: [label, *labels].join(',')
              )
            rescue Gitlab::Error::Unprocessable => ex
              # In rare cases the API will produce this error but seemingly
              # still update the merge request. To prevent such errors from
              # causing pipeline failures we catch them here and just log them.
              #
              # See https://gitlab.com/gitlab-org/release-tools/-/issues/418 for
              # more information.
              logger.error(ex.message, merge_request: mr.web_url)
            end
          end
        end
      end
# Adds the label to all merge requests.
#
# This does not use slash commands, as comments that _only_ include slash
# commands are rejected by our API.
Adds the label to all merge requests.
This does not use slash commands, as comments that _only_ include slash
commands are rejected by our API.
Adds the label to all merge requests . This does not use slash commands as comments that _only_ include slash commands are rejected by our API .
def add_label(label)
        scope = label_scope(label)
        each_merge_request do |mr|
          with_retries do
            logger.info(
              "Adding label {label.inspect} to merge request {mr.web_url}"
            )
            labels = mr.labels
            if scope
              labels.reject! { |l| l.start_with?("{scope}{SCOPE_SEPARATOR}") }
            end
            begin
              GitlabClient.update_merge_request(
                mr.project_id,
                mr.iid,
                labels: [label, *labels].join(',')
              )
            rescue Gitlab::Error::Unprocessable => ex
               See https://gitlab.com/gitlab-org/release-tools/-/issues/418 for
               more information.
              logger.error(ex.message, merge_request: mr.web_url)
            end
          end
        end
      end
def add_label ( label ) scope = label_scope ( label ) each_merge_request do | mr | with_retries do logger . info ( "Adding label #{label.inspect} to merge request #{mr.web_url}" ) labels = mr . labels if scope labels . reject! { | l | l . start_with? ( "#{scope}#{SCOPE_SEPARATOR}" ) } end begin GitlabClient . update_merge_request ( mr . project_id , mr . iid , labels : [ label , * labels ] . join ( ',' ) ) rescue Gitlab :: Error :: Unprocessable => ex logger . error ( ex . message , merge_request : mr . web_url ) end end end end
Adds the label to all merge requests.
Adds the label to all merge requests .
# In rare cases the API will produce this error but seemingly # still update the merge request. To prevent such errors from # causing pipeline failures we catch them here and just log them. # # See https://gitlab.com/gitlab-org/release-tools/-/issues/418 for # more information.
label