Module: Gitlab::Client::PipelineSchedules

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

Overview

Defines methods related to pipeline schedules.

Instance Method Summary collapse

Instance Method Details

#create_pipeline_schedule(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Create a pipeline schedule.

Examples:

Gitlab.create_pipeline_schedule(5, { description: 'example' }) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

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

    A customizable set of options.

Options Hash (options):

  • :description (String)

    The description of pipeline scehdule.

  • :ref (String)

    The branch/tag name will be triggered.

  • :cron (String)

    The cron (e.g. 0 1 * * *).

  • :cron_timezone (String)

    The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: ‘UTC’).

  • :active (Boolean)

    The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).

Returns:

 58 59 60
# File 'lib/gitlab/client/pipeline_schedules.rb', line 58 def create_pipeline_schedule(project, options = {}) post("/projects/#{url_encode project}/pipeline_schedules", body: options) end 

#create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Create a pipeline schedule variable.

Examples:

Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' }) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • trigger_id (Integer)

    The pipeline schedule ID.

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

    A customizable set of options.

Options Hash (options):

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

 127 128 129
# File 'lib/gitlab/client/pipeline_schedules.rb', line 127 def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {}) post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", body: options) end 

#delete_pipeline_schedule(project, pipeline_schedule_id) ⇒ Gitlab::ObjectifiedHash

Delete a pipeline schedule.

Examples:

Gitlab.delete_pipeline_schedule(5, 1) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • trigger_id (Integer)

    The pipeline schedule ID.

Returns:

 112 113 114
# File 'lib/gitlab/client/pipeline_schedules.rb', line 112 def delete_pipeline_schedule(project, pipeline_schedule_id) delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}") end 

#delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, _options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Delete the variable of a pipeline schedule

Examples:

Gitlab.delete_pipeline_schedule_variable(3, 2, "foo") 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • The (Integer)

    pipeline schedule ID.

  • The (String)

    key of a variable.

Returns:

 155 156 157
# File 'lib/gitlab/client/pipeline_schedules.rb', line 155 def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, _options = {}) delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}") end 

#edit_pipeline_schedule(project, pipeline_schedule_id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Updates the pipeline schedule of a project.

Examples:

Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' }) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • The (Integer)

    pipeline schedule ID.

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

    A customizable set of options.

Options Hash (options):

  • :description (String)

    The description of pipeline scehdule.

  • :ref (String)

    The branch/tag name will be triggered.

  • :cron (String)

    The cron (e.g. 0 1 * * *).

  • :cron_timezone (String)

    The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: ‘UTC’).

  • :active (Boolean)

    The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).

Returns:

 76 77 78
# File 'lib/gitlab/client/pipeline_schedules.rb', line 76 def edit_pipeline_schedule(project, pipeline_schedule_id, options = {}) put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", body: options) end 

#edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Updates the variable of a pipeline schedule.

Examples:

Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' }) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • The (Integer)

    pipeline schedule ID.

  • The (String)

    key of a variable.

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

    A customizable set of options.

Options Hash (options):

  • :value (String)

    The value of a variable.

Returns:

 142 143 144
# File 'lib/gitlab/client/pipeline_schedules.rb', line 142 def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {}) put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", body: options) end 

#pipeline_schedule(project, id) ⇒ Gitlab::ObjectifiedHash

Gets a single pipeline schedule.

Examples:

Gitlab.pipeline_schedule(5, 3) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of the pipeline schedule.

Returns:

 29 30 31
# File 'lib/gitlab/client/pipeline_schedules.rb', line 29 def pipeline_schedule(project, id) get("/projects/#{url_encode project}/pipeline_schedules/#{id}") end 

#pipeline_schedule_take_ownership(project, pipeline_schedule_id) ⇒ Gitlab::ObjectifiedHash

Take ownership of a pipeline schedule.

Examples:

Gitlab.pipeline_schedule_take_ownership(5, 1) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • trigger_id (Integer)

    The pipeline schedule ID.

Returns:

 88 89 90
# File 'lib/gitlab/client/pipeline_schedules.rb', line 88 def pipeline_schedule_take_ownership(project, pipeline_schedule_id) post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership") end 

#pipeline_schedules(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of project pipeline schedules.

Examples:

Gitlab.pipeline_schedules(5) Gitlab.pipeline_schedules(5, { scope: 'active' }) 

Parameters:

  • project (Integer, String)

    the ID or name of a project.

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

    A customizable set of options.

Returns:

 17 18 19
# File 'lib/gitlab/client/pipeline_schedules.rb', line 17 def pipeline_schedules(project, options = {}) get("/projects/#{url_encode project}/pipeline_schedules", query: options) end 

#pipelines_by_pipeline_schedule(project, id) ⇒ Array<Gitlab::ObjectifiedHash>

Get all pipelines triggered by a pipeline schedule

Examples:

Gitlab.pipelines_by_pipeline_schedule(5, 3) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of the pipeline schedule.

Returns:

 41 42 43
# File 'lib/gitlab/client/pipeline_schedules.rb', line 41 def pipelines_by_pipeline_schedule(project, id) get("/projects/#{url_encode project}/pipeline_schedules/#{id}/pipelines") end 

#run_pipeline_schedule(project, pipeline_schedule_id) ⇒ Gitlab::ObjectifiedHash

Run a scheduled pipeline immediately.

Examples:

Gitlab.run_pipeline_schedule(5, 1) 

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • trigger_id (Integer)

    The pipeline schedule ID.

Returns:

 100 101 102
# File 'lib/gitlab/client/pipeline_schedules.rb', line 100 def run_pipeline_schedule(project, pipeline_schedule_id) post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/play") end