| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2c34237 commit 5292ffb
49 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,48 +25,29 @@ References | |||
| 25 | 25 | + :class:`gitlab.v4.objects.GroupAccessRequestManager` | |
| 26 | 26 | + :attr:`gitlab.v4.objects.Group.accessrequests` | |
| 27 | 27 | ||
| 28 | - * v3 API: | ||
| 29 | - | ||
| 30 | - + :class:`gitlab.v3.objects.ProjectAccessRequest` | ||
| 31 | - + :class:`gitlab.v3.objects.ProjectAccessRequestManager` | ||
| 32 | - + :attr:`gitlab.v3.objects.Project.accessrequests` | ||
| 33 | - + :attr:`gitlab.Gitlab.project_accessrequests` | ||
| 34 | - + :class:`gitlab.v3.objects.GroupAccessRequest` | ||
| 35 | - + :class:`gitlab.v3.objects.GroupAccessRequestManager` | ||
| 36 | - + :attr:`gitlab.v3.objects.Group.accessrequests` | ||
| 37 | - + :attr:`gitlab.Gitlab.group_accessrequests` | ||
| 38 | - | ||
| 39 | 28 | * GitLab API: https://docs.gitlab.com/ce/api/access_requests.html | |
| 40 | 29 | ||
| 41 | 30 | Examples | |
| 42 | 31 | -------- | |
| 43 | 32 | ||
| 44 | - List access requests from projects and groups: | ||
| 45 | - | ||
| 46 | - .. literalinclude:: access_requests.py | ||
| 47 | - :start-after: # list | ||
| 48 | - :end-before: # end list | ||
| 49 | - | ||
| 50 | - Get a single request: | ||
| 33 | + List access requests from projects and groups:: | ||
| 51 | 34 | ||
| 52 | - .. literalinclude:: access_requests.py | ||
| 53 | - :start-after: # get | ||
| 54 | - :end-before: # end get | ||
| 35 | + p_ars = project.accessrequests.list() | ||
| 36 | + g_ars = group.accessrequests.list() | ||
| 55 | 37 | ||
| 56 | - Create an access request: | ||
| 38 | + Create an access request:: | ||
| 57 | 39 | ||
| 58 | - .. literalinclude:: access_requests.py | ||
| 59 | - :start-after: # create | ||
| 60 | - :end-before: # end create | ||
| 40 | + p_ar = project.accessrequests.create({}) | ||
| 41 | + g_ar = group.accessrequests.create({}) | ||
| 61 | 42 | ||
| 62 | - Approve an access request: | ||
| 43 | + Approve an access request:: | ||
| 63 | 44 | ||
| 64 | - .. literalinclude:: access_requests.py | ||
| 65 | - :start-after: # approve | ||
| 66 | - :end-before: # end approve | ||
| 45 | + ar.approve() # defaults to DEVELOPER level | ||
| 46 | + ar.approve(access_level=gitlab.MASTER_ACCESS) # explicitly set access level | ||
| 67 | 47 | ||
| 68 | - Deny (delete) an access request: | ||
| 48 | + Deny (delete) an access request:: | ||
| 69 | 49 | ||
| 70 | - .. literalinclude:: access_requests.py | ||
| 71 | - :start-after: # delete | ||
| 72 | - :end-before: # end delete | ||
| 50 | + project.accessrequests.delete(user_id) | ||
| 51 | + group.accessrequests.delete(user_id) | ||
| 52 | + # or | ||
| 53 | + ar.delete() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,46 +11,34 @@ References | |||
| 11 | 11 | + :class:`gitlab.v4.objects.ProjectBranchManager` | |
| 12 | 12 | + :attr:`gitlab.v4.objects.Project.branches` | |
| 13 | 13 | ||
| 14 | - * v3 API: | ||
| 15 | - | ||
| 16 | - + :class:`gitlab.v3.objects.ProjectBranch` | ||
| 17 | - + :class:`gitlab.v3.objects.ProjectBranchManager` | ||
| 18 | - + :attr:`gitlab.v3.objects.Project.branches` | ||
| 19 | - | ||
| 20 | 14 | * GitLab API: https://docs.gitlab.com/ce/api/branches.html | |
| 21 | 15 | ||
| 22 | 16 | Examples | |
| 23 | 17 | -------- | |
| 24 | 18 | ||
| 25 | - Get the list of branches for a repository: | ||
| 19 | + Get the list of branches for a repository:: | ||
| 26 | 20 | ||
| 27 | - .. literalinclude:: branches.py | ||
| 28 | - :start-after: # list | ||
| 29 | - :end-before: # end list | ||
| 21 | + branches = project.branches.list() | ||
| 30 | 22 | ||
| 31 | - Get a single repository branch: | ||
| 23 | + Get a single repository branch:: | ||
| 32 | 24 | ||
| 33 | - .. literalinclude:: branches.py | ||
| 34 | - :start-after: # get | ||
| 35 | - :end-before: # end get | ||
| 25 | + branch = project.branches.get('master') | ||
| 36 | 26 | ||
| 37 | - Create a repository branch: | ||
| 27 | + Create a repository branch:: | ||
| 38 | 28 | ||
| 39 | - .. literalinclude:: branches.py | ||
| 40 | - :start-after: # create | ||
| 41 | - :end-before: # end create | ||
| 29 | + branch = project.branches.create({'branch': 'feature1', | ||
| 30 | + 'ref': 'master'}) | ||
| 42 | 31 | ||
| 43 | - Delete a repository branch: | ||
| 32 | + Delete a repository branch:: | ||
| 44 | 33 | ||
| 45 | - .. literalinclude:: branches.py | ||
| 46 | - :start-after: # delete | ||
| 47 | - :end-before: # end delete | ||
| 34 | + project.branches.delete('feature1') | ||
| 35 | + # or | ||
| 36 | + branch.delete() | ||
| 48 | 37 | ||
| 49 | - Protect/unprotect a repository branch: | ||
| 38 | + Protect/unprotect a repository branch:: | ||
| 50 | 39 | ||
| 51 | - .. literalinclude:: branches.py | ||
| 52 | - :start-after: # protect | ||
| 53 | - :end-before: # end protect | ||
| 40 | + branch.protect() | ||
| 41 | + branch.unprotect() | ||
| 54 | 42 | ||
| 55 | 43 | .. note:: | |
| 56 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,6 @@ | |||
| 1 | - ########################## | ||
| 2 | - Pipelines, Builds and Jobs | ||
| 3 | - ########################## | ||
| 4 | - | ||
| 5 | - Build and job are two classes representing the same object. Builds are used in | ||
| 6 | - v3 API, jobs in v4 API. | ||
| 1 | + ################## | ||
| 2 | + Pipelines and Jobs | ||
| 3 | + ################## | ||
| 7 | 4 | ||
| 8 | 5 | Project pipelines | |
| 9 | 6 | ================= | |
@@ -19,13 +16,6 @@ Reference | |||
| 19 | 16 | + :class:`gitlab.v4.objects.ProjectPipelineManager` | |
| 20 | 17 | + :attr:`gitlab.v4.objects.Project.pipelines` | |
| 21 | 18 | ||
| 22 | - * v3 API: | ||
| 23 | - | ||
| 24 | - + :class:`gitlab.v3.objects.ProjectPipeline` | ||
| 25 | - + :class:`gitlab.v3.objects.ProjectPipelineManager` | ||
| 26 | - + :attr:`gitlab.v3.objects.Project.pipelines` | ||
| 27 | - + :attr:`gitlab.Gitlab.project_pipelines` | ||
| 28 | - | ||
| 29 | 19 | * GitLab API: https://docs.gitlab.com/ce/api/pipelines.html | |
| 30 | 20 | ||
| 31 | 21 | Examples | |
@@ -66,13 +56,6 @@ Reference | |||
| 66 | 56 | + :class:`gitlab.v4.objects.ProjectTriggerManager` | |
| 67 | 57 | + :attr:`gitlab.v4.objects.Project.triggers` | |
| 68 | 58 | ||
| 69 | - * v3 API: | ||
| 70 | - | ||
| 71 | - + :class:`gitlab.v3.objects.ProjectTrigger` | ||
| 72 | - + :class:`gitlab.v3.objects.ProjectTriggerManager` | ||
| 73 | - + :attr:`gitlab.v3.objects.Project.triggers` | ||
| 74 | - + :attr:`gitlab.Gitlab.project_triggers` | ||
| 75 | - | ||
| 76 | 59 | * GitLab API: https://docs.gitlab.com/ce/api/pipeline_triggers.html | |
| 77 | 60 | ||
| 78 | 61 | Examples | |
@@ -88,8 +71,7 @@ Get a trigger:: | |||
| 88 | 71 | ||
| 89 | 72 | Create a trigger:: | |
| 90 | 73 | ||
| 91 | - trigger = project.triggers.create({}) # v3 | ||
| 92 | - trigger = project.triggers.create({'description': 'mytrigger'}) # v4 | ||
| 74 | + trigger = project.triggers.create({'description': 'mytrigger'}) | ||
| 93 | 75 | ||
| 94 | 76 | Remove a trigger:: | |
| 95 | 77 | ||
@@ -190,13 +172,6 @@ Reference | |||
| 190 | 172 | + :class:`gitlab.v4.objects.GroupVariableManager` | |
| 191 | 173 | + :attr:`gitlab.v4.objects.Group.variables` | |
| 192 | 174 | ||
| 193 | - * v3 API | ||
| 194 | - | ||
| 195 | - + :class:`gitlab.v3.objects.ProjectVariable` | ||
| 196 | - + :class:`gitlab.v3.objects.ProjectVariableManager` | ||
| 197 | - + :attr:`gitlab.v3.objects.Project.variables` | ||
| 198 | - + :attr:`gitlab.Gitlab.project_variables` | ||
| 199 | - | ||
| 200 | 175 | * GitLab API | |
| 201 | 176 | ||
| 202 | 177 | + https://docs.gitlab.com/ce/api/project_level_variables.html | |
@@ -232,11 +207,11 @@ Remove a variable:: | |||
| 232 | 207 | # or | |
| 233 | 208 | var.delete() | |
| 234 | 209 | ||
| 235 | - Builds/Jobs | ||
| 236 | - =========== | ||
| 210 | + Jobs | ||
| 211 | + ==== | ||
| 237 | 212 | ||
| 238 | - Builds/Jobs are associated to projects, pipelines and commits. They provide | ||
| 239 | - information on the builds/jobs that have been run, and methods to manipulate | ||
| 213 | + Jobs are associated to projects, pipelines and commits. They provide | ||
| 214 | + information on the jobs that have been run, and methods to manipulate | ||
| 240 | 215 | them. | |
| 241 | 216 | ||
| 242 | 217 | Reference | |
@@ -248,13 +223,6 @@ Reference | |||
| 248 | 223 | + :class:`gitlab.v4.objects.ProjectJobManager` | |
| 249 | 224 | + :attr:`gitlab.v4.objects.Project.jobs` | |
| 250 | 225 | ||
| 251 | - * v3 API | ||
| 252 | - | ||
| 253 | - + :class:`gitlab.v3.objects.ProjectJob` | ||
| 254 | - + :class:`gitlab.v3.objects.ProjectJobManager` | ||
| 255 | - + :attr:`gitlab.v3.objects.Project.jobs` | ||
| 256 | - + :attr:`gitlab.Gitlab.project_jobs` | ||
| 257 | - | ||
| 258 | 226 | * GitLab API: https://docs.gitlab.com/ce/api/jobs.html | |
| 259 | 227 | ||
| 260 | 228 | Examples | |
@@ -268,32 +236,21 @@ job:: | |||
| 268 | 236 | ||
| 269 | 237 | List jobs for the project:: | |
| 270 | 238 | ||
| 271 | - builds = project.builds.list() # v3 | ||
| 272 | - jobs = project.jobs.list() # v4 | ||
| 273 | - | ||
| 274 | - To list builds for a specific commit, create a | ||
| 275 | - :class:`~gitlab.v3.objects.ProjectCommit` object and use its | ||
| 276 | - :attr:`~gitlab.v3.objects.ProjectCommit.builds` method (v3 only):: | ||
| 277 | - | ||
| 278 | - # v3 only | ||
| 279 | - commit = gl.project_commits.get(commit_sha, project_id=1) | ||
| 280 | - builds = commit.builds() | ||
| 239 | + jobs = project.jobs.list() | ||
| 281 | 240 | ||
| 282 | 241 | To list builds for a specific pipeline or get a single job within a specific | |
| 283 | 242 | pipeline, create a | |
| 284 | 243 | :class:`~gitlab.v4.objects.ProjectPipeline` object and use its | |
| 285 | - :attr:`~gitlab.v4.objects.ProjectPipeline.jobs` method (v4 only):: | ||
| 244 | + :attr:`~gitlab.v4.objects.ProjectPipeline.jobs` method:: | ||
| 286 | 245 | ||
| 287 | - # v4 only | ||
| 288 | 246 | project = gl.projects.get(project_id) | |
| 289 | 247 | pipeline = project.pipelines.get(pipeline_id) | |
| 290 | 248 | jobs = pipeline.jobs.list() # gets all jobs in pipeline | |
| 291 | 249 | job = pipeline.jobs.get(job_id) # gets one job from pipeline | |
| 292 | 250 | ||
| 293 | 251 | Get a job:: | |
| 294 | 252 | ||
| 295 | - project.builds.get(build_id) # v3 | ||
| 296 | - project.jobs.get(job_id) # v4 | ||
| 253 | + project.jobs.get(job_id) | ||
| 297 | 254 | ||
| 298 | 255 | Get the artifacts of a job:: | |
| 299 | 256 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments