Saltstack Official Logrotate Formula
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.

212 satır
9.7KB

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