Module: Gitlab::Client::Tags

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/tags.rb

Overview

Defines methods related to tags.

Instance Method Summary collapse

Instance Method Details

#create_release(project, tag, description) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_release

Adds release notes to an existing repository tag. Requires Gitlab >= 8.2.0

Examples:

Gitlab.create_release(3, '1.0.0', 'This is ready for production')
Gitlab.repo_create_release(5, '1.0.0', 'This is ready for production')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag (String)

    The name of the new tag.

  • description (String)

    Release notes with markdown support

Returns:



77
78
79
# File 'lib/gitlab/client/tags.rb', line 77

def create_release(project, tag, description)
  post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
end

#create_tag(project, tag_name, ref, message = '', description = nil) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_tag

Creates a new project repository tag.

Examples:

Gitlab.create_tag(42, 'new_tag', 'master')
Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag_name (String)

    The name of the new tag.

  • ref (String)

    The ref (commit sha, branch name, or another tag) the tag will point to.

  • message (String) (defaults to: '')

    Optional message for tag, creates annotated tag if specified.

  • description (String) (defaults to: nil)

    Optional release notes for tag.

Returns:



34
35
36
# File 'lib/gitlab/client/tags.rb', line 34

def create_tag(project, tag_name, ref, message = '', description = nil)
  post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
end

#delete_tag(project, tag) ⇒ Gitlab::ObjectifiedHash Also known as: repo_delete_tag

Deletes a repository tag. Requires Gitlab >= 6.8.x

Examples:

Gitlab.delete_tag(3, 'api')
Gitlab.repo_delete_tag(5, 'master')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag (String)

    The name of the tag to delete

Returns:



62
63
64
# File 'lib/gitlab/client/tags.rb', line 62

def delete_tag(project, tag)
  delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
end

#tag(project, tag) ⇒ Gitlab::ObjectifiedHash Also known as: repo_tag

Gets information about a repository tag.

Examples:

Gitlab.tag(3, 'api')
Gitlab.repo_tag(5, 'master')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag (String)

    The name of the tag.

Returns:



48
49
50
# File 'lib/gitlab/client/tags.rb', line 48

def tag(project, tag)
  get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
end

#tags(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_tags

Gets a list of project repository tags.

Examples:

Gitlab.tags(42)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



17
18
19
# File 'lib/gitlab/client/tags.rb', line 17

def tags(project, options = {})
  get("/projects/#{url_encode project}/repository/tags", query: options)
end

#update_release(project, tag, description) ⇒ Gitlab::ObjectifiedHash Also known as: repo_update_release

Updates the release notes of a given release. Requires Gitlab >= 8.2.0

Examples:

Gitlab.update_release(3, '1.0.0', 'This is even more ready for production')
Gitlab.repo_update_release(5, '1.0.0', 'This is even more ready for production')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag (String)

    The name of the new tag.

  • description (String)

    Release notes with markdown support

Returns:



92
93
94
# File 'lib/gitlab/client/tags.rb', line 92

def update_release(project, tag, description)
  put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
end