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:



75
76
77
# File 'lib/gitlab/client/tags.rb', line 75

def create_release(project, tag, description)
  post("/projects/#{url_encode project}/repository/tags/#{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:



32
33
34
# File 'lib/gitlab/client/tags.rb', line 32

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, 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:



60
61
62
# File 'lib/gitlab/client/tags.rb', line 60

def delete_tag(project, tag)
  delete("/projects/#{url_encode project}/repository/tags/#{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:



46
47
48
# File 'lib/gitlab/client/tags.rb', line 46

def tag(project, tag)
  get("/projects/#{url_encode project}/repository/tags/#{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:



15
16
17
# File 'lib/gitlab/client/tags.rb', line 15

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:



90
91
92
# File 'lib/gitlab/client/tags.rb', line 90

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