Saltstack Official Apache Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

302 行
15KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=yaml
  3. ---
  4. ###############################################################################
  5. # Define all YAML node anchors
  6. ###############################################################################
  7. .node_anchors:
  8. # `only` (also used for `except` where applicable)
  9. only_branch_master_parent_repo: &only_branch_master_parent_repo
  10. - 'master@saltstack-formulas/apache-formula'
  11. # `stage`
  12. stage_lint: &stage_lint 'lint'
  13. stage_release: &stage_release 'release'
  14. stage_test: &stage_test 'test'
  15. # `image`
  16. image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
  17. image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
  18. image_precommit: &image_precommit
  19. name: 'myii/ssf-pre-commit:2.9.2'
  20. entrypoint: ['/bin/bash', '-c']
  21. image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
  22. # yamllint disable-line rule:line-length
  23. image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release-pandoc:15.14'
  24. # `services`
  25. services_docker_dind: &services_docker_dind
  26. - 'docker:dind'
  27. # `variables`
  28. # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
  29. # https://bundler.io/v1.16/bundle_config.html
  30. variables_bundler: &variables_bundler
  31. BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
  32. BUNDLE_WITHOUT: 'production'
  33. # `cache`
  34. cache_bundler: &cache_bundler
  35. key: '${CI_JOB_STAGE}'
  36. paths:
  37. - '${BUNDLE_CACHE_PATH}'
  38. ###############################################################################
  39. # Define stages and global variables
  40. ###############################################################################
  41. stages:
  42. - *stage_lint
  43. - *stage_test
  44. - *stage_release
  45. variables:
  46. DOCKER_DRIVER: 'overlay2'
  47. ###############################################################################
  48. # `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
  49. ###############################################################################
  50. commitlint:
  51. stage: *stage_lint
  52. image: *image_commitlint
  53. script:
  54. # Add `upstream` remote to get access to `upstream/master`
  55. - 'git remote add upstream
  56. https://gitlab.com/saltstack-formulas/apache-formula.git'
  57. - 'git fetch --all'
  58. # Set default commit hashes for `--from` and `--to`
  59. - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
  60. - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
  61. # `coqbot` adds a merge commit to test PRs on top of the latest commit in
  62. # the repo; amend this merge commit message to avoid failure
  63. - |
  64. if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
  65. && [ "${CI_COMMIT_BRANCH}" != "master" ]; then
  66. git commit --amend -m \
  67. 'chore: reword coqbot merge commit message for commitlint'
  68. export COMMITLINT_TO=HEAD
  69. fi
  70. # Run `commitlint`
  71. - 'commitlint --from "${COMMITLINT_FROM}"
  72. --to "${COMMITLINT_TO}"
  73. --verbose'
  74. pre-commit:
  75. stage: *stage_lint
  76. image: *image_precommit
  77. # https://pre-commit.com/#gitlab-ci-example
  78. variables:
  79. PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
  80. cache:
  81. key: '${CI_JOB_NAME}'
  82. paths:
  83. - '${PRE_COMMIT_HOME}'
  84. script:
  85. - 'pre-commit run --all-files --color always --verbose'
  86. # Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
  87. # - The `pre-commit` check will only be available for formulas that pass the default
  88. # `rubocop` check -- and must continue to do so
  89. # - This job is allowed to fail, so can be used for all formulas
  90. # - Furthermore, this job uses all of the latest `rubocop` features & cops,
  91. # which will help when upgrading the `rubocop` linter used in `pre-commit`
  92. rubocop:
  93. allow_failure: true
  94. stage: *stage_lint
  95. image: *image_rubocop
  96. script:
  97. - 'rubocop -d -P -S --enable-pending-cops'
  98. ###############################################################################
  99. # Define `test` template
  100. ###############################################################################
  101. .test_instance: &test_instance
  102. stage: *stage_test
  103. image: *image_dindruby
  104. services: *services_docker_dind
  105. variables: *variables_bundler
  106. cache: *cache_bundler
  107. before_script:
  108. # TODO: This should work from the env vars above automatically
  109. - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
  110. - 'bundle config set without "${BUNDLE_WITHOUT}"'
  111. - 'bundle install'
  112. script:
  113. # Alternative value to consider: `${CI_JOB_NAME}`
  114. - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
  115. ###############################################################################
  116. # Define `test` template (`allow_failure: true`)
  117. ###############################################################################
  118. .test_instance_failure_permitted:
  119. <<: *test_instance
  120. allow_failure: true
  121. ###############################################################################
  122. # `test` stage: each instance below uses the `test` template above
  123. ###############################################################################
  124. ## Define the rest of the matrix based on Kitchen testing
  125. # Make sure the instances listed below match up with
  126. # the `platforms` defined in `kitchen.yml`
  127. # default-debian-11-tiamat-py3: {extends: '.test_instance'}
  128. # default-debian-10-tiamat-py3: {extends: '.test_instance'}
  129. # default-debian-9-tiamat-py3: {extends: '.test_instance'}
  130. # default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
  131. # default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
  132. # default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
  133. # default-centos-8-tiamat-py3: {extends: '.test_instance'}
  134. # default-centos-7-tiamat-py3: {extends: '.test_instance'}
  135. # default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
  136. # default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
  137. # default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
  138. # default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
  139. # default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
  140. # default-debian-11-master-py3: {extends: '.test_instance'}
  141. # modules-debian-11-master-py3: {extends: '.test_instance'}
  142. debian-11-master-py3: {extends: '.test_instance'}
  143. # default-debian-10-master-py3: {extends: '.test_instance'}
  144. # modules-debian-10-master-py3: {extends: '.test_instance'}
  145. debian-10-master-py3: {extends: '.test_instance'}
  146. # default-debian-9-master-py3: {extends: '.test_instance'}
  147. # modules-debian-9-master-py3: {extends: '.test_instance'}
  148. # debian-9-master-py3: {extends: '.test_instance'}
  149. # default-ubuntu-2004-master-py3: {extends: '.test_instance'}
  150. # modules-ubuntu-2004-master-py3: {extends: '.test_instance'}
  151. ubuntu-2004-master-py3: {extends: '.test_instance'}
  152. # default-ubuntu-1804-master-py3: {extends: '.test_instance'}
  153. # modules-ubuntu-1804-master-py3: {extends: '.test_instance'}
  154. ubuntu-1804-master-py3: {extends: '.test_instance'}
  155. # default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
  156. # modules-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
  157. centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
  158. # default-centos-8-master-py3: {extends: '.test_instance'}
  159. # modules-centos-8-master-py3: {extends: '.test_instance'}
  160. centos-8-master-py3: {extends: '.test_instance'}
  161. # default-centos-7-master-py3: {extends: '.test_instance'}
  162. # modules-centos-7-master-py3: {extends: '.test_instance'}
  163. centos-7-master-py3: {extends: '.test_instance'}
  164. # default-fedora-34-master-py3: {extends: '.test_instance'}
  165. # modules-fedora-34-master-py3: {extends: '.test_instance'}
  166. fedora-34-master-py3: {extends: '.test_instance'}
  167. # default-fedora-33-master-py3: {extends: '.test_instance'}
  168. # modules-fedora-33-master-py3: {extends: '.test_instance'}
  169. fedora-33-master-py3: {extends: '.test_instance'}
  170. # default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
  171. # modules-opensuse-leap-153-master-py3: {extends: '.test_instance'}
  172. opensuse-leap-153-master-py3: {extends: '.test_instance'}
  173. # default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
  174. # modules-opensuse-leap-152-master-py3: {extends: '.test_instance'}
  175. opensuse-leap-152-master-py3: {extends: '.test_instance'}
  176. default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
  177. # modules-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
  178. # opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
  179. # https://community.letsencrypt.org/t/localhost-crt-does-not-exist-or-is-empty/103979
  180. default-amazonlinux-2-master-py3: {extends: '.test_instance'}
  181. # modules-amazonlinux-2-master-py3: {extends: '.test_instance'}
  182. # amazonlinux-2-master-py3: {extends: '.test_instance'}
  183. # default-oraclelinux-8-master-py3: {extends: '.test_instance'}
  184. # modules-oraclelinux-8-master-py3: {extends: '.test_instance'}
  185. # oraclelinux-8-master-py3: {extends: '.test_instance'}
  186. # default-oraclelinux-7-master-py3: {extends: '.test_instance'}
  187. # modules-oraclelinux-7-master-py3: {extends: '.test_instance'}
  188. oraclelinux-7-master-py3: {extends: '.test_instance'}
  189. # default-arch-base-latest-master-py3: {extends: '.test_instance'}
  190. modules-arch-base-latest-master-py3: {extends: '.test_instance'}
  191. # arch-base-latest-master-py3: {extends: '.test_instance'}
  192. # default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
  193. # modules-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
  194. # gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
  195. # default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
  196. # modules-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
  197. # gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
  198. # default-almalinux-8-master-py3: {extends: '.test_instance'}
  199. # modules-almalinux-8-master-py3: {extends: '.test_instance'}
  200. almalinux-8-master-py3: {extends: '.test_instance'}
  201. # default-rockylinux-8-master-py3: {extends: '.test_instance'}
  202. # modules-rockylinux-8-master-py3: {extends: '.test_instance'}
  203. rockylinux-8-master-py3: {extends: '.test_instance'}
  204. # default-debian-11-3004-0-py3: {extends: '.test_instance'}
  205. # default-debian-10-3004-0-py3: {extends: '.test_instance'}
  206. # default-debian-9-3004-0-py3: {extends: '.test_instance'}
  207. # default-ubuntu-2004-3004-0-py3: {extends: '.test_instance'}
  208. # default-ubuntu-1804-3004-0-py3: {extends: '.test_instance'}
  209. # default-centos-stream8-3004-0-py3: {extends: '.test_instance_failure_permitted'}
  210. # default-centos-8-3004-0-py3: {extends: '.test_instance'}
  211. # default-centos-7-3004-0-py3: {extends: '.test_instance'}
  212. # default-fedora-34-3004-0-py3: {extends: '.test_instance'}
  213. # default-fedora-33-3004-0-py3: {extends: '.test_instance'}
  214. # default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
  215. # default-opensuse-leap-152-3004-0-py3: {extends: '.test_instance'}
  216. # default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
  217. # default-amazonlinux-2-3004-0-py3: {extends: '.test_instance'}
  218. # default-oraclelinux-8-3004-0-py3: {extends: '.test_instance'}
  219. # default-oraclelinux-7-3004-0-py3: {extends: '.test_instance'}
  220. # default-arch-base-latest-3004-0-py3: {extends: '.test_instance'}
  221. # default-gentoo-stage3-latest-3004-0-py3: {extends: '.test_instance'}
  222. # default-gentoo-stage3-systemd-3004-0-py3: {extends: '.test_instance'}
  223. # default-almalinux-8-3004-0-py3: {extends: '.test_instance'}
  224. # default-rockylinux-8-3004-0-py3: {extends: '.test_instance'}
  225. # default-debian-11-3003-3-py3: {extends: '.test_instance'}
  226. # default-debian-10-3003-3-py3: {extends: '.test_instance'}
  227. # default-debian-9-3003-3-py3: {extends: '.test_instance'}
  228. # default-ubuntu-2004-3003-3-py3: {extends: '.test_instance'}
  229. # default-ubuntu-1804-3003-3-py3: {extends: '.test_instance'}
  230. # default-centos-stream8-3003-3-py3: {extends: '.test_instance_failure_permitted'}
  231. # default-centos-8-3003-3-py3: {extends: '.test_instance'}
  232. # default-centos-7-3003-3-py3: {extends: '.test_instance'}
  233. # default-fedora-34-3003-3-py3: {extends: '.test_instance'}
  234. # default-fedora-33-3003-3-py3: {extends: '.test_instance'}
  235. # default-opensuse-leap-153-3003-3-py3: {extends: '.test_instance'}
  236. # default-opensuse-leap-152-3003-3-py3: {extends: '.test_instance'}
  237. # default-opensuse-tmbl-latest-3003-3-py3: {extends: '.test_instance_failure_permitted'}
  238. # default-amazonlinux-2-3003-3-py3: {extends: '.test_instance'}
  239. # default-oraclelinux-8-3003-3-py3: {extends: '.test_instance'}
  240. # default-oraclelinux-7-3003-3-py3: {extends: '.test_instance'}
  241. # default-arch-base-latest-3003-3-py3: {extends: '.test_instance'}
  242. # default-gentoo-stage3-latest-3003-3-py3: {extends: '.test_instance'}
  243. # default-gentoo-stage3-systemd-3003-3-py3: {extends: '.test_instance'}
  244. # default-almalinux-8-3003-3-py3: {extends: '.test_instance'}
  245. # default-debian-11-3002-7-py3: {extends: '.test_instance'}
  246. # default-debian-10-3002-7-py3: {extends: '.test_instance'}
  247. # default-debian-9-3002-7-py3: {extends: '.test_instance'}
  248. # default-ubuntu-2004-3002-7-py3: {extends: '.test_instance'}
  249. # default-ubuntu-1804-3002-7-py3: {extends: '.test_instance'}
  250. # default-centos-8-3002-7-py3: {extends: '.test_instance'}
  251. # default-centos-7-3002-7-py3: {extends: '.test_instance'}
  252. # default-fedora-34-3002-7-py3: {extends: '.test_instance'}
  253. # default-fedora-33-3002-7-py3: {extends: '.test_instance'}
  254. # default-opensuse-leap-153-3002-7-py3: {extends: '.test_instance'}
  255. # default-opensuse-leap-152-3002-7-py3: {extends: '.test_instance'}
  256. # default-opensuse-tmbl-latest-3002-7-py3: {extends: '.test_instance_failure_permitted'}
  257. # default-amazonlinux-2-3002-7-py3: {extends: '.test_instance'}
  258. # default-oraclelinux-8-3002-7-py3: {extends: '.test_instance'}
  259. # default-oraclelinux-7-3002-7-py3: {extends: '.test_instance'}
  260. # default-arch-base-latest-3002-7-py3: {extends: '.test_instance'}
  261. # default-gentoo-stage3-latest-3002-7-py3: {extends: '.test_instance'}
  262. # default-gentoo-stage3-systemd-3002-7-py3: {extends: '.test_instance'}
  263. # default-debian-10-3001-8-py3: {extends: '.test_instance'}
  264. # default-debian-9-3001-8-py3: {extends: '.test_instance'}
  265. # default-ubuntu-2004-3001-8-py3: {extends: '.test_instance'}
  266. # default-ubuntu-1804-3001-8-py3: {extends: '.test_instance'}
  267. # default-centos-8-3001-8-py3: {extends: '.test_instance'}
  268. # default-centos-7-3001-8-py3: {extends: '.test_instance'}
  269. # default-fedora-34-3001-8-py3: {extends: '.test_instance'}
  270. # default-fedora-33-3001-8-py3: {extends: '.test_instance'}
  271. # default-opensuse-leap-153-3001-8-py3: {extends: '.test_instance'}
  272. # default-opensuse-leap-152-3001-8-py3: {extends: '.test_instance'}
  273. # default-opensuse-tmbl-latest-3001-8-py3: {extends: '.test_instance_failure_permitted'}
  274. # default-amazonlinux-2-3001-8-py3: {extends: '.test_instance'}
  275. # default-oraclelinux-8-3001-8-py3: {extends: '.test_instance'}
  276. # default-oraclelinux-7-3001-8-py3: {extends: '.test_instance'}
  277. # default-arch-base-latest-3001-8-py3: {extends: '.test_instance'}
  278. # default-gentoo-stage3-latest-3001-8-py3: {extends: '.test_instance'}
  279. # default-gentoo-stage3-systemd-3001-8-py3: {extends: '.test_instance'}
  280. ###############################################################################
  281. # `release` stage: `semantic-release`
  282. ###############################################################################
  283. semantic-release:
  284. only: *only_branch_master_parent_repo
  285. stage: *stage_release
  286. image: *image_semanticrelease
  287. variables:
  288. MAINTAINER_TOKEN: '${GH_TOKEN}'
  289. script:
  290. # Update `AUTHORS.md`
  291. - '${HOME}/go/bin/maintainer contributor'
  292. # Run `semantic-release`
  293. - 'semantic-release'