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.

151 lines
3.4 KiB

  1. local PipelineLinting = {
  2. kind: 'pipeline',
  3. name: 'linting',
  4. platform: {
  5. os: 'linux',
  6. arch: 'amd64',
  7. },
  8. steps: [
  9. {
  10. name: 'ansible-later',
  11. image: 'xoxys/ansible-later',
  12. commands: [
  13. 'ansible-later',
  14. ],
  15. },
  16. ],
  17. trigger: {
  18. ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
  19. },
  20. };
  21. local PipelineDeployment(scenario='centos7') = {
  22. kind: 'pipeline',
  23. name: 'testing-' + scenario,
  24. platform: {
  25. os: 'linux',
  26. arch: 'amd64',
  27. },
  28. concurrency: {
  29. limit: 1,
  30. },
  31. workspace: {
  32. base: '/drone/src',
  33. path: '${DRONE_REPO_NAME}',
  34. },
  35. steps: [
  36. {
  37. name: 'ansible-molecule',
  38. image: 'xoxys/molecule:3',
  39. environment: {
  40. DO_API_KEY: { from_secret: 'do_api_key' },
  41. MOLECULE_CUSTOM_MODULES_REPO: 'https://gitea.rknet.org/ansible/custom_modules',
  42. MOLECULE_CUSTOM_FILTERS_REPO: 'https://gitea.rknet.org/ansible/custom_filters',
  43. },
  44. commands: [
  45. 'molecule test -s' + scenario,
  46. ],
  47. },
  48. ],
  49. depends_on: [
  50. 'linting',
  51. ],
  52. trigger: {
  53. ref: ['refs/heads/master', 'refs/tags/**'],
  54. },
  55. };
  56. local PipelineDocumentation = {
  57. kind: 'pipeline',
  58. name: 'documentation',
  59. platform: {
  60. os: 'linux',
  61. arch: 'amd64',
  62. },
  63. steps: [
  64. {
  65. name: 'generate',
  66. image: 'xoxys/ansible-doctor',
  67. environment: {
  68. ANSIBLE_DOCTOR_LOG_LEVEL: 'INFO',
  69. ANSIBLE_DOCTOR_FORCE_OVERWRITE: true,
  70. ANSIBLE_DOCTOR_EXCLUDE_FILES: 'molecule/',
  71. ANSIBLE_DOCTOR_TEMPLATE: 'hugo-book',
  72. ANSIBLE_DOCTOR_ROLE_NAME: '${DRONE_REPO_NAME#*.}',
  73. ANSIBLE_DOCTOR_OUTPUT_DIR: '_docs/',
  74. },
  75. },
  76. {
  77. name: 'publish',
  78. image: 'plugins/gh-pages',
  79. settings: {
  80. remote_url: 'https://gitea.rknet.org/ansible/${DRONE_REPO_NAME}',
  81. netrc_machine: 'gitea.rknet.org',
  82. username: { from_secret: 'gitea_username' },
  83. password: { from_secret: 'gitea_token' },
  84. pages_directory: '_docs/',
  85. target_branch: 'docs',
  86. },
  87. when: {
  88. ref: ['refs/heads/master'],
  89. },
  90. },
  91. {
  92. name: 'trigger',
  93. image: 'plugins/downstream',
  94. settings: {
  95. server: 'https://drone.rknet.org',
  96. token: { from_secret: 'drone_token' },
  97. fork: true,
  98. repositories: [
  99. 'ansible/galaxy',
  100. ],
  101. },
  102. when: {
  103. ref: ['refs/heads/master'],
  104. },
  105. },
  106. ],
  107. trigger: {
  108. ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
  109. },
  110. };
  111. local PipelineNotification = {
  112. kind: 'pipeline',
  113. name: 'notification',
  114. platform: {
  115. os: 'linux',
  116. arch: 'amd64',
  117. },
  118. clone: {
  119. disable: true,
  120. },
  121. steps: [
  122. {
  123. name: 'matrix',
  124. image: 'plugins/matrix',
  125. settings: {
  126. homeserver: { from_secret: 'matrix_homeserver' },
  127. roomid: { from_secret: 'matrix_roomid' },
  128. template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
  129. username: { from_secret: 'matrix_username' },
  130. password: { from_secret: 'matrix_password' },
  131. },
  132. },
  133. ],
  134. depends_on: [
  135. 'documentation',
  136. ],
  137. trigger: {
  138. status: ['success', 'failure'],
  139. ref: ['refs/heads/master', 'refs/tags/**'],
  140. },
  141. };
  142. [
  143. PipelineLinting,
  144. PipelineDocumentation,
  145. PipelineNotification,
  146. ]