diff options
author | Colin D Bennett <colin.bennett@harman.com> | 2015-12-30 12:34:24 -0800 |
---|---|---|
committer | Colin D Bennett <colin.bennett@harman.com> | 2016-01-12 11:07:17 -0800 |
commit | 33710088913c96db8eb22289e693682b41054e39 (patch) | |
tree | 687b11aca21a049e9d0761bd0edbc55bff8ab18d /gitlab/objects.py | |
parent | 1d7ebea727c2fa68135ef4290dfe51604d843688 (diff) | |
download | gitlab-33710088913c96db8eb22289e693682b41054e39.tar.gz |
Support setting commit status
Support commit status updates. Commit status can be set by a POST to
the appropriate commit URL. The status can be updated by a subsequent
POST to the same URL with the same `name` and `ref`, but different
values for `state`, `description`, etc.
Note: Listing the commit statuses is not yet supported. This is done
through a different path on the server, under the `repository` path.
Example of use from the CLI:
# add a build status to a commit
gitlab project-commit-status create --project-id 2 \
--commit-id a43290c --state success --name ci/jenkins \
--target-url http://server/build/123 \
--description "Jenkins build succeeded"
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 2ab2a52..baffec8 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -681,6 +681,22 @@ class ProjectCommitManager(BaseManager): obj_cls = ProjectCommit +class ProjectCommitStatus(GitlabObject): + _url = '/projects/%(project_id)s/statuses/%(commit_id)s' + canUpdate = False + canDelete = False + requiredUrlAttrs = ['project_id', 'commit_id'] + requiredCreateAttrs = ['state'] + optionalCreateAttrs = ['description', 'name', 'ref', 'target_url'] + requiredGetAttrs = [] + requiredUpdateAttrs = [] + requiredDeleteAttrs = [] + + +class ProjectCommitStatusManager(BaseManager): + obj_cls = ProjectCommitStatus + + class ProjectKey(GitlabObject): _url = '/projects/%(project_id)s/keys' canUpdate = False @@ -961,6 +977,7 @@ class Project(GitlabObject): managers = [ ('branches', ProjectBranchManager, [('project_id', 'id')]), ('commits', ProjectCommitManager, [('project_id', 'id')]), + ('commitstatuses', ProjectCommitStatusManager, [('project_id', 'id')]), ('events', ProjectEventManager, [('project_id', 'id')]), ('files', ProjectFileManager, [('project_id', 'id')]), ('forks', ProjectForkManager, [('project_id', 'id')]), |