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

211 行
9.6KB

  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/salt-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 'dafyddj/ci-dind-python-ruby:2.0.0'
  18. image_precommit: &image_precommit 'dafyddj/ci-pre-commit:2.0.2'
  19. image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
  20. image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
  21. # `services`
  22. services_docker_dind: &services_docker_dind
  23. - 'docker:dind'
  24. # `variables`
  25. # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
  26. # https://bundler.io/v1.16/bundle_config.html
  27. variables_bundler: &variables_bundler
  28. BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
  29. BUNDLE_WITHOUT: 'production'
  30. # `cache`
  31. cache_bundler: &cache_bundler
  32. key: '${CI_JOB_STAGE}'
  33. paths:
  34. - '${BUNDLE_CACHE_PATH}'
  35. ###############################################################################
  36. # Define stages and global variables
  37. ###############################################################################
  38. stages:
  39. - *stage_lint
  40. - *stage_test
  41. - *stage_release
  42. variables:
  43. DOCKER_DRIVER: 'overlay2'
  44. ###############################################################################
  45. # `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
  46. ###############################################################################
  47. commitlint:
  48. stage: *stage_lint
  49. image: *image_commitlint
  50. script:
  51. # Add `upstream` remote to get access to `upstream/master`
  52. - 'git remote add upstream
  53. https://gitlab.com/saltstack-formulas/salt-formula.git'
  54. - 'git fetch --all'
  55. # Set default commit hashes for `--from` and `--to`
  56. - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
  57. - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
  58. # `coqbot` adds a merge commit to test PRs on top of the latest commit in
  59. # the repo; amend this merge commit message to avoid failure
  60. - |
  61. if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
  62. && [ "${CI_COMMIT_BRANCH}" != "master" ]; then
  63. git commit --amend -m \
  64. 'chore: reword coqbot merge commit message for commitlint'
  65. export COMMITLINT_TO=HEAD
  66. fi
  67. # Run `commitlint`
  68. - 'commitlint --from "${COMMITLINT_FROM}"
  69. --to "${COMMITLINT_TO}"
  70. --verbose'
  71. pre-commit:
  72. stage: *stage_lint
  73. image: *image_precommit
  74. # https://pre-commit.com/#gitlab-ci-example
  75. variables:
  76. PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
  77. cache:
  78. key: '${CI_JOB_NAME}'
  79. paths:
  80. - '${PRE_COMMIT_HOME}'
  81. script:
  82. - 'pre-commit run --all-files --color always --verbose'
  83. # Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
  84. # - The `pre-commit` check will only be available for formulas that pass the default
  85. # `rubocop` check -- and must continue to do so
  86. # - This job is allowed to fail, so can be used for all formulas
  87. # - Furthermore, this job uses all of the latest `rubocop` features & cops,
  88. # which will help when upgrading the `rubocop` linter used in `pre-commit`
  89. rubocop:
  90. allow_failure: true
  91. stage: *stage_lint
  92. image: *image_rubocop
  93. script:
  94. - 'rubocop -d -P -S --enable-pending-cops'
  95. ###############################################################################
  96. # Define `test` template
  97. ###############################################################################
  98. .test_instance: &test_instance
  99. stage: *stage_test
  100. image: *image_dindruby
  101. services: *services_docker_dind
  102. variables: *variables_bundler
  103. cache: *cache_bundler
  104. before_script:
  105. # TODO: This should work from the env vars above automatically
  106. - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
  107. - 'bundle config set without "${BUNDLE_WITHOUT}"'
  108. - 'bundle install'
  109. script:
  110. # Alternative value to consider: `${CI_JOB_NAME}`
  111. - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
  112. ###############################################################################
  113. # Define `test` template (`allow_failure: true`)
  114. ###############################################################################
  115. .test_instance_failure_permitted:
  116. <<: *test_instance
  117. allow_failure: true
  118. ###############################################################################
  119. # `test` stage: each instance below uses the `test` template above
  120. ###############################################################################
  121. ## Define the rest of the matrix based on Kitchen testing
  122. # Make sure the instances listed below match up with
  123. # the `platforms` defined in `kitchen.yml`
  124. # yamllint disable rule:line-length
  125. # default-debian-11-tiamat-py3: {extends: '.test_instance'}
  126. # default-debian-10-tiamat-py3: {extends: '.test_instance'}
  127. # default-debian-9-tiamat-py3: {extends: '.test_instance'}
  128. # default-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'}
  129. # default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
  130. # default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
  131. # default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
  132. # default-centos-7-tiamat-py3: {extends: '.test_instance'}
  133. # default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
  134. # default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
  135. # default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
  136. # default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
  137. # default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
  138. # default-debian-11-master-py3: {extends: '.test_instance'}
  139. # default-debian-10-master-py3: {extends: '.test_instance'}
  140. # default-debian-9-master-py3: {extends: '.test_instance'}
  141. # default-ubuntu-2204-master-py3: {extends: '.test_instance_failure_permitted'}
  142. # default-ubuntu-2004-master-py3: {extends: '.test_instance'}
  143. # default-ubuntu-1804-master-py3: {extends: '.test_instance'}
  144. # default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
  145. # default-centos-7-master-py3: {extends: '.test_instance'}
  146. # default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'}
  147. # default-fedora-35-master-py3: {extends: '.test_instance'}
  148. # default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
  149. # default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
  150. # default-amazonlinux-2-master-py3: {extends: '.test_instance'}
  151. # default-oraclelinux-8-master-py3: {extends: '.test_instance'}
  152. # default-oraclelinux-7-master-py3: {extends: '.test_instance'}
  153. # default-arch-base-latest-master-py3: {extends: '.test_instance'}
  154. # default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
  155. # default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
  156. # default-almalinux-8-master-py3: {extends: '.test_instance'}
  157. # default-rockylinux-8-master-py3: {extends: '.test_instance'}
  158. default-debian-11-3004-1-py3: {extends: '.test_instance'}
  159. # default-debian-10-3004-1-py3: {extends: '.test_instance'}
  160. # default-debian-9-3004-1-py3: {extends: '.test_instance'}
  161. default-ubuntu-2204-3004-1-py3: {extends: '.test_instance_failure_permitted'}
  162. default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'}
  163. # default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'}
  164. default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'}
  165. # default-centos-7-3004-1-py3: {extends: '.test_instance'}
  166. default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'}
  167. default-fedora-35-3004-1-py3: {extends: '.test_instance'}
  168. default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'}
  169. default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'}
  170. # default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'}
  171. default-arch-base-latest-3004-1-py3: {extends: '.test_instance'}
  172. default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'}
  173. default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'}
  174. default-almalinux-8-3004-1-py3: {extends: '.test_instance'}
  175. default-rockylinux-8-3004-1-py3: {extends: '.test_instance'}
  176. default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
  177. default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
  178. default-debian-10-3003-4-py3: {extends: '.test_instance'}
  179. default-debian-9-3003-4-py3: {extends: '.test_instance'}
  180. # default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'}
  181. default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'}
  182. # default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'}
  183. default-centos-7-3003-4-py3: {extends: '.test_instance'}
  184. # default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'}
  185. # default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'}
  186. default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'}
  187. # default-almalinux-8-3003-4-py3: {extends: '.test_instance'}
  188. # yamllint enable rule:line-length
  189. ###############################################################################
  190. # `release` stage: `semantic-release`
  191. ###############################################################################
  192. semantic-release:
  193. only: *only_branch_master_parent_repo
  194. stage: *stage_release
  195. image: *image_semanticrelease
  196. variables:
  197. MAINTAINER_TOKEN: '${GH_TOKEN}'
  198. script:
  199. # Update `AUTHORS.md`
  200. - '${HOME}/go/bin/maintainer contributor'
  201. # Run `semantic-release`
  202. - 'semantic-release'