- Notifications
You must be signed in to change notification settings - Fork673
Feature/pipeline schedules#398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1496,6 +1496,18 @@ class ProjectFileManager(BaseManager): | ||
obj_cls = ProjectFile | ||
class ProjectPipelineSchedule(GitlabObject): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't think pipelines schedule are implemented in the v3 API, so this file should probably not be changed. | ||
_url = '/projects/%(project_id)s/pipeline_schedules' | ||
_create_url = '/projects/%(project_id)s/pipeline_schedules' | ||
requiredUrlAttrs = ['project_id'] | ||
requiredCreateAttrs = ['description', 'ref', 'cron'] | ||
class ProjectPipelineSchedulesManager(BaseManager): | ||
obj_cls = ProjectPipelineSchedule | ||
class ProjectPipeline(GitlabObject): | ||
_url = '/projects/%(project_id)s/pipelines' | ||
_create_url = '/projects/%(project_id)s/pipeline' | ||
@@ -1803,6 +1815,7 @@ class Project(GitlabObject): | ||
('notificationsettings', 'ProjectNotificationSettingsManager', | ||
[('project_id', 'id')]), | ||
('pipelines', 'ProjectPipelineManager', [('project_id', 'id')]), | ||
('pipeline_schedules', 'ProjectPipelineSchedulesManager', [('project_id', 'id')]), | ||
('runners', 'ProjectRunnerManager', [('project_id', 'id')]), | ||
('services', 'ProjectServiceManager', [('project_id', 'id')]), | ||
('snippets', 'ProjectSnippetManager', [('project_id', 'id')]), | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1706,7 +1706,23 @@ def raw(self, file_path, ref, streamed=False, action=None, chunk_size=1024, | ||
return utils.response_content(result, streamed, action, chunk_size) | ||
class ProjectPipelineJob(ProjectJob): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Pipeline jobs support has already be implemented, could you remove these items? | ||
pass | ||
class ProjectPipelineJobsManager(ListMixin, RESTManager): | ||
_path = '/projects/%(project_id)s/pipelines/%(pipeline_id)s/jobs' | ||
_obj_cls = ProjectPipelineJob | ||
_from_parent_attrs = {'project_id': 'project_id', | ||
'pipeline_id' : 'id'} | ||
_list_filters = ('scope',) | ||
class ProjectPipeline(RESTObject): | ||
_managers = ( | ||
('jobs', 'ProjectPipelineJobsManager'), | ||
) | ||
@cli.register_custom_action('ProjectPipeline') | ||
@exc.on_http_error(exc.GitlabPipelineCancelError) | ||
def cancel(self, **kwargs): | ||
@@ -1764,6 +1780,65 @@ def create(self, data, **kwargs): | ||
return CreateMixin.create(self, data, path=path, **kwargs) | ||
class ProjectPipelineScheduleVariable(SaveMixin, ObjectDeleteMixin, RESTObject): | ||
_id_attr = 'key' | ||
class ProjectPipelineScheduleVariableManager(CRUDMixin, RESTManager): | ||
_path = '/projects/%(project_id)s/pipeline_schedules/%(pipeline_schedule_id)s/variables' | ||
_obj_cls = ProjectPipelineScheduleVariable | ||
_from_parent_attrs = {'project_id': 'project_id', | ||
'pipeline_schedule_id' : 'id'} | ||
_create_attrs = (('pipeline_schedule_id', 'key', 'value'), tuple()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can remove this line since you redefine _create_attrs on the next line. | ||
_create_attrs = (('key', 'value'), tuple()) | ||
def list(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm not sure it's a good idea to implement this method. I'd like to avoid adding features that are not directly coming from the GitLab API. I'd rather remove this method. | ||
array = [] | ||
if 'variables' in self._parent._attrs: | ||
for variable in self._parent._attrs['variables']: | ||
schedule_variable = self._obj_cls(self, variable) | ||
array.append(schedule_variable) | ||
else: | ||
obj = self._parent.manager.get(self._parent.id) | ||
for variable in obj._attrs['variables']: | ||
schedule_variable = self._obj_cls(self, variable) | ||
array.append(schedule_variable) | ||
return array | ||
class ProjectPipelineSchedule(RESTObject): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. GitLab supports updating and deleting these resources, so you need to add the | ||
_managers = ( | ||
('variables', 'ProjectPipelineScheduleVariableManager'), | ||
) | ||
class ProjectPipelineSchedulesManager(RetrieveMixin, CreateMixin, RESTManager): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. And the class should be called | ||
_path = '/projects/%(project_id)s/pipeline_schedules' | ||
_obj_cls = ProjectPipelineSchedule | ||
_from_parent_attrs = {'project_id': 'id'} | ||
_create_attrs = (('description', 'ref', 'cron'), | ||
('cron_timezone', 'active')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Could you define the | ||
def create(self, data, **kwargs): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't think you need this method (you're just calling the mixin method). | ||
"""Creates a new object. | ||
Args: | ||
data (dict): Parameters to send to the server to create the | ||
resource | ||
**kwargs: Extra options to send to the server (e.g. sudo) | ||
Raises: | ||
GitlabAuthenticationError: If authentication is not correct | ||
GitlabCreateError: If the server cannot perform the request | ||
Returns: | ||
RESTObject: A new instance of the managed object class build with | ||
the data sent by the server | ||
""" | ||
return CreateMixin.create(self, data, path=self.path, **kwargs) | ||
class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject): | ||
pass | ||
@@ -2035,6 +2110,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): | ||
('notificationsettings', 'ProjectNotificationSettingsManager'), | ||
('pipelines', 'ProjectPipelineManager'), | ||
('protectedbranches', 'ProjectProtectedBranchManager'), | ||
('pipeline_schedules', 'ProjectPipelineSchedulesManager'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Could you use | ||
('runners', 'ProjectRunnerManager'), | ||
('services', 'ProjectServiceManager'), | ||
('snippets', 'ProjectSnippetManager'), | ||