infrahub-server 1.1.6__py3-none-any.whl → 1.2.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. infrahub/api/artifact.py +16 -4
  2. infrahub/api/dependencies.py +8 -0
  3. infrahub/api/oauth2.py +0 -1
  4. infrahub/api/oidc.py +0 -1
  5. infrahub/api/query.py +18 -7
  6. infrahub/api/schema.py +32 -6
  7. infrahub/api/transformation.py +12 -5
  8. infrahub/{message_bus/messages/check_artifact_create.py → artifacts/models.py} +5 -3
  9. infrahub/{message_bus/operations/check/artifact.py → artifacts/tasks.py} +26 -25
  10. infrahub/cli/__init__.py +0 -2
  11. infrahub/cli/db.py +6 -7
  12. infrahub/cli/events.py +8 -3
  13. infrahub/cli/git_agent.py +9 -7
  14. infrahub/cli/tasks.py +4 -6
  15. infrahub/computed_attribute/models.py +1 -1
  16. infrahub/computed_attribute/tasks.py +64 -17
  17. infrahub/computed_attribute/triggers.py +90 -0
  18. infrahub/config.py +1 -1
  19. infrahub/context.py +39 -0
  20. infrahub/core/account.py +5 -8
  21. infrahub/core/attribute.py +54 -22
  22. infrahub/core/branch/models.py +4 -4
  23. infrahub/core/branch/tasks.py +137 -129
  24. infrahub/core/changelog/__init__.py +0 -0
  25. infrahub/core/changelog/diff.py +283 -0
  26. infrahub/core/changelog/models.py +499 -0
  27. infrahub/core/constants/__init__.py +43 -2
  28. infrahub/core/constants/infrahubkind.py +1 -0
  29. infrahub/core/constants/schema.py +2 -0
  30. infrahub/core/diff/combiner.py +12 -8
  31. infrahub/core/diff/coordinator.py +49 -70
  32. infrahub/core/diff/data_check_synchronizer.py +86 -7
  33. infrahub/core/diff/enricher/aggregated.py +3 -3
  34. infrahub/core/diff/enricher/cardinality_one.py +7 -7
  35. infrahub/core/diff/enricher/hierarchy.py +22 -7
  36. infrahub/core/diff/enricher/labels.py +19 -4
  37. infrahub/core/diff/enricher/path_identifier.py +7 -9
  38. infrahub/core/diff/enricher/summary_counts.py +3 -1
  39. infrahub/core/diff/merger/merger.py +8 -4
  40. infrahub/core/diff/model/path.py +76 -35
  41. infrahub/core/diff/parent_node_adder.py +78 -0
  42. infrahub/core/diff/payload_builder.py +13 -2
  43. infrahub/core/diff/query/all_conflicts.py +6 -3
  44. infrahub/core/diff/query/artifact.py +1 -1
  45. infrahub/core/diff/query/delete_query.py +1 -1
  46. infrahub/core/diff/query/diff_get.py +3 -2
  47. infrahub/core/diff/query/diff_summary.py +1 -1
  48. infrahub/core/diff/query/field_specifiers.py +3 -1
  49. infrahub/core/diff/query/field_summary.py +3 -2
  50. infrahub/core/diff/query/filters.py +14 -3
  51. infrahub/core/diff/query/get_conflict_query.py +1 -1
  52. infrahub/core/diff/query/has_conflicts_query.py +6 -3
  53. infrahub/core/diff/query/merge.py +3 -3
  54. infrahub/core/diff/query/{drop_tracking_id.py → merge_tracking_id.py} +4 -4
  55. infrahub/core/diff/query/roots_metadata.py +9 -2
  56. infrahub/core/diff/query/save.py +233 -142
  57. infrahub/core/diff/query/summary_counts_enricher.py +267 -0
  58. infrahub/core/diff/query/time_range_query.py +3 -2
  59. infrahub/core/diff/query/update_conflict_query.py +1 -1
  60. infrahub/core/diff/query_parser.py +49 -24
  61. infrahub/core/diff/repository/deserializer.py +32 -28
  62. infrahub/core/diff/repository/repository.py +215 -41
  63. infrahub/core/diff/tasks.py +13 -12
  64. infrahub/core/enums.py +1 -1
  65. infrahub/core/graph/__init__.py +1 -1
  66. infrahub/core/graph/index.py +3 -0
  67. infrahub/core/integrity/object_conflict/conflict_recorder.py +1 -1
  68. infrahub/core/ipam/reconciler.py +1 -1
  69. infrahub/core/ipam/tasks.py +2 -3
  70. infrahub/core/manager.py +20 -15
  71. infrahub/core/merge.py +5 -2
  72. infrahub/core/migrations/graph/__init__.py +4 -0
  73. infrahub/core/migrations/graph/m001_add_version_to_graph.py +1 -1
  74. infrahub/core/migrations/graph/m002_attribute_is_default.py +2 -2
  75. infrahub/core/migrations/graph/m003_relationship_parent_optional.py +2 -2
  76. infrahub/core/migrations/graph/m004_add_attr_documentation.py +1 -1
  77. infrahub/core/migrations/graph/m005_add_rel_read_only.py +1 -1
  78. infrahub/core/migrations/graph/m006_add_rel_on_delete.py +1 -1
  79. infrahub/core/migrations/graph/m007_add_rel_allow_override.py +1 -1
  80. infrahub/core/migrations/graph/m008_add_human_friendly_id.py +1 -1
  81. infrahub/core/migrations/graph/m009_add_generate_profile_attr.py +1 -1
  82. infrahub/core/migrations/graph/m010_add_generate_profile_attr_generic.py +1 -1
  83. infrahub/core/migrations/graph/m011_remove_profile_relationship_schema.py +2 -2
  84. infrahub/core/migrations/graph/m012_convert_account_generic.py +12 -23
  85. infrahub/core/migrations/graph/m013_convert_git_password_credential.py +7 -11
  86. infrahub/core/migrations/graph/m014_remove_index_attr_value.py +2 -2
  87. infrahub/core/migrations/graph/m015_diff_format_update.py +1 -1
  88. infrahub/core/migrations/graph/m016_diff_delete_bug_fix.py +1 -1
  89. infrahub/core/migrations/graph/m017_add_core_profile.py +1 -1
  90. infrahub/core/migrations/graph/m018_uniqueness_nulls.py +2 -2
  91. infrahub/core/migrations/graph/m019_restore_rels_to_time.py +256 -0
  92. infrahub/core/migrations/graph/m020_add_generate_template_attr.py +48 -0
  93. infrahub/core/migrations/query/attribute_add.py +1 -1
  94. infrahub/core/migrations/query/attribute_rename.py +1 -1
  95. infrahub/core/migrations/query/delete_element_in_schema.py +1 -1
  96. infrahub/core/migrations/query/node_duplicate.py +39 -19
  97. infrahub/core/migrations/query/relationship_duplicate.py +1 -1
  98. infrahub/core/migrations/query/schema_attribute_update.py +1 -1
  99. infrahub/core/migrations/schema/node_attribute_remove.py +1 -1
  100. infrahub/core/migrations/schema/node_remove.py +27 -13
  101. infrahub/core/migrations/schema/tasks.py +5 -5
  102. infrahub/core/migrations/shared.py +4 -4
  103. infrahub/core/models.py +7 -8
  104. infrahub/core/node/__init__.py +170 -46
  105. infrahub/core/node/base.py +1 -1
  106. infrahub/core/node/constraints/grouped_uniqueness.py +9 -2
  107. infrahub/core/node/delete_validator.py +4 -4
  108. infrahub/core/node/ipam.py +13 -8
  109. infrahub/core/node/permissions.py +4 -0
  110. infrahub/core/node/resource_manager/ip_prefix_pool.py +8 -5
  111. infrahub/core/node/standard.py +3 -5
  112. infrahub/core/property.py +1 -1
  113. infrahub/core/protocols.py +6 -0
  114. infrahub/core/protocols_base.py +4 -2
  115. infrahub/core/query/__init__.py +2 -5
  116. infrahub/core/query/attribute.py +9 -9
  117. infrahub/core/query/branch.py +5 -5
  118. infrahub/core/query/delete.py +1 -1
  119. infrahub/core/query/diff.py +45 -7
  120. infrahub/core/query/ipam.py +4 -4
  121. infrahub/core/query/node.py +19 -14
  122. infrahub/core/query/relationship.py +213 -26
  123. infrahub/core/query/resource_manager.py +13 -11
  124. infrahub/core/query/standard_node.py +6 -6
  125. infrahub/core/query/task.py +3 -3
  126. infrahub/core/query/task_log.py +1 -1
  127. infrahub/core/query/utils.py +5 -5
  128. infrahub/core/registry.py +0 -2
  129. infrahub/core/relationship/constraints/count.py +1 -1
  130. infrahub/core/relationship/constraints/peer_kind.py +1 -1
  131. infrahub/core/relationship/model.py +76 -38
  132. infrahub/core/schema/__init__.py +6 -4
  133. infrahub/core/schema/attribute_schema.py +8 -0
  134. infrahub/core/schema/basenode_schema.py +13 -3
  135. infrahub/core/schema/definitions/core/__init__.py +153 -0
  136. infrahub/core/schema/definitions/core/account.py +168 -0
  137. infrahub/core/schema/definitions/core/artifact.py +127 -0
  138. infrahub/core/schema/definitions/core/builtin.py +21 -0
  139. infrahub/core/schema/definitions/core/check.py +60 -0
  140. infrahub/core/schema/definitions/core/generator.py +96 -0
  141. infrahub/core/schema/definitions/core/graphql_query.py +77 -0
  142. infrahub/core/schema/definitions/core/group.py +105 -0
  143. infrahub/core/schema/definitions/core/ipam.py +252 -0
  144. infrahub/core/schema/definitions/core/lineage.py +17 -0
  145. infrahub/core/schema/definitions/core/menu.py +46 -0
  146. infrahub/core/schema/definitions/core/permission.py +161 -0
  147. infrahub/core/schema/definitions/core/profile.py +29 -0
  148. infrahub/core/schema/definitions/core/propose_change.py +88 -0
  149. infrahub/core/schema/definitions/core/propose_change_comment.py +188 -0
  150. infrahub/core/schema/definitions/core/propose_change_validator.py +326 -0
  151. infrahub/core/schema/definitions/core/repository.py +280 -0
  152. infrahub/core/schema/definitions/core/resource_pool.py +180 -0
  153. infrahub/core/schema/definitions/core/template.py +12 -0
  154. infrahub/core/schema/definitions/core/transform.py +87 -0
  155. infrahub/core/schema/definitions/core/webhook.py +108 -0
  156. infrahub/core/schema/definitions/internal.py +16 -0
  157. infrahub/core/schema/generated/genericnode_schema.py +5 -0
  158. infrahub/core/schema/generated/node_schema.py +5 -0
  159. infrahub/core/schema/generic_schema.py +5 -1
  160. infrahub/core/schema/manager.py +45 -42
  161. infrahub/core/schema/node_schema.py +4 -0
  162. infrahub/core/schema/profile_schema.py +4 -0
  163. infrahub/core/schema/relationship_schema.py +10 -2
  164. infrahub/core/schema/schema_branch.py +260 -16
  165. infrahub/core/schema/template_schema.py +36 -0
  166. infrahub/core/task/user_task.py +7 -5
  167. infrahub/core/timestamp.py +3 -3
  168. infrahub/core/utils.py +3 -2
  169. infrahub/core/validators/attribute/choices.py +1 -1
  170. infrahub/core/validators/attribute/enum.py +1 -1
  171. infrahub/core/validators/attribute/kind.py +1 -1
  172. infrahub/core/validators/attribute/length.py +1 -1
  173. infrahub/core/validators/attribute/optional.py +1 -1
  174. infrahub/core/validators/attribute/regex.py +1 -1
  175. infrahub/core/validators/attribute/unique.py +1 -1
  176. infrahub/core/validators/checks_runner.py +37 -0
  177. infrahub/core/validators/node/generate_profile.py +1 -1
  178. infrahub/core/validators/node/hierarchy.py +1 -1
  179. infrahub/core/validators/query.py +1 -1
  180. infrahub/core/validators/relationship/count.py +1 -1
  181. infrahub/core/validators/relationship/optional.py +1 -1
  182. infrahub/core/validators/relationship/peer.py +1 -1
  183. infrahub/core/validators/tasks.py +8 -6
  184. infrahub/core/validators/uniqueness/query.py +20 -17
  185. infrahub/database/__init__.py +16 -2
  186. infrahub/database/memgraph.py +1 -1
  187. infrahub/dependencies/builder/constraint/grouped/node_runner.py +0 -2
  188. infrahub/dependencies/builder/diff/combiner.py +1 -1
  189. infrahub/dependencies/builder/diff/conflicts_enricher.py +1 -1
  190. infrahub/dependencies/builder/diff/coordinator.py +0 -2
  191. infrahub/dependencies/builder/diff/deserializer.py +4 -2
  192. infrahub/dependencies/builder/diff/enricher/hierarchy.py +3 -1
  193. infrahub/dependencies/builder/diff/enricher/summary_counts.py +1 -1
  194. infrahub/dependencies/builder/diff/parent_node_adder.py +8 -0
  195. infrahub/events/artifact_action.py +76 -0
  196. infrahub/events/branch_action.py +50 -21
  197. infrahub/events/group_action.py +117 -0
  198. infrahub/events/models.py +164 -51
  199. infrahub/events/node_action.py +70 -8
  200. infrahub/events/repository_action.py +8 -8
  201. infrahub/events/schema_action.py +21 -8
  202. infrahub/exceptions.py +9 -0
  203. infrahub/generators/models.py +1 -0
  204. infrahub/generators/tasks.py +34 -15
  205. infrahub/git/base.py +3 -5
  206. infrahub/git/constants.py +0 -1
  207. infrahub/git/integrator.py +60 -36
  208. infrahub/git/models.py +80 -1
  209. infrahub/git/repository.py +7 -8
  210. infrahub/git/tasks.py +432 -112
  211. infrahub/git_credential/helper.py +2 -3
  212. infrahub/graphql/analyzer.py +572 -11
  213. infrahub/graphql/app.py +34 -26
  214. infrahub/graphql/auth/query_permission_checker/anonymous_checker.py +5 -5
  215. infrahub/graphql/auth/query_permission_checker/default_branch_checker.py +4 -4
  216. infrahub/graphql/auth/query_permission_checker/merge_operation_checker.py +4 -4
  217. infrahub/graphql/auth/query_permission_checker/object_permission_checker.py +28 -35
  218. infrahub/graphql/auth/query_permission_checker/super_admin_checker.py +5 -5
  219. infrahub/graphql/context.py +33 -0
  220. infrahub/graphql/enums.py +1 -1
  221. infrahub/graphql/initialization.py +5 -1
  222. infrahub/graphql/loaders/node.py +2 -2
  223. infrahub/graphql/manager.py +63 -63
  224. infrahub/graphql/mutations/account.py +20 -13
  225. infrahub/graphql/mutations/artifact_definition.py +16 -12
  226. infrahub/graphql/mutations/branch.py +86 -40
  227. infrahub/graphql/mutations/computed_attribute.py +24 -13
  228. infrahub/graphql/mutations/diff.py +54 -14
  229. infrahub/graphql/mutations/diff_conflict.py +14 -8
  230. infrahub/graphql/mutations/generator.py +83 -0
  231. infrahub/graphql/mutations/graphql_query.py +19 -11
  232. infrahub/graphql/mutations/ipam.py +25 -23
  233. infrahub/graphql/mutations/main.py +243 -50
  234. infrahub/graphql/mutations/menu.py +10 -10
  235. infrahub/graphql/mutations/proposed_change.py +36 -28
  236. infrahub/graphql/mutations/relationship.py +343 -104
  237. infrahub/graphql/mutations/repository.py +41 -35
  238. infrahub/graphql/mutations/resource_manager.py +26 -26
  239. infrahub/graphql/mutations/schema.py +66 -33
  240. infrahub/graphql/mutations/tasks.py +16 -10
  241. infrahub/graphql/parser.py +1 -1
  242. infrahub/graphql/permissions.py +3 -10
  243. infrahub/graphql/queries/account.py +22 -18
  244. infrahub/graphql/queries/branch.py +6 -4
  245. infrahub/graphql/queries/diff/tree.py +63 -52
  246. infrahub/graphql/queries/event.py +115 -0
  247. infrahub/graphql/queries/internal.py +3 -3
  248. infrahub/graphql/queries/ipam.py +23 -18
  249. infrahub/graphql/queries/relationship.py +11 -10
  250. infrahub/graphql/queries/resource_manager.py +43 -27
  251. infrahub/graphql/queries/search.py +9 -8
  252. infrahub/graphql/queries/status.py +12 -9
  253. infrahub/graphql/queries/task.py +11 -9
  254. infrahub/graphql/resolvers/resolver.py +69 -43
  255. infrahub/graphql/resolvers/single_relationship.py +16 -10
  256. infrahub/graphql/schema.py +4 -0
  257. infrahub/graphql/subscription/__init__.py +1 -1
  258. infrahub/graphql/subscription/events.py +1 -1
  259. infrahub/graphql/subscription/graphql_query.py +8 -8
  260. infrahub/graphql/types/branch.py +2 -2
  261. infrahub/graphql/types/common.py +6 -1
  262. infrahub/graphql/types/context.py +12 -0
  263. infrahub/graphql/types/enums.py +2 -0
  264. infrahub/graphql/types/event.py +158 -0
  265. infrahub/graphql/types/interface.py +2 -2
  266. infrahub/graphql/types/node.py +3 -3
  267. infrahub/graphql/types/permission.py +2 -2
  268. infrahub/graphql/types/relationship.py +3 -3
  269. infrahub/graphql/types/standard_node.py +9 -11
  270. infrahub/graphql/utils.py +28 -182
  271. infrahub/groups/tasks.py +2 -3
  272. infrahub/lock.py +21 -21
  273. infrahub/menu/generator.py +0 -1
  274. infrahub/menu/menu.py +116 -138
  275. infrahub/menu/models.py +4 -4
  276. infrahub/message_bus/__init__.py +11 -13
  277. infrahub/message_bus/messages/__init__.py +0 -14
  278. infrahub/message_bus/messages/check_generator_run.py +1 -3
  279. infrahub/message_bus/messages/event_branch_merge.py +3 -0
  280. infrahub/message_bus/messages/proposed_change/request_proposedchange_refreshartifacts.py +6 -0
  281. infrahub/message_bus/messages/request_proposedchange_pipeline.py +2 -0
  282. infrahub/message_bus/messages/send_echo_request.py +1 -1
  283. infrahub/message_bus/operations/__init__.py +4 -13
  284. infrahub/message_bus/operations/check/__init__.py +2 -2
  285. infrahub/message_bus/operations/check/generator.py +1 -3
  286. infrahub/message_bus/operations/event/branch.py +7 -3
  287. infrahub/message_bus/operations/event/schema.py +1 -1
  288. infrahub/message_bus/operations/event/worker.py +0 -3
  289. infrahub/message_bus/operations/finalize/validator.py +1 -1
  290. infrahub/message_bus/operations/git/file.py +2 -2
  291. infrahub/message_bus/operations/git/repository.py +1 -1
  292. infrahub/message_bus/operations/requests/__init__.py +0 -4
  293. infrahub/message_bus/operations/requests/generator_definition.py +2 -4
  294. infrahub/message_bus/operations/requests/proposed_change.py +37 -20
  295. infrahub/message_bus/operations/send/echo.py +1 -1
  296. infrahub/message_bus/types.py +1 -1
  297. infrahub/permissions/__init__.py +2 -1
  298. infrahub/permissions/globals.py +15 -0
  299. infrahub/permissions/types.py +26 -0
  300. infrahub/pools/prefix.py +29 -165
  301. infrahub/prefect_server/__init__.py +0 -0
  302. infrahub/prefect_server/app.py +18 -0
  303. infrahub/prefect_server/database.py +20 -0
  304. infrahub/prefect_server/events.py +28 -0
  305. infrahub/prefect_server/models.py +46 -0
  306. infrahub/proposed_change/models.py +18 -1
  307. infrahub/proposed_change/tasks.py +195 -53
  308. infrahub/pytest_plugin.py +4 -4
  309. infrahub/server.py +13 -12
  310. infrahub/services/__init__.py +148 -63
  311. infrahub/services/adapters/cache/__init__.py +11 -11
  312. infrahub/services/adapters/cache/nats.py +42 -25
  313. infrahub/services/adapters/cache/redis.py +3 -11
  314. infrahub/services/adapters/event/__init__.py +10 -18
  315. infrahub/services/adapters/http/__init__.py +0 -5
  316. infrahub/services/adapters/http/httpx.py +22 -15
  317. infrahub/services/adapters/message_bus/__init__.py +25 -8
  318. infrahub/services/adapters/message_bus/local.py +9 -7
  319. infrahub/services/adapters/message_bus/nats.py +14 -8
  320. infrahub/services/adapters/message_bus/rabbitmq.py +23 -10
  321. infrahub/services/adapters/workflow/__init__.py +11 -8
  322. infrahub/services/adapters/workflow/local.py +27 -6
  323. infrahub/services/adapters/workflow/worker.py +23 -7
  324. infrahub/services/component.py +43 -40
  325. infrahub/services/protocols.py +7 -7
  326. infrahub/services/scheduler.py +30 -29
  327. infrahub/storage.py +2 -4
  328. infrahub/task_manager/constants.py +1 -1
  329. infrahub/task_manager/event.py +261 -0
  330. infrahub/task_manager/models.py +147 -3
  331. infrahub/task_manager/task.py +1 -1
  332. infrahub/tasks/artifact.py +19 -18
  333. infrahub/tasks/registry.py +1 -1
  334. infrahub/tasks/telemetry.py +13 -14
  335. infrahub/transformations/tasks.py +3 -5
  336. infrahub/trigger/__init__.py +0 -0
  337. infrahub/trigger/catalogue.py +16 -0
  338. infrahub/trigger/constants.py +9 -0
  339. infrahub/trigger/models.py +105 -0
  340. infrahub/trigger/tasks.py +91 -0
  341. infrahub/types.py +1 -1
  342. infrahub/utils.py +1 -1
  343. infrahub/webhook/constants.py +0 -2
  344. infrahub/webhook/models.py +161 -40
  345. infrahub/webhook/tasks.py +123 -202
  346. infrahub/webhook/triggers.py +27 -0
  347. infrahub/workers/infrahub_async.py +36 -25
  348. infrahub/workers/utils.py +63 -0
  349. infrahub/workflows/catalogue.py +71 -52
  350. infrahub/workflows/initialization.py +14 -8
  351. infrahub/workflows/models.py +28 -4
  352. infrahub/workflows/utils.py +1 -1
  353. infrahub_sdk/client.py +8 -0
  354. infrahub_sdk/ctl/branch.py +3 -2
  355. infrahub_sdk/ctl/check.py +3 -3
  356. infrahub_sdk/ctl/cli_commands.py +16 -11
  357. infrahub_sdk/ctl/exceptions.py +0 -6
  358. infrahub_sdk/ctl/exporter.py +1 -1
  359. infrahub_sdk/ctl/generator.py +5 -5
  360. infrahub_sdk/ctl/importer.py +3 -2
  361. infrahub_sdk/ctl/menu.py +1 -1
  362. infrahub_sdk/ctl/object.py +1 -1
  363. infrahub_sdk/ctl/repository.py +23 -15
  364. infrahub_sdk/ctl/schema.py +2 -2
  365. infrahub_sdk/ctl/utils.py +4 -19
  366. infrahub_sdk/ctl/validate.py +2 -1
  367. infrahub_sdk/exceptions.py +12 -0
  368. infrahub_sdk/generator.py +3 -0
  369. infrahub_sdk/node.py +4 -4
  370. infrahub_sdk/protocols.py +21 -8
  371. infrahub_sdk/schema/__init__.py +14 -2
  372. infrahub_sdk/schema/main.py +7 -0
  373. infrahub_sdk/task/__init__.py +1 -0
  374. infrahub_sdk/task/constants.py +3 -0
  375. infrahub_sdk/task/exceptions.py +25 -0
  376. infrahub_sdk/task/manager.py +545 -0
  377. infrahub_sdk/task/models.py +74 -0
  378. infrahub_sdk/timestamp.py +134 -33
  379. infrahub_sdk/utils.py +39 -1
  380. infrahub_sdk/yaml.py +2 -3
  381. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0b1.dist-info}/METADATA +47 -12
  382. infrahub_server-1.2.0b1.dist-info/RECORD +725 -0
  383. infrahub_testcontainers/container.py +14 -6
  384. infrahub_testcontainers/docker-compose.test.yml +24 -5
  385. infrahub_testcontainers/haproxy.cfg +43 -0
  386. infrahub_testcontainers/helpers.py +85 -1
  387. infrahub/core/branch/constants.py +0 -2
  388. infrahub/core/schema/definitions/core.py +0 -2274
  389. infrahub/graphql/query.py +0 -52
  390. infrahub/message_bus/messages/check_repository_checkdefinition.py +0 -20
  391. infrahub/message_bus/messages/check_repository_mergeconflicts.py +0 -16
  392. infrahub/message_bus/messages/check_repository_usercheck.py +0 -26
  393. infrahub/message_bus/messages/request_artifactdefinition_check.py +0 -17
  394. infrahub/message_bus/messages/request_repository_checks.py +0 -12
  395. infrahub/message_bus/messages/request_repository_userchecks.py +0 -18
  396. infrahub/message_bus/operations/check/repository.py +0 -293
  397. infrahub/message_bus/operations/requests/artifact_definition.py +0 -148
  398. infrahub/message_bus/operations/requests/repository.py +0 -133
  399. infrahub/schema/constants.py +0 -1
  400. infrahub/schema/tasks.py +0 -76
  401. infrahub/services/adapters/database/__init__.py +0 -9
  402. infrahub_sdk/ctl/_file.py +0 -13
  403. infrahub_server-1.1.6.dist-info/RECORD +0 -681
  404. /infrahub/{schema → artifacts}/__init__.py +0 -0
  405. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0b1.dist-info}/LICENSE.txt +0 -0
  406. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0b1.dist-info}/WHEEL +0 -0
  407. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0b1.dist-info}/entry_points.txt +0 -0
