Skip to content

Commit 5af0b52

Browse files
authored
Merge pull request #768 from python-gitlab/trigger_token_example
docs: Add an example of trigger token usage
2 parents 101ccd1 + ea1eefe commit 5af0b52

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/gl_objects/builds.rst

+10
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ Full example with wait for finish::
9494
pipeline.refresh()
9595
time.sleep(1)
9696

97+
You can trigger a pipeline using token authentication instead of user
98+
authentication. To do so create an anonymous Gitlab instance and use lazy
99+
objects to get the associated project::
100+
101+
gl = gitlab.Gitlab(URL) # no authentication
102+
project = gl.projects.get(project_id, lazy=True) # no API call
103+
project.trigger_pipeline('master', trigger_token)
104+
105+
Reference: https://docs.gitlab.com/ee/ci/triggers/#trigger-token
106+
97107
Pipeline schedule
98108
=================
99109

0 commit comments

Comments
 (0)