You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
7.7 KiB

  1. // Code generated by ../../scripts/generate-const.sh DO NOT EDIT.
  2. package main
  3. //go:generate ../../scripts/generate-const.sh openAPISpecTemplate ../../api/openapi-spec/blubberoid.yaml
  4. const openAPISpecTemplate = `---
  5. openapi: '3.0.0'
  6. info:
  7. title: Blubberoid
  8. description: >
  9. Blubber is a highly opinionated abstraction for container build
  10. configurations.
  11. version: {{ .Version }}
  12. paths:
  13. /v1/{variant}:
  14. post:
  15. summary: >
  16. Generates a valid Dockerfile based on Blubber YAML configuration
  17. provided in the request body and the given variant name.
  18. requestBody:
  19. description: A valid Blubber configuration.
  20. required: true
  21. content:
  22. application/json:
  23. schema:
  24. $ref: '#/components/schemas/v4.Config'
  25. application/yaml:
  26. schema:
  27. type: string
  28. application/x-yaml:
  29. schema:
  30. type: string
  31. responses:
  32. '200':
  33. description: OK. Response body should be a valid Dockerfile.
  34. content:
  35. text/plain:
  36. schema:
  37. type: string
  38. '400':
  39. description: Bad request. The YAML request body failed to parse.
  40. '404':
  41. description: No variant name was provided in the request path.
  42. '422':
  43. description: Provided Blubber config parsed correctly but failed validation.
  44. '5XX':
  45. description: An unexpected service-side error.
  46. x-amples:
  47. - title: Mathoid test variant
  48. request:
  49. params:
  50. variant: test
  51. headers:
  52. Content-Type: application/json
  53. body: {
  54. "version": "v4",
  55. "base": "docker-registry.wikimedia.org/nodejs-slim",
  56. "apt": { "packages": ["librsvg2-2"] },
  57. "lives": { "in": "/srv/service" },
  58. "variants": {
  59. "build": {
  60. "base": "docker-registry.wikimedia.org/nodejs-devel",
  61. "apt": {
  62. "packages": ["librsvg2-dev", "git", "pkg-config", "build-essential"]
  63. },
  64. "node": { "requirements": ["package.json"] },
  65. "runs": { "environment": { "LINK": "g++" } }
  66. },
  67. "test": { "includes": ["build"], "entrypoint": ["npm", "test"] }
  68. }
  69. }
  70. response:
  71. status: 200
  72. headers:
  73. content-type: text/plain
  74. body: /^FROM docker-registry.wikimedia.org\/nodejs-devel/
  75. components:
  76. schemas:
  77. v4.Config:
  78. title: Top-level blubber configuration (version v4)
  79. allOf:
  80. - $ref: '#/components/schemas/v4.CommonConfig'
  81. - type: object
  82. properties:
  83. required: [version, variants]
  84. version:
  85. type: string
  86. description: Blubber configuration version
  87. variants:
  88. type: object
  89. description: Configuration variants (e.g. development, test, production)
  90. additionalProperties: true
  91. # OpenAPI 3.0 supports only v4 of the JSON Schema draft spec and
  92. # cannot define schema for object properties with arbitrary
  93. # names, but the following commented section is included to be
  94. # useful to humans for the time being. It patiently awaits v6
  95. # json schema draft support before its uncommenting.
  96. #
  97. # patternProperties:
  98. # "^[a-zA-Z][a-zA-Z0-9\-\.]+[a-zA-Z0-9]$":
  99. # $ref: '#/components/schemas/v4.VariantConfig'
  100. v4.CommonConfig:
  101. type: object
  102. properties:
  103. base:
  104. type: string
  105. description: Base image reference
  106. apt:
  107. type: object
  108. properties:
  109. packages:
  110. type: array
  111. description: Packages to install from APT sources of base image
  112. items:
  113. type: string
  114. node:
  115. type: object
  116. properties:
  117. env:
  118. type: string
  119. description: Node environment (e.g. production, etc.)
  120. requirements:
  121. type: array
  122. description: Files needed for Node package installation (e.g. package.json, package-lock.json)
  123. items:
  124. type: string
  125. python:
  126. type: object
  127. properties:
  128. version:
  129. type: string
  130. description: Python binary present in the system (e.g. python3)
  131. requirements:
  132. type: array
  133. description: Files needed for Python package installation (e.g. requirements.txt, etc.)
  134. items:
  135. type: string
  136. builder:
  137. type: object
  138. properties:
  139. command:
  140. type: array
  141. description: Command and arguments of an arbitrary build command
  142. items:
  143. type: string
  144. requirements:
  145. type: array
  146. description: Files needed by the build command (e.g. Makefile, ./src/, etc.)
  147. items:
  148. type: string
  149. lives:
  150. type: object
  151. properties:
  152. as:
  153. type: string
  154. description: Owner (name) of application files within the container
  155. uid:
  156. type: integer
  157. description: Owner (UID) of application files within the container
  158. gid:
  159. type: integer
  160. description: Group owner (GID) of application files within the container
  161. in:
  162. type: string
  163. description: Application working directory within the container
  164. runs:
  165. type: object
  166. properties:
  167. as:
  168. type: string
  169. description: Runtime process owner (name) of application entrypoint
  170. uid:
  171. type: integer
  172. description: Runtime process owner (UID) of application entrypoint
  173. gid:
  174. type: integer
  175. description: Runtime process group (GID) of application entrypoint
  176. environment:
  177. type: object
  178. description: Environment variables and values to be set before entrypoint execution
  179. additionalProperties: true
  180. insecurely:
  181. type: boolean
  182. description: Skip dropping of priviledge to the runtime process owner before entrypoint execution
  183. entrypoint:
  184. type: array
  185. description: Runtime entry point command and arguments
  186. items:
  187. type: string
  188. v4.VariantConfig:
  189. allOf:
  190. - $ref: '#/components/schemas/v4.CommonConfig'
  191. - type: object
  192. properties:
  193. includes:
  194. type: array
  195. description: Names of other variants to inherit configuration from
  196. items:
  197. description: Variant name
  198. type: string
  199. copies:
  200. type: string
  201. description: Name of variant from which to copy application files, resulting in a multi-stage build
  202. artifacts:
  203. type: array
  204. items:
  205. type: object
  206. description: Artifacts to copy from another variant, resulting in a multi-stage build
  207. required: [from, source, destination]
  208. properties:
  209. from:
  210. type: string
  211. description: Variant name
  212. source:
  213. type: string
  214. description: Path of files/directories to copy
  215. destination:
  216. type: string
  217. description: Destination path
  218. `