infrahub/graphql/query.py DELETED
@@ -1,52 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import TYPE_CHECKING, Optional
4
-
5
- from graphql import graphql
6
-
7
- from infrahub.core.branch import Branch
8
- from infrahub.core.constants import InfrahubKind
9
- from infrahub.core.manager import NodeManager
10
- from infrahub.core.protocols import CoreGraphQLQuery
11
- from infrahub.core.registry import registry
12
- from infrahub.core.timestamp import Timestamp
13
- from infrahub.graphql.initialization import prepare_graphql_params
14
-
15
- if TYPE_CHECKING:
16
- from graphql.execution import ExecutionResult
17
-
18
- from infrahub.database import InfrahubDatabase
19
-
20
-
21
- async def execute_query(
22
- name: str,
23
- db: InfrahubDatabase,
24
- params: Optional[dict] = None,
25
- branch: Branch | str | None = None,
26
- at: Timestamp | str | None = None,
27
- ) -> ExecutionResult:
28
- """Helper function to Execute a GraphQL Query."""
29
-
30
- if not isinstance(branch, Branch):
31
- branch = await registry.get_branch(db=db, branch=branch)
32
- at = Timestamp(at)
33
-
34
- graphql_query = await NodeManager.get_one_by_default_filter(
35
- db=db, id=name, kind=CoreGraphQLQuery, branch=branch, at=at
36
- )
37
- if not graphql_query:
38
- raise ValueError(f"Unable to find the {InfrahubKind.GRAPHQLQUERY} {name}")
39
-
40
- gql_params = await prepare_graphql_params(
41
- branch=branch, db=db, at=at, include_mutation=False, include_subscription=False
42
- )
43
-
44
- result = await graphql(
45
- schema=gql_params.schema,
46
- source=graphql_query.query.value,
47
- context_value=gql_params.context,
48
- root_value=None,
49
- variable_values=params or {},
50
- )
51
-
52
- return result
@@ -1,20 +0,0 @@
1
- from pydantic import ConfigDict, Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
- from infrahub.message_bus.types import ProposedChangeBranchDiff
5
-
6
-
7
- class CheckRepositoryCheckDefinition(InfrahubMessage):
8
- """Triggers user defined checks to run based on a Check Definition."""
9
-
10
- model_config = ConfigDict(arbitrary_types_allowed=True)
11
-
12
- check_definition_id: str = Field(..., description="The unique ID of the check definition")
13
- commit: str = Field(..., description="The commit to target")
14
- repository_id: str = Field(..., description="The unique ID of the Repository")
15
- repository_name: str = Field(..., description="The name of the Repository")
16
- branch_name: str = Field(..., description="The branch where the check is run")
17
- file_path: str = Field(..., description="The path and filename of the check")
18
- class_name: str = Field(..., description="The name of the class containing the check")
19
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
20
- branch_diff: ProposedChangeBranchDiff = Field(..., description="The calculated diff between the two branches")
@@ -1,16 +0,0 @@
1
- from pydantic import Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
-
5
-
6
- class CheckRepositoryMergeConflicts(InfrahubMessage):
7
- """Runs a check to validate if there are merge conflicts for a proposed change between two branches."""
8
-
9
- validator_id: str = Field(..., description="The id of the validator associated with this check")
10
- validator_execution_id: str = Field(..., description="The id of current execution of the associated validator")
11
- check_execution_id: str = Field(..., description="The unique ID for the current execution of this check")
12
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
13
- repository_id: str = Field(..., description="The unique ID of the Repository")
14
- repository_name: str = Field(..., description="The name of the Repository")
15
- source_branch: str = Field(..., description="The source branch")
16
- target_branch: str = Field(..., description="The target branch")
@@ -1,26 +0,0 @@
1
- from pydantic import ConfigDict, Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
- from infrahub.message_bus.types import ProposedChangeBranchDiff
5
-
6
-
7
- class CheckRepositoryUserCheck(InfrahubMessage):
8
- """Runs a check as defined within a CoreCheckDefinition within a repository."""
9
-
10
- model_config = ConfigDict(arbitrary_types_allowed=True)
11
-
12
- validator_id: str = Field(..., description="The id of the validator associated with this check")
13
- validator_execution_id: str = Field(..., description="The id of current execution of the associated validator")
14
- check_execution_id: str = Field(..., description="The unique ID for the current execution of this check")
15
- check_definition_id: str = Field(..., description="The unique ID of the check definition")
16
- commit: str = Field(..., description="The commit to target")
17
- repository_id: str = Field(..., description="The unique ID of the Repository")
18
- repository_name: str = Field(..., description="The name of the Repository")
19
- branch_name: str = Field(..., description="The branch where the check is run")
20
- file_path: str = Field(..., description="The path and filename of the check")
21
- class_name: str = Field(..., description="The name of the class containing the check")
22
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
23
- variables: dict = Field(default_factory=dict, description="Input variables when running the check")
24
- name: str = Field(..., description="The name of the check")
25
- branch_diff: ProposedChangeBranchDiff = Field(..., description="The calculated diff between the two branches")
26
- timeout: int = Field(..., description="The timeout for the check")
@@ -1,17 +0,0 @@
1
- from pydantic import ConfigDict, Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
- from infrahub.message_bus.types import ProposedChangeArtifactDefinition, ProposedChangeBranchDiff
5
-
6
-
7
- class RequestArtifactDefinitionCheck(InfrahubMessage):
8
- """Sent to validate the generation of artifacts in relation to a proposed change."""
9
-
10
- model_config = ConfigDict(arbitrary_types_allowed=True)
11
-
12
- artifact_definition: ProposedChangeArtifactDefinition = Field(..., description="The Artifact Definition")
13
- branch_diff: ProposedChangeBranchDiff = Field(..., description="The calculated diff between the two branches")
14
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
15
- source_branch: str = Field(..., description="The source branch")
16
- source_branch_sync_with_git: bool = Field(..., description="Indicates if the source branch should sync with git")
17
- destination_branch: str = Field(..., description="The target branch")
@@ -1,12 +0,0 @@
1
- from pydantic import Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
-
5
-
6
- class RequestRepositoryChecks(InfrahubMessage):
7
- """Sent to trigger the checks for a repository to be executed."""
8
-
9
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
10
- repository: str = Field(..., description="The unique ID of the Repository")
11
- source_branch: str = Field(..., description="The source branch")
12
- target_branch: str = Field(..., description="The target branch")
@@ -1,18 +0,0 @@
1
- from pydantic import ConfigDict, Field
2
-
3
- from infrahub.message_bus import InfrahubMessage
4
- from infrahub.message_bus.types import ProposedChangeBranchDiff
5
-
6
-
7
- class RequestRepositoryUserChecks(InfrahubMessage):
8
- """Sent to trigger the user defined checks on a repository."""
9
-
10
- model_config = ConfigDict(arbitrary_types_allowed=True)
11
-
12
- proposed_change: str = Field(..., description="The unique ID of the Proposed Change")
13
- repository_id: str = Field(..., description="The unique ID of the Repository")
14
- repository_name: str = Field(..., description="The name of the Repository")
15
- source_branch: str = Field(..., description="The source branch")
16
- source_branch_sync_with_git: bool = Field(..., description="Indicates if the source branch should sync with git")
17
- target_branch: str = Field(..., description="The target branch")
18
- branch_diff: ProposedChangeBranchDiff = Field(..., description="The calculated diff between the two branches")
@@ -1,293 +0,0 @@
1
- from infrahub_sdk.protocols import CoreCheckDefinition
2
- from infrahub_sdk.uuidt import UUIDT
3
- from prefect import flow
4
- from prefect.logging import get_run_logger
5
-
6
- from infrahub import lock
7
- from infrahub.core.constants import InfrahubKind
8
- from infrahub.core.manager import NodeManager
9
- from infrahub.core.timestamp import Timestamp
10
- from infrahub.exceptions import CheckError
11
- from infrahub.git.repository import InfrahubRepository
12
- from infrahub.message_bus import InfrahubMessage, messages
13
- from infrahub.message_bus.types import KVTTL
14
- from infrahub.services import InfrahubServices
15
- from infrahub.workflows.utils import add_tags
16
-
17
-
18
- @flow(
19
- name="git-repository-check-definition",
20
- flow_run_name="Run user defined checks for repository {message.repository_name}",
21
- )
22
- async def check_definition(message: messages.CheckRepositoryCheckDefinition, service: InfrahubServices) -> None:
23
- await add_tags(branches=[message.branch_name], nodes=[message.proposed_change])
24
- log = get_run_logger()
25
-
26
- definition = await service.client.get(
27
- kind=CoreCheckDefinition, id=message.check_definition_id, branch=message.branch_name
28
- )
29
- proposed_change = await service.client.get(kind=InfrahubKind.PROPOSEDCHANGE, id=message.proposed_change)
30
- validator_execution_id = str(UUIDT())
31
- check_execution_ids: list[str] = []
32
- await proposed_change.validations.fetch()
33
- validator = None
34
- events: list[InfrahubMessage] = []
35
-
36
- for relationship in proposed_change.validations.peers:
37
- existing_validator = relationship.peer
38
-
39
- if (
40
- existing_validator.typename == InfrahubKind.USERVALIDATOR
41
- and existing_validator.repository.id == message.repository_id
42
- and existing_validator.check_definition.id == message.check_definition_id
43
- ):
44
- validator = existing_validator
45
- service.log.info("Found the same validator", validator=validator)
46
-
47
- if validator:
48
- validator.conclusion.value = "unknown"
49
- validator.state.value = "queued"
50
- validator.started_at.value = ""
51
- validator.completed_at.value = ""
52
- await validator.save()
53
- else:
54
- validator = await service.client.create(
55
- kind=InfrahubKind.USERVALIDATOR,
56
- data={
57
- "label": f"Check: {definition.name.value}",
58
- "proposed_change": message.proposed_change,
59
- "repository": message.repository_id,
60
- "check_definition": message.check_definition_id,
61
- },
62
- )
63
- await validator.save()
64
-
65
- if definition.targets.id:
66
- # Check against a group of targets
67
- await definition.targets.fetch()
68
- group = definition.targets.peer
69
- await group.members.fetch()
70
- for relationship in group.members.peers:
71
- member = relationship.peer
72
-
73
- check_execution_id = str(UUIDT())
74
- check_execution_ids.append(check_execution_id)
75
- events.append(
76
- messages.CheckRepositoryUserCheck(
77
- name=member.display_label,
78
- validator_id=validator.id,
79
- validator_execution_id=validator_execution_id,
80
- check_execution_id=check_execution_id,
81
- repository_id=message.repository_id,
82
- repository_name=message.repository_name,
83
- commit=message.commit,
84
- file_path=message.file_path,
85
- class_name=message.class_name,
86
- branch_name=message.branch_name,
87
- check_definition_id=message.check_definition_id,
88
- proposed_change=message.proposed_change,
89
- variables=member.extract(params=definition.parameters.value),
90
- branch_diff=message.branch_diff,
91
- timeout=definition.timeout.value,
92
- )
93
- )
94
-
95
- else:
96
- check_execution_id = str(UUIDT())
97
- check_execution_ids.append(check_execution_id)
98
- events.append(
99
- messages.CheckRepositoryUserCheck(
100
- name=definition.name.value,
101
- validator_id=validator.id,
102
- validator_execution_id=validator_execution_id,
103
- check_execution_id=check_execution_id,
104
- repository_id=message.repository_id,
105
- repository_name=message.repository_name,
106
- commit=message.commit,
107
- file_path=message.file_path,
108
- class_name=message.class_name,
109
- branch_name=message.branch_name,
110
- check_definition_id=message.check_definition_id,
111
- proposed_change=message.proposed_change,
112
- branch_diff=message.branch_diff,
113
- timeout=definition.timeout.value,
114
- )
115
- )
116
-
117
- checks_in_execution = ",".join(check_execution_ids)
118
- log.info(f"Checks in execution {checks_in_execution}")
119
- await service.cache.set(
120
- key=f"validator_execution_id:{validator_execution_id}:checks",
121
- value=checks_in_execution,
122
- expires=KVTTL.TWO_HOURS,
123
- )
124
- events.append(
125
- messages.FinalizeValidatorExecution(
126
- start_time=Timestamp().to_string(),
127
- validator_id=validator.id,
128
- validator_execution_id=validator_execution_id,
129
- validator_type=InfrahubKind.USERVALIDATOR,
130
- )
131
- )
132
-
133
- for event in events:
134
- event.assign_meta(parent=message)
135
- await service.send(message=event)
136
-
137
-
138
- @flow(
139
- name="git-repository-check-merge-conflict",
140
- flow_run_name="Check for merge conflicts between {message.source_branch} and {message.target_branch}",
141
- )
142
- async def merge_conflicts(message: messages.CheckRepositoryMergeConflicts, service: InfrahubServices) -> None:
143
- """Runs a check to see if there are merge conflicts between two branches."""
144
- await add_tags(branches=[message.source_branch], nodes=[message.proposed_change])
145
-
146
- success_condition = "-"
147
- validator = await service.client.get(kind=InfrahubKind.REPOSITORYVALIDATOR, id=message.validator_id)
148
- await validator.checks.fetch()
149
-
150
- repo = await InfrahubRepository.init(id=message.repository_id, name=message.repository_name, service=service)
151
- async with lock.registry.get(name=message.repository_name, namespace="repository"):
152
- conflicts = await repo.get_conflicts(source_branch=message.source_branch, dest_branch=message.target_branch)
153
-
154
- existing_checks = {}
155
- for relationship in validator.checks.peers:
156
- existing_check = relationship.peer
157
- if existing_check.typename == InfrahubKind.FILECHECK and existing_check.kind.value == "MergeConflictCheck":
158
- check_key = ""
159
- if existing_check.files.value:
160
- check_key = "".join(existing_check.files.value)
161
- check_key = f"-{check_key}"
162
- existing_checks[check_key] = existing_check
163
-
164
- validator_conclusion = "success"
165
- check = None
166
- if conflicts:
167
- validator_conclusion = "failure"
168
- for conflict in conflicts:
169
- conflict_key = f"-{conflict}"
170
- if conflict_key in existing_checks:
171
- existing_checks[conflict_key].created_at.value = Timestamp().to_string()
172
- await existing_checks[conflict_key].save()
173
- existing_checks.pop(conflict_key)
174
- else:
175
- check = await service.client.create(
176
- kind=InfrahubKind.FILECHECK,
177
- data={
178
- "name": conflict,
179
- "origin": "ConflictCheck",
180
- "kind": "MergeConflictCheck",
181
- "validator": message.validator_id,
182
- "created_at": Timestamp().to_string(),
183
- "files": [conflict],
184
- "conclusion": "failure",
185
- "severity": "critical",
186
- },
187
- )
188
- await check.save()
189
-
190
- elif success_condition in existing_checks:
191
- existing_checks[success_condition].created_at.value = Timestamp().to_string()
192
- await existing_checks[success_condition].save()
193
- existing_checks.pop(success_condition)
194
-
195
- else:
196
- check = await service.client.create(
197
- kind=InfrahubKind.FILECHECK,
198
- data={
199
- "name": "Merge Conflict Check",
200
- "origin": "ConflictCheck",
201
- "kind": "MergeConflictCheck",
202
- "validator": message.validator_id,
203
- "created_at": Timestamp().to_string(),
204
- "conclusion": "success",
205
- "severity": "info",
206
- },
207
- )
208
- await check.save()
209
-
210
- async with service.database.start_session() as db:
211
- await NodeManager.delete(db=db, nodes=list(existing_checks.values()))
212
-
213
- await service.cache.set(
214
- key=f"validator_execution_id:{message.validator_execution_id}:check_execution_id:{message.check_execution_id}",
215
- value=validator_conclusion,
216
- expires=KVTTL.TWO_HOURS,
217
- )
218
-
219
-
220
- @flow(name="git-repository-user-check", flow_run_name="Execute user defined Check '{message.name}'")
221
- async def user_check(message: messages.CheckRepositoryUserCheck, service: InfrahubServices) -> None:
222
- await add_tags(branches=[message.branch_name], nodes=[message.proposed_change])
223
- log = get_run_logger()
224
-
225
- validator = await service.client.get(kind=InfrahubKind.USERVALIDATOR, id=message.validator_id)
226
- await validator.checks.fetch()
227
-
228
- repo = await InfrahubRepository.init(
229
- id=message.repository_id, name=message.repository_name, commit=message.commit, service=service
230
- )
231
- conclusion = "failure"
232
- severity = "critical"
233
- log_entries = ""
234
- try:
235
- check_run = await repo.execute_python_check.with_options(timeout_seconds=message.timeout)(
236
- branch_name=message.branch_name,
237
- location=message.file_path,
238
- class_name=message.class_name,
239
- client=service.client,
240
- commit=message.commit,
241
- params=message.variables,
242
- )
243
- if check_run.passed:
244
- conclusion = "success"
245
- severity = "info"
246
- log.info("The check passed")
247
- else:
248
- log.warning("The check reported failures")
249
- for log_entry in check_run.log_entries:
250
- log.warning(log_entry)
251
- log_entries = check_run.log_entries
252
- except CheckError as exc:
253
- log.warning("The check failed to run")
254
- log.error(exc.message)
255
- log_entries = f"FATAL Error/n:{exc.message}"
256
-
257
- check = None
258
- for relationship in validator.checks.peers:
259
- existing_check = relationship.peer
260
- if (
261
- existing_check.typename == InfrahubKind.STANDARDCHECK
262
- and existing_check.kind.value == "CheckDefinition"
263
- and existing_check.name.value == message.name
264
- ):
265
- check = existing_check
266
-
267
- if check:
268
- check.created_at.value = Timestamp().to_string()
269
- check.message.value = log_entries
270
- check.conclusion.value = conclusion
271
- check.severity.value = severity
272
- await check.save()
273
- else:
274
- check = await service.client.create(
275
- kind=InfrahubKind.STANDARDCHECK,
276
- data={
277
- "name": message.name,
278
- "origin": message.repository_id,
279
- "kind": "CheckDefinition",
280
- "validator": message.validator_id,
281
- "created_at": Timestamp().to_string(),
282
- "message": log_entries,
283
- "conclusion": conclusion,
284
- "severity": severity,
285
- },
286
- )
287
- await check.save()
288
-
289
- await service.cache.set(
290
- key=f"validator_execution_id:{message.validator_execution_id}:check_execution_id:{message.check_execution_id}",
291
- value=conclusion,
292
- expires=KVTTL.TWO_HOURS,
293
- )
@@ -1,148 +0,0 @@
1
- from typing import Optional
2
-
3
- from infrahub_sdk.uuidt import UUIDT
4
- from prefect import flow
5
- from prefect.logging import get_run_logger
6
-
7
- from infrahub.core.constants import InfrahubKind, ValidatorConclusion, ValidatorState
8
- from infrahub.core.timestamp import Timestamp
9
- from infrahub.message_bus import InfrahubMessage, Meta, messages
10
- from infrahub.message_bus.types import KVTTL
11
- from infrahub.services import InfrahubServices
12
- from infrahub.workflows.utils import add_tags
13
-
14
-
15
- @flow(
16
- name="artifact-definition-check",
17
- flow_run_name="Validating generation of artifacts for {message.artifact_definition.definition_name}",
18
- )
19
- async def check(message: messages.RequestArtifactDefinitionCheck, service: InfrahubServices) -> None:
20
- events: list[InfrahubMessage] = []
21
- await add_tags(branches=[message.source_branch], nodes=[message.proposed_change], db_change=True)
22
-
23
- log = get_run_logger()
24
- artifact_definition = await service.client.get(
25
- kind=InfrahubKind.ARTIFACTDEFINITION,
26
- id=message.artifact_definition.definition_id,
27
- branch=message.source_branch,
28
- )
29
- proposed_change = await service.client.get(kind=InfrahubKind.PROPOSEDCHANGE, id=message.proposed_change)
30
-
31
- validator_name = f"Artifact Validator: {message.artifact_definition.definition_name}"
32
- validator_execution_id = str(UUIDT())
33
- check_execution_ids: list[str] = []
34
-
35
- await proposed_change.validations.fetch()
36
-
37
- validator = None
38
- for relationship in proposed_change.validations.peers:
39
- existing_validator = relationship.peer
40
- if (
41
- existing_validator.typename == InfrahubKind.ARTIFACTVALIDATOR
42
- and existing_validator.definition.id == message.artifact_definition.definition_id
43
- ):
44
- validator = existing_validator
45
-
46
- if validator:
47
- validator.conclusion.value = ValidatorConclusion.UNKNOWN.value
48
- validator.state.value = ValidatorState.QUEUED.value
49
- validator.started_at.value = ""
50
- validator.completed_at.value = ""
51
- await validator.save()
52
- else:
53
- validator = await service.client.create(
54
- kind=InfrahubKind.ARTIFACTVALIDATOR,
55
- data={
56
- "label": validator_name,
57
- "proposed_change": message.proposed_change,
58
- "definition": message.artifact_definition.definition_id,
59
- },
60
- )
61
- await validator.save()
62
-
63
- await artifact_definition.targets.fetch()
64
- group = artifact_definition.targets.peer
65
- await group.members.fetch()
66
-
67
- existing_artifacts = await service.client.filters(
68
- kind=InfrahubKind.ARTIFACT,
69
- definition__ids=[message.artifact_definition.definition_id],
70
- include=["object"],
71
- branch=message.source_branch,
72
- )
73
- artifacts_by_member = {}
74
- for artifact in existing_artifacts:
75
- artifacts_by_member[artifact.object.peer.id] = artifact.id
76
-
77
- repository = message.branch_diff.get_repository(repository_id=message.artifact_definition.repository_id)
78
- requested_artifacts = 0
79
- impacted_artifacts = message.branch_diff.get_subscribers_ids(kind=InfrahubKind.ARTIFACT)
80
- for relationship in group.members.peers:
81
- member = relationship.peer
82
- artifact_id = artifacts_by_member.get(member.id)
83
- if _render_artifact(
84
- artifact_id=artifact_id,
85
- managed_branch=message.source_branch_sync_with_git,
86
- impacted_artifacts=impacted_artifacts,
87
- ):
88
- check_execution_id = str(UUIDT())
89
- check_execution_ids.append(check_execution_id)
90
- requested_artifacts += 1
91
- log.info(f"Trigger Artifact processing for {member.display_label}")
92
- events.append(
93
- messages.CheckArtifactCreate(
94
- artifact_name=message.artifact_definition.artifact_name,
95
- artifact_id=artifact_id,
96
- artifact_definition=message.artifact_definition.definition_id,
97
- commit=repository.source_commit,
98
- content_type=message.artifact_definition.content_type,
99
- transform_type=message.artifact_definition.transform_kind,
100
- transform_location=message.artifact_definition.transform_location,
101
- repository_id=repository.repository_id,
102
- repository_name=repository.repository_name,
103
- repository_kind=repository.kind,
104
- branch_name=message.source_branch,
105
- query=message.artifact_definition.query_name,
106
- variables=member.extract(params=artifact_definition.parameters.value),
107
- target_id=member.id,
108
- target_name=member.display_label,
109
- timeout=message.artifact_definition.timeout,
110
- validator_id=validator.id,
111
- meta=Meta(validator_execution_id=validator_execution_id, check_execution_id=check_execution_id),
112
- )
113
- )
114
-
115
- checks_in_execution = ",".join(check_execution_ids)
116
- await service.cache.set(
117
- key=f"validator_execution_id:{validator_execution_id}:checks",
118
- value=checks_in_execution,
119
- expires=KVTTL.TWO_HOURS,
120
- )
121
- events.append(
122
- messages.FinalizeValidatorExecution(
123
- start_time=Timestamp().to_string(),
124
- validator_id=validator.id,
125
- validator_execution_id=validator_execution_id,
126
- validator_type=InfrahubKind.ARTIFACTVALIDATOR,
127
- )
128
- )
129
- for event in events:
130
- event.assign_meta(parent=message)
131
- await service.send(message=event)
132
-
133
-
134
- def _render_artifact(artifact_id: Optional[str], managed_branch: bool, impacted_artifacts: list[str]) -> bool: # pylint: disable=unused-argument
135
- """Returns a boolean to indicate if an artifact should be generated or not.
136
- Will return true if:
137
- * The artifact_id wasn't set which could be that it's a new object that doesn't have a previous artifact
138
- * The source brance is not data only which would indicate that it could contain updates in git to the transform
139
- * The artifact_id exists in the impacted_artifacts list
140
- Will return false if:
141
- * The source branch is a data only branch and the artifact_id exists and is not in the impacted list
142
- """
143
-
144
- # if not artifact_id or managed_branch:
145
- # return True
146
- # return artifact_id in impacted_artifacts
147
- # Temporary workaround tracked in https://github.com/opsmill/infrahub/issues/4991
148
- return True