Module: Gitlab::Client::BuildVariables

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

Overview

Defines methods related to builds.

Instance Method Summary collapse

Instance Method Details

#create_group_variable(group, key, value) ⇒ Gitlab::ObjectifiedHash

Create a build variable for a group.

Examples:

Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value")

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • key (String)

    The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed

  • value (String)

    The value of a variable

Returns:



99
100
101
# File 'lib/gitlab/client/build_variables.rb', line 99

def create_group_variable(group, key, value)
  post("/groups/#{url_encode group}/variables", body: { key: key, value: value })
end

#create_variable(project, key, value) ⇒ Gitlab::ObjectifiedHash

Create a build variable for a project.

Examples:

Gitlab.create_variable(5, "NEW_VARIABLE", "new value")

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • key (String)

    The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed

  • value (String)

    The value of a variable

Returns:



38
39
40
# File 'lib/gitlab/client/build_variables.rb', line 38

def create_variable(project, key, value)
  post("/projects/#{url_encode project}/variables", body: { key: key, value: value })
end

#group_variable(group, key) ⇒ Gitlab::ObjectifiedHash

Gets details of a group's specific build variable.

Examples:

Gitlab.group_variable(5, "TEST_VARIABLE_1")

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • key (String)

    The key of a variable.

Returns:



86
87
88
# File 'lib/gitlab/client/build_variables.rb', line 86

def group_variable(group, key)
  get("/groups/#{url_encode group}/variables/#{key}")
end

#group_variables(group) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of the group's build variables

Examples:

Gitlab.group_variables(5)

Parameters:

  • group (Integer, String)

    The ID or name of a group.

Returns:



74
75
76
# File 'lib/gitlab/client/build_variables.rb', line 74

def group_variables(group)
  get("/groups/#{url_encode group}/variables")
end

#remove_group_variable(group, key) ⇒ Gitlab::ObjectifiedHash

Remove a group's build variable.

Examples:

Gitlab.remove_group_variable(5, "VARIABLE_1")

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • key (String)

    The key of a variable.

Returns:



124
125
126
# File 'lib/gitlab/client/build_variables.rb', line 124

def remove_group_variable(group, key)
  delete("/groups/#{url_encode group}/variables/#{key}")
end

#remove_variable(project, key) ⇒ Gitlab::ObjectifiedHash

Remove a project's build variable.

Examples:

Gitlab.remove_variable(5, "VARIABLE_1")

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • key (String)

    The key of a variable.

Returns:



63
64
65
# File 'lib/gitlab/client/build_variables.rb', line 63

def remove_variable(project, key)
  delete("/projects/#{url_encode project}/variables/#{key}")
end

#update_group_variable(group, key, value) ⇒ Gitlab::ObjectifiedHash

Update a group's build variable.

Examples:

Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value")

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • key (String)

    The key of a variable

  • value (String)

    The value of a variable

Returns:



112
113
114
# File 'lib/gitlab/client/build_variables.rb', line 112

def update_group_variable(group, key, value)
  put("/groups/#{url_encode group}/variables/#{key}", body: { value: value })
end

#update_variable(project, key, value) ⇒ Gitlab::ObjectifiedHash

Update a project's build variable.

Examples:

Gitlab.update_variable(5, "NEW_VARIABLE", "updated value")

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • key (String)

    The key of a variable

  • value (String)

    The value of a variable

Returns:



51
52
53
# File 'lib/gitlab/client/build_variables.rb', line 51

def update_variable(project, key, value)
  put("/projects/#{url_encode project}/variables/#{key}", body: { value: value })
end

#variable(project, key) ⇒ Gitlab::ObjectifiedHash

Gets details of a project's specific build variable.

Examples:

Gitlab.variable(5, "TEST_VARIABLE_1")

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • key (String)

    The key of a variable.

Returns:



25
26
27
# File 'lib/gitlab/client/build_variables.rb', line 25

def variable(project, key)
  get("/projects/#{url_encode project}/variables/#{key}")
end

#variables(project) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of the project's build variables

Examples:

Gitlab.variables(5)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

Returns:



13
14
15
# File 'lib/gitlab/client/build_variables.rb', line 13

def variables(project)
  get("/projects/#{url_encode project}/variables")
end