Class: GitlabQuality::TestTooling::GitlabClient::CommitsClient

Inherits:
GitlabClient
  • Object
show all
Defined in:
lib/gitlab_quality/test_tooling/gitlab_client/commits_client.rb

Direct Known Subclasses

CommitsDryClient

Constant Summary

Constants inherited from GitlabClient

GitlabClient::MAX_RETRY_ATTEMPTS, GitlabClient::RETRY_BACK_OFF_DELAY

Instance Method Summary collapse

Methods inherited from GitlabClient

#handle_gitlab_client_exceptions, #ignore_gitlab_client_exceptions, #initialize, #post_exception_to_slack

Constructor Details

This class inherits a constructor from GitlabQuality::TestTooling::GitlabClient::GitlabClient

Instance Method Details

#create(branch_name, file_path, new_content, message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/gitlab_quality/test_tooling/gitlab_client/commits_client.rb', line 7

def create(branch_name, file_path, new_content, message)
  commit = handle_gitlab_client_exceptions do
    client.create_commit(project, branch_name, message, [
      { action: :update, file_path: file_path, content: new_content }
    ])
  end

  Runtime::Logger.debug("Created commit #{commit['id']} (#{commit['web_url']}) on #{branch_name}") if commit
  commit
end