| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a71be72 commit 24af304
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,7 @@ Reference | |||
| 99 | 99 | + :class:`gitlab.v4.objects.DockerfileManager` | |
| 100 | 100 | + :attr:`gitlab.Gitlab.gitlabciymls` | |
| 101 | 101 | ||
| 102 | - * GitLab API: Not documented. | ||
| 102 | + * GitLab API: https://docs.gitlab.com/ce/api/templates/dockerfiles.html | ||
| 103 | 103 | ||
| 104 | 104 | Examples | |
| 105 | 105 | -------- | |
@@ -112,3 +112,73 @@ Get a Dockerfile template:: | |||
| 112 | 112 | ||
| 113 | 113 | dockerfile = gl.dockerfiles.get('Python') | |
| 114 | 114 | print(dockerfile.content) | |
| 115 | + | ||
| 116 | + Project templates | ||
| 117 | + ========================= | ||
| 118 | + | ||
| 119 | + These templates are project-specific versions of the templates above, as | ||
| 120 | + well as issue and merge request templates. | ||
| 121 | + | ||
| 122 | + Reference | ||
| 123 | + --------- | ||
| 124 | + | ||
| 125 | + * v4 API: | ||
| 126 | + | ||
| 127 | + + :class:`gitlab.v4.objects.ProjectLicenseTemplate` | ||
| 128 | + + :class:`gitlab.v4.objects.ProjectLicenseTemplateManager` | ||
| 129 | + + :attr:`gitlab.v4.objects.Project.license_templates` | ||
| 130 | + + :class:`gitlab.v4.objects.ProjectGitignoreTemplate` | ||
| 131 | + + :class:`gitlab.v4.objects.ProjectGitignoreTemplateManager` | ||
| 132 | + + :attr:`gitlab.v4.objects.Project.gitignore_templates` | ||
| 133 | + + :class:`gitlab.v4.objects.ProjectGitlabciymlTemplate` | ||
| 134 | + + :class:`gitlab.v4.objects.ProjectGitlabciymlTemplateManager` | ||
| 135 | + + :attr:`gitlab.v4.objects.Project.gitlabciyml_templates` | ||
| 136 | + + :class:`gitlab.v4.objects.ProjectDockerfileTemplate` | ||
| 137 | + + :class:`gitlab.v4.objects.ProjectDockerfileTemplateManager` | ||
| 138 | + + :attr:`gitlab.v4.objects.Project.dockerfile_templates` | ||
| 139 | + + :class:`gitlab.v4.objects.ProjectIssueTemplate` | ||
| 140 | + + :class:`gitlab.v4.objects.ProjectIssueTemplateManager` | ||
| 141 | + + :attr:`gitlab.v4.objects.Project.issue_templates` | ||
| 142 | + + :class:`gitlab.v4.objects.ProjectMergeRequestTemplate` | ||
| 143 | + + :class:`gitlab.v4.objects.ProjectMergeRequestTemplateManager` | ||
| 144 | + + :attr:`gitlab.v4.objects.Project.merge_request_templates` | ||
| 145 | + | ||
| 146 | + * GitLab API: https://docs.gitlab.com/ce/api/project_templates.html | ||
| 147 | + | ||
| 148 | + Examples | ||
| 149 | + -------- | ||
| 150 | + | ||
| 151 | + List known project templates:: | ||
| 152 | + | ||
| 153 | + license_templates = project.license_templates.list() | ||
| 154 | + gitignore_templates = project.gitignore_templates.list() | ||
| 155 | + gitlabciyml_templates = project.gitlabciyml_templates.list() | ||
| 156 | + dockerfile_templates = project.dockerfile_templates.list() | ||
| 157 | + issue_templates = project.issue_templates.list() | ||
| 158 | + merge_request_templates = project.merge_request_templates.list() | ||
| 159 | + | ||
| 160 | + Get project templates:: | ||
| 161 | + | ||
| 162 | + license_template = project.license_templates.get('apache-2.0') | ||
| 163 | + gitignore_template = project.gitignore_templates.get('Python') | ||
| 164 | + gitlabciyml_template = project.gitlabciyml_templates.get('Pelican') | ||
| 165 | + dockerfile_template = project.dockerfile_templates.get('Python') | ||
| 166 | + issue_template = project.issue_templates.get('Default') | ||
| 167 | + merge_request_template = project.merge_request_templates.get('Default') | ||
| 168 | + | ||
| 169 | + print(license_template.content) | ||
| 170 | + print(gitignore_template.content) | ||
| 171 | + print(gitlabciyml_template.content) | ||
| 172 | + print(dockerfile_template.content) | ||
| 173 | + print(issue_template.content) | ||
| 174 | + print(merge_request_template.content) | ||
| 175 | + | ||
| 176 | + Create an issue or merge request using a description template:: | ||
| 177 | + | ||
| 178 | + issue = project.issues.create({'title': 'I have a bug', | ||
| 179 | + 'description': issue_template.content}) | ||
| 180 | + mr = project.mergerequests.create({'source_branch': 'cool_feature', | ||
| 181 | + 'target_branch': 'main', | ||
| 182 | + 'title': 'merge cool feature', | ||
| 183 | + 'description': merge_request_template.content}) | ||
| 184 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments