blob: 3d51bcdbce52032bf0cd4d0f636abfc086e6d400 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# frozen_string_literal: true
module QA
module Resource
class PipelineSchedules < Base
attribute :id
attribute :ref
attribute :description
# Cron schedule form "* * * * *"
# String of integers in order of "minute hour day-of-month month day-of-week"
attribute :cron
attribute :project do
Resource::Project.fabricate! do |project|
project.name = 'project-with-pipeline-schedule'
end
end
def initialize
@cron = '0 * * * *' # default to schedule at the beginning of the hour
@description = 'QA test scheduling pipeline.'
@ref = project.default_branch
end
def api_get_path
"/projects/#{project.id}/pipeline_schedules/#{id}"
end
def api_post_path
"/projects/#{project.id}/pipeline_schedules"
end
def api_post_body
{
description: description,
ref: ref,
cron: cron
}
end
private
def resource_web_url(resource)
resource = resource.has_key?(:owner) ? resource.fetch(:owner) : resource
super
end
end
end
end
|