Skip to content

Commit 673dc36

Browse files
author
Gauvain Pocentek
committed
Implement ProjectBuild.play()
1 parent d4a24a5 commit 673dc36

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

docs/gl_objects/builds.py

+4
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,7 @@ def __call__(self, chunk):
106106
# erase
107107
build.erase()
108108
# end erase
109+
110+
# play
111+
build.play()
112+
# end play

docs/gl_objects/builds.rst

+6
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ Cancel/retry a build:
150150
:start-after: # retry
151151
:end-before: # end retry
152152

153+
Play (trigger) a build:
154+
155+
.. literalinclude:: builds.py
156+
:start-after: # play
157+
:end-before: # end play
158+
153159
Erase a build (artifacts and trace):
154160

155161
.. literalinclude:: builds.py

gitlab/exceptions.py

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class GitlabBuildRetryError(GitlabRetryError):
9595
pass
9696

9797

98+
class GitlabBuildPlayError(GitlabRetryError):
99+
pass
100+
101+
98102
class GitlabBuildEraseError(GitlabRetryError):
99103
pass
100104

gitlab/objects.py

+6
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,12 @@ def retry(self, **kwargs):
961961
r = self.gitlab._raw_post(url)
962962
raise_error_from_response(r, GitlabBuildRetryError, 201)
963963

964+
def play(self, **kwargs):
965+
"""Trigger a build explicitly."""
966+
url = '/projects/%s/builds/%s/play' % (self.project_id, self.id)
967+
r = self.gitlab._raw_post(url)
968+
raise_error_from_response(r, GitlabBuildPlayError, 201)
969+
964970
def erase(self, **kwargs):
965971
"""Erase the build (remove build artifacts and trace)."""
966972
url = '/projects/%s/builds/%s/erase' % (self.project_id, self.id)

0 commit comments

Comments
 (0)