summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-10-05 17:40:32 +0000
committerRobert Speicher <robert@gitlab.com>2018-10-05 17:40:32 +0000
commitb407061a281607e0c4bf22d2b7e94a068768ccac (patch)
tree7bfb1d7ffbde4d9aa40f3a05c1bbfb829732c807 /doc
parent2c9c7d72383c6e7232077b4949b98bb71c90e521 (diff)
parent25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64 (diff)
downloadgitlab-ce-b407061a281607e0c4bf22d2b7e94a068768ccac.tar.gz
Merge branch 'ce-5987-project-templates-api' into 'master'
Add a new project-specific templates API endpoint See merge request gitlab-org/gitlab-ce!22118
Diffstat (limited to 'doc')
-rw-r--r--doc/api/README.md4
-rw-r--r--doc/api/project_templates.md135
-rw-r--r--doc/api/templates/dockerfiles.md113
-rw-r--r--doc/api/templates/gitignores.md520
-rw-r--r--doc/api/templates/gitlab_ci_ymls.md75
5 files changed, 324 insertions, 523 deletions
diff --git a/doc/api/README.md b/doc/api/README.md
index a3589377e9d..a351db99bbd 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -20,10 +20,11 @@ following locations:
- [Custom Attributes](custom_attributes.md)
- [Deployments](deployments.md)
- [Deploy Keys](deploy_keys.md)
+- [Dockerfile templates](templates/dockerfiles.md)
- [Environments](environments.md)
- [Events](events.md)
- [Feature flags](features.md)
-- [Gitignores templates](templates/gitignores.md)
+- [Gitignore templates](templates/gitignores.md)
- [GitLab CI Config templates](templates/gitlab_ci_ymls.md)
- [Groups](groups.md)
- [Group Access Requests](access_requests.md)
@@ -55,6 +56,7 @@ following locations:
- [Project import/export](project_import_export.md)
- [Project Members](members.md)
- [Project Snippets](project_snippets.md)
+- [Project Templates](project_templates.md)
- [Protected Branches](protected_branches.md)
- [Protected Tags](protected_tags.md)
- [Repositories](repositories.md)
diff --git a/doc/api/project_templates.md b/doc/api/project_templates.md
new file mode 100644
index 00000000000..ebdfa975849
--- /dev/null
+++ b/doc/api/project_templates.md
@@ -0,0 +1,135 @@
+# Project templates API
+
+This API is a project-specific implementation of these endpoints:
+
+- [Dockerfile templates](templates/dockerfiles.md)
+- [Gitignore templates](templates/gitignores.md)
+- [GitLab CI Config templates](templates/gitlab_ci_ymls.md)
+- [Open source license templates](templates/licenses.md)
+
+It deprecates those endpoints, which will be removed for API version 5.
+
+Project-specific templates will be added to this API in time. This includes, but
+is not limited to:
+
+- [Issue and Merge Request templates](../user/project/description_templates.html)
+- [Group level file templates](https://gitlab.com/gitlab-org/gitlab-ee/issues/5987) **(Premium)**
+
+## Get all templates of a particular type
+
+```
+GET /projects/:id/templates/:type
+```
+
+| Attribute | Type | Required | Description |
+| ---------- | ------ | -------- | ----------- |
+| `id ` | integer / string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+| `type` | string | yes| The type `(dockerfiles|gitignores|gitlab_ci_ymls|licenses)` of the template |
+
+Example response (licenses):
+
+```json
+[
+ {
+ "key": "epl-1.0",
+ "name": "Eclipse Public License 1.0"
+ },
+ {
+ "key": "lgpl-3.0",
+ "name": "GNU Lesser General Public License v3.0"
+ },
+ {
+ "key": "unlicense",
+ "name": "The Unlicense"
+ },
+ {
+ "key": "agpl-3.0",
+ "name": "GNU Affero General Public License v3.0"
+ },
+ {
+ "key": "gpl-3.0",
+ "name": "GNU General Public License v3.0"
+ },
+ {
+ "key": "bsd-3-clause",
+ "name": "BSD 3-clause \"New\" or \"Revised\" License"
+ },
+ {
+ "key": "lgpl-2.1",
+ "name": "GNU Lesser General Public License v2.1"
+ },
+ {
+ "key": "mit",
+ "name": "MIT License"
+ },
+ {
+ "key": "apache-2.0",
+ "name": "Apache License 2.0"
+ },
+ {
+ "key": "bsd-2-clause",
+ "name": "BSD 2-clause \"Simplified\" License"
+ },
+ {
+ "key": "mpl-2.0",
+ "name": "Mozilla Public License 2.0"
+ },
+ {
+ "key": "gpl-2.0",
+ "name": "GNU General Public License v2.0"
+ }
+]
+```
+
+## Get one template of a particular type
+
+```
+GET /projects/:id/templates/:type/:key
+```
+
+| Attribute | Type | Required | Description |
+| ---------- | ------ | -------- | ----------- |
+| `id ` | integer / string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
+| `type` | string | yes| The type `(dockerfiles|gitignores|gitlab_ci_ymls|licenses)` of the template |
+| `key` | string | yes | The key of the template, as obtained from the collection endpoint |
+| `project` | string | no | The project name to use when expanding placeholders in the template. Only affects licenses |
+| `fullname` | string | no | The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses |
+
+Example response (Dockerfile):
+
+
+```json
+{
+ "name": "Binary",
+ "content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:jessie\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
+}
+
+```
+
+Example response (license):
+
+```json
+{
+ "key": "mit",
+ "name": "MIT License",
+ "nickname": null,
+ "popular": true,
+ "html_url": "http://choosealicense.com/licenses/mit/",
+ "source_url": "https://opensource.org/licenses/MIT",
+ "description": "A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.",
+ "conditions": [
+ "include-copyright"
+ ],
+ "permissions": [
+ "commercial-use",
+ "modifications",
+ "distribution",
+ "private-use"
+ ],
+ "limitations": [
+ "liability",
+ "warranty"
+ ],
+ "content": "MIT License\n\nCopyright (c) 2018 [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
+}
+```
diff --git a/doc/api/templates/dockerfiles.md b/doc/api/templates/dockerfiles.md
new file mode 100644
index 00000000000..a08b8d33693
--- /dev/null
+++ b/doc/api/templates/dockerfiles.md
@@ -0,0 +1,113 @@
+# Dockerfiles API
+
+## List Dockerfile templates
+
+Get all Dockerfile templates.
+
+```
+GET /templates/dockerfiles
+```
+
+```bash
+curl https://gitlab.example.com/api/v4/templates/dockerfiles
+```
+
+Example response:
+
+```json
+[
+ {
+ "key": "Binary",
+ "name": "Binary"
+ },
+ {
+ "key": "Binary-alpine",
+ "name": "Binary-alpine"
+ },
+ {
+ "key": "Binary-scratch",
+ "name": "Binary-scratch"
+ },
+ {
+ "key": "Golang",
+ "name": "Golang"
+ },
+ {
+ "key": "Golang-alpine",
+ "name": "Golang-alpine"
+ },
+ {
+ "key": "Golang-scratch",
+ "name": "Golang-scratch"
+ },
+ {
+ "key": "HTTPd",
+ "name": "HTTPd"
+ },
+ {
+ "key": "Node",
+ "name": "Node"
+ },
+ {
+ "key": "Node-alpine",
+ "name": "Node-alpine"
+ },
+ {
+ "key": "OpenJDK",
+ "name": "OpenJDK"
+ },
+ {
+ "key": "OpenJDK-alpine",
+ "name": "OpenJDK-alpine"
+ },
+ {
+ "key": "PHP",
+ "name": "PHP"
+ },
+ {
+ "key": "Python",
+ "name": "Python"
+ },
+ {
+ "key": "Python-alpine",
+ "name": "Python-alpine"
+ },
+ {
+ "key": "Python2",
+ "name": "Python2"
+ },
+ {
+ "key": "Ruby",
+ "name": "Ruby"
+ },
+ {
+ "key": "Ruby-alpine",
+ "name": "Ruby-alpine"
+ }
+]
+```
+
+## Single Dockerfile template
+
+Get a single Dockerfile template.
+
+```
+GET /templates/dockerfiles/:key
+```
+
+| Attribute | Type | Required | Description |
+| ---------- | ------ | -------- | ----------- |
+| `key` | string | yes | The key of the Dockerfile template |
+
+```bash
+curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary
+```
+
+Example response:
+
+```json
+{
+ "name": "Binary",
+ "content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:jessie\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
+}
+```
diff --git a/doc/api/templates/gitignores.md b/doc/api/templates/gitignores.md
index d3f5c88ca90..3804855129c 100644
--- a/doc/api/templates/gitignores.md
+++ b/doc/api/templates/gitignores.md
@@ -17,538 +17,84 @@ Example response:
```json
[
{
- "name": "AppEngine"
- },
- {
- "name": "Laravel"
- },
- {
- "name": "Elisp"
- },
- {
- "name": "SketchUp"
+ "key": "Actionscript",
+ "name": "Actionscript"
},
{
+ "key": "Ada",
"name": "Ada"
},
{
- "name": "Ruby"
- },
- {
- "name": "Kohana"
- },
- {
- "name": "Nanoc"
- },
- {
- "name": "Erlang"
- },
- {
- "name": "OCaml"
- },
- {
- "name": "Lithium"
- },
- {
- "name": "Fortran"
- },
- {
- "name": "Scala"
- },
- {
- "name": "Node"
- },
- {
- "name": "Fancy"
- },
- {
- "name": "Perl"
- },
- {
- "name": "Zephir"
- },
- {
- "name": "WordPress"
- },
- {
- "name": "Symfony"
- },
- {
- "name": "FuelPHP"
- },
- {
- "name": "DM"
- },
- {
- "name": "Sdcc"
- },
- {
- "name": "Rust"
- },
- {
- "name": "C"
- },
- {
- "name": "Umbraco"
- },
- {
- "name": "Actionscript"
+ "key": "Agda",
+ "name": "Agda"
},
{
+ "key": "Android",
"name": "Android"
},
{
- "name": "Grails"
- },
- {
- "name": "Composer"
- },
- {
- "name": "ExpressionEngine"
- },
- {
- "name": "Gcov"
- },
- {
- "name": "Qt"
+ "key": "AppEngine",
+ "name": "AppEngine"
},
{
- "name": "Phalcon"
+ "key": "AppceleratorTitanium",
+ "name": "AppceleratorTitanium"
},
{
+ "key": "ArchLinuxPackages",
"name": "ArchLinuxPackages"
},
{
- "name": "TeX"
- },
- {
- "name": "SCons"
- },
- {
- "name": "Lilypond"
- },
- {
- "name": "CommonLisp"
- },
- {
- "name": "Rails"
- },
- {
- "name": "Mercury"
- },
- {
- "name": "Magento"
- },
- {
- "name": "ChefCookbook"
- },
- {
- "name": "GitBook"
- },
- {
- "name": "C++"
- },
- {
- "name": "Eagle"
- },
- {
- "name": "Go"
- },
- {
- "name": "OpenCart"
- },
- {
- "name": "Scheme"
- },
- {
- "name": "Typo3"
- },
- {
- "name": "SeamGen"
- },
- {
- "name": "Swift"
- },
- {
- "name": "Elm"
- },
- {
- "name": "Unity"
- },
- {
- "name": "Agda"
- },
- {
- "name": "CUDA"
- },
- {
- "name": "VVVV"
- },
- {
- "name": "Finale"
- },
- {
- "name": "LemonStand"
- },
- {
- "name": "Textpattern"
- },
- {
- "name": "Julia"
- },
- {
- "name": "Packer"
- },
- {
- "name": "Scrivener"
- },
- {
- "name": "Dart"
- },
- {
- "name": "Plone"
- },
- {
- "name": "Jekyll"
- },
- {
- "name": "Xojo"
- },
- {
- "name": "LabVIEW"
- },
- {
+ "key": "Autotools",
"name": "Autotools"
},
{
- "name": "KiCad"
- },
- {
- "name": "Prestashop"
- },
- {
- "name": "ROS"
- },
- {
- "name": "Smalltalk"
- },
- {
- "name": "GWT"
- },
- {
- "name": "OracleForms"
- },
- {
- "name": "SugarCRM"
- },
- {
- "name": "Nim"
- },
- {
- "name": "SymphonyCMS"
+ "key": "C",
+ "name": "C"
},
{
- "name": "Maven"
+ "key": "C++",
+ "name": "C++"
},
{
+ "key": "CFWheels",
"name": "CFWheels"
},
{
- "name": "Python"
- },
- {
- "name": "ZendFramework"
- },
- {
- "name": "CakePHP"
- },
- {
- "name": "Concrete5"
- },
- {
- "name": "PlayFramework"
- },
- {
- "name": "Terraform"
- },
- {
- "name": "Elixir"
- },
- {
+ "key": "CMake",
"name": "CMake"
},
{
- "name": "Joomla"
- },
- {
- "name": "Coq"
- },
- {
- "name": "Delphi"
- },
- {
- "name": "Haskell"
- },
- {
- "name": "Yii"
- },
- {
- "name": "Java"
- },
- {
- "name": "UnrealEngine"
- },
- {
- "name": "AppceleratorTitanium"
- },
- {
- "name": "CraftCMS"
- },
- {
- "name": "ForceDotCom"
- },
- {
- "name": "ExtJs"
- },
- {
- "name": "MetaProgrammingSystem"
- },
- {
- "name": "D"
- },
- {
- "name": "Objective-C"
- },
- {
- "name": "RhodesRhomobile"
- },
- {
- "name": "R"
- },
- {
- "name": "EPiServer"
- },
- {
- "name": "Yeoman"
- },
- {
- "name": "VisualStudio"
- },
- {
- "name": "Processing"
- },
- {
- "name": "Leiningen"
- },
- {
- "name": "Stella"
- },
- {
- "name": "Opa"
- },
- {
- "name": "Drupal"
- },
- {
- "name": "TurboGears2"
- },
- {
- "name": "Idris"
- },
- {
- "name": "Jboss"
- },
- {
- "name": "CodeIgniter"
- },
- {
- "name": "Qooxdoo"
- },
- {
- "name": "Waf"
+ "key": "CUDA",
+ "name": "CUDA"
},
{
- "name": "Sass"
+ "key": "CakePHP",
+ "name": "CakePHP"
},
{
- "name": "Lua"
+ "key": "ChefCookbook",
+ "name": "ChefCookbook"
},
{
+ "key": "Clojure",
"name": "Clojure"
},
{
- "name": "IGORPro"
- },
- {
- "name": "Gradle"
- },
- {
- "name": "Archives"
- },
- {
- "name": "SynopsysVCS"
- },
- {
- "name": "Ninja"
- },
- {
- "name": "Tags"
- },
- {
- "name": "OSX"
- },
- {
- "name": "Dreamweaver"
- },
- {
- "name": "CodeKit"
- },
- {
- "name": "NotepadPP"
- },
- {
- "name": "VisualStudioCode"
- },
- {
- "name": "Mercurial"
- },
- {
- "name": "BricxCC"
- },
- {
- "name": "DartEditor"
- },
- {
- "name": "Eclipse"
- },
- {
- "name": "Cloud9"
- },
- {
- "name": "TortoiseGit"
- },
- {
- "name": "NetBeans"
- },
- {
- "name": "GPG"
- },
- {
- "name": "Espresso"
- },
- {
- "name": "Redcar"
- },
- {
- "name": "Xcode"
- },
- {
- "name": "Matlab"
- },
- {
- "name": "LyX"
- },
- {
- "name": "SlickEdit"
- },
- {
- "name": "Dropbox"
- },
- {
- "name": "CVS"
- },
- {
- "name": "Calabash"
- },
- {
- "name": "JDeveloper"
- },
- {
- "name": "Vagrant"
- },
- {
- "name": "IPythonNotebook"
- },
- {
- "name": "TextMate"
- },
- {
- "name": "Ensime"
- },
- {
- "name": "WebMethods"
- },
- {
- "name": "VirtualEnv"
- },
- {
- "name": "Emacs"
- },
- {
- "name": "Momentics"
- },
- {
- "name": "JetBrains"
- },
- {
- "name": "SublimeText"
- },
- {
- "name": "Kate"
- },
- {
- "name": "ModelSim"
- },
- {
- "name": "Redis"
- },
- {
- "name": "KDevelop4"
- },
- {
- "name": "Bazaar"
- },
- {
- "name": "Linux"
- },
- {
- "name": "Windows"
- },
- {
- "name": "XilinxISE"
- },
- {
- "name": "Lazarus"
- },
- {
- "name": "EiffelStudio"
- },
- {
- "name": "Anjuta"
- },
- {
- "name": "Vim"
- },
- {
- "name": "Otto"
- },
- {
- "name": "MicrosoftOffice"
- },
- {
- "name": "LibreOffice"
- },
- {
- "name": "SBT"
+ "key": "CodeIgniter",
+ "name": "CodeIgniter"
},
{
- "name": "MonoDevelop"
+ "key": "CommonLisp",
+ "name": "CommonLisp"
},
{
- "name": "SVN"
+ "key": "Composer",
+ "name": "Composer"
},
{
- "name": "FlexBuilder"
+ "key": "Concrete5",
+ "name": "Concrete5"
}
]
```
diff --git a/doc/api/templates/gitlab_ci_ymls.md b/doc/api/templates/gitlab_ci_ymls.md
index bdb128fc336..cecfc8cd9b9 100644
--- a/doc/api/templates/gitlab_ci_ymls.md
+++ b/doc/api/templates/gitlab_ci_ymls.md
@@ -17,79 +17,84 @@ Example response:
```json
[
{
- "name": "C++"
- },
- {
- "name": "Docker"
- },
- {
- "name": "Elixir"
- },
- {
- "name": "LaTeX"
- },
- {
- "name": "Grails"
- },
- {
- "name": "Rust"
+ "key": "Android",
+ "name": "Android"
},
{
- "name": "Nodejs"
+ "key": "Auto-DevOps",
+ "name": "Auto-DevOps"
},
{
- "name": "Ruby"
+ "key": "Bash",
+ "name": "Bash"
},
{
- "name": "Scala"
+ "key": "C++",
+ "name": "C++"
},
{
- "name": "Maven"
+ "key": "Chef",
+ "name": "Chef"
},
{
- "name": "Harp"
+ "key": "Clojure",
+ "name": "Clojure"
},
{
- "name": "Pelican"
+ "key": "Crystal",
+ "name": "Crystal"
},
{
- "name": "Hyde"
+ "key": "Django",
+ "name": "Django"
},
{
- "name": "Nanoc"
+ "key": "Docker",
+ "name": "Docker"
},
{
- "name": "Octopress"
+ "key": "Elixir",
+ "name": "Elixir"
},
{
- "name": "JBake"
+ "key": "Go",
+ "name": "Go"
},
{
- "name": "HTML"
+ "key": "Gradle",
+ "name": "Gradle"
},
{
- "name": "Hugo"
+ "key": "Grails",
+ "name": "Grails"
},
{
- "name": "Metalsmith"
+ "key": "Julia",
+ "name": "Julia"
},
{
- "name": "Hexo"
+ "key": "LaTeX",
+ "name": "LaTeX"
},
{
- "name": "Lektor"
+ "key": "Laravel",
+ "name": "Laravel"
},
{
- "name": "Doxygen"
+ "key": "Maven",
+ "name": "Maven"
},
{
- "name": "Brunch"
+ "key": "Mono",
+ "name": "Mono"
},
{
- "name": "Jekyll"
+ "key": "Nodejs",
+ "name": "Nodejs"
},
{
- "name": "Middleman"
+ "key": "OpenShift",
+ "name": "OpenShift"
}
]
```