infrahub-server 1.1.6__py3-none-any.whl → 1.2.0rc0__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.
- infrahub/api/artifact.py +16 -4
- infrahub/api/dependencies.py +8 -0
- infrahub/api/oauth2.py +0 -1
- infrahub/api/oidc.py +0 -1
- infrahub/api/query.py +18 -7
- infrahub/api/schema.py +32 -6
- infrahub/api/transformation.py +12 -5
- infrahub/{message_bus/messages/check_artifact_create.py → artifacts/models.py} +2 -4
- infrahub/{message_bus/operations/check/artifact.py → artifacts/tasks.py} +26 -25
- infrahub/cli/__init__.py +0 -2
- infrahub/cli/db.py +6 -7
- infrahub/cli/events.py +8 -3
- infrahub/cli/git_agent.py +9 -7
- infrahub/cli/tasks.py +4 -6
- infrahub/computed_attribute/tasks.py +63 -17
- infrahub/computed_attribute/triggers.py +90 -0
- infrahub/config.py +1 -1
- infrahub/context.py +39 -0
- infrahub/core/account.py +5 -8
- infrahub/core/attribute.py +53 -21
- infrahub/core/branch/models.py +4 -4
- infrahub/core/branch/tasks.py +89 -130
- infrahub/core/changelog/__init__.py +0 -0
- infrahub/core/changelog/diff.py +232 -0
- infrahub/core/changelog/models.py +488 -0
- infrahub/core/constants/__init__.py +19 -2
- infrahub/core/constants/infrahubkind.py +1 -0
- infrahub/core/diff/combiner.py +12 -8
- infrahub/core/diff/coordinator.py +49 -70
- infrahub/core/diff/data_check_synchronizer.py +86 -7
- infrahub/core/diff/enricher/aggregated.py +3 -3
- infrahub/core/diff/enricher/cardinality_one.py +2 -7
- infrahub/core/diff/enricher/hierarchy.py +5 -3
- infrahub/core/diff/enricher/labels.py +14 -4
- infrahub/core/diff/enricher/path_identifier.py +3 -9
- infrahub/core/diff/enricher/summary_counts.py +3 -1
- infrahub/core/diff/merger/merger.py +8 -4
- infrahub/core/diff/model/path.py +47 -29
- infrahub/core/diff/query/all_conflicts.py +6 -3
- infrahub/core/diff/query/artifact.py +1 -1
- infrahub/core/diff/query/delete_query.py +1 -1
- infrahub/core/diff/query/diff_get.py +3 -2
- infrahub/core/diff/query/diff_summary.py +1 -1
- infrahub/core/diff/query/field_specifiers.py +3 -1
- infrahub/core/diff/query/field_summary.py +3 -2
- infrahub/core/diff/query/filters.py +12 -1
- infrahub/core/diff/query/get_conflict_query.py +1 -1
- infrahub/core/diff/query/has_conflicts_query.py +6 -3
- infrahub/core/diff/query/merge.py +3 -3
- infrahub/core/diff/query/{drop_tracking_id.py → merge_tracking_id.py} +4 -4
- infrahub/core/diff/query/roots_metadata.py +9 -2
- infrahub/core/diff/query/save.py +151 -66
- infrahub/core/diff/query/summary_counts_enricher.py +220 -0
- infrahub/core/diff/query/time_range_query.py +3 -2
- infrahub/core/diff/query/update_conflict_query.py +1 -1
- infrahub/core/diff/query_parser.py +49 -24
- infrahub/core/diff/repository/deserializer.py +24 -25
- infrahub/core/diff/repository/repository.py +76 -20
- infrahub/core/diff/tasks.py +9 -8
- infrahub/core/enums.py +1 -1
- infrahub/core/integrity/object_conflict/conflict_recorder.py +1 -1
- infrahub/core/ipam/reconciler.py +1 -1
- infrahub/core/ipam/tasks.py +2 -3
- infrahub/core/manager.py +18 -13
- infrahub/core/merge.py +5 -2
- infrahub/core/migrations/graph/m001_add_version_to_graph.py +1 -1
- infrahub/core/migrations/graph/m002_attribute_is_default.py +2 -2
- infrahub/core/migrations/graph/m003_relationship_parent_optional.py +2 -2
- infrahub/core/migrations/graph/m004_add_attr_documentation.py +1 -1
- infrahub/core/migrations/graph/m005_add_rel_read_only.py +1 -1
- infrahub/core/migrations/graph/m006_add_rel_on_delete.py +1 -1
- infrahub/core/migrations/graph/m007_add_rel_allow_override.py +1 -1
- infrahub/core/migrations/graph/m008_add_human_friendly_id.py +1 -1
- infrahub/core/migrations/graph/m009_add_generate_profile_attr.py +1 -1
- infrahub/core/migrations/graph/m010_add_generate_profile_attr_generic.py +1 -1
- infrahub/core/migrations/graph/m011_remove_profile_relationship_schema.py +2 -2
- infrahub/core/migrations/graph/m012_convert_account_generic.py +12 -23
- infrahub/core/migrations/graph/m013_convert_git_password_credential.py +7 -11
- infrahub/core/migrations/graph/m014_remove_index_attr_value.py +2 -2
- infrahub/core/migrations/graph/m015_diff_format_update.py +1 -1
- infrahub/core/migrations/graph/m016_diff_delete_bug_fix.py +1 -1
- infrahub/core/migrations/graph/m017_add_core_profile.py +1 -1
- infrahub/core/migrations/graph/m018_uniqueness_nulls.py +2 -2
- infrahub/core/migrations/query/attribute_add.py +1 -1
- infrahub/core/migrations/query/attribute_rename.py +1 -1
- infrahub/core/migrations/query/delete_element_in_schema.py +1 -1
- infrahub/core/migrations/query/node_duplicate.py +1 -1
- infrahub/core/migrations/query/relationship_duplicate.py +1 -1
- infrahub/core/migrations/query/schema_attribute_update.py +1 -1
- infrahub/core/migrations/schema/node_attribute_remove.py +1 -1
- infrahub/core/migrations/schema/node_remove.py +1 -1
- infrahub/core/migrations/schema/tasks.py +5 -5
- infrahub/core/migrations/shared.py +4 -4
- infrahub/core/models.py +7 -8
- infrahub/core/node/__init__.py +161 -40
- infrahub/core/node/base.py +1 -1
- infrahub/core/node/constraints/grouped_uniqueness.py +9 -2
- infrahub/core/node/delete_validator.py +4 -4
- infrahub/core/node/ipam.py +13 -8
- infrahub/core/node/permissions.py +4 -0
- infrahub/core/node/resource_manager/ip_prefix_pool.py +8 -5
- infrahub/core/node/standard.py +3 -5
- infrahub/core/property.py +1 -1
- infrahub/core/protocols.py +4 -0
- infrahub/core/protocols_base.py +4 -2
- infrahub/core/query/__init__.py +2 -5
- infrahub/core/query/attribute.py +9 -9
- infrahub/core/query/branch.py +5 -5
- infrahub/core/query/delete.py +1 -1
- infrahub/core/query/diff.py +45 -7
- infrahub/core/query/ipam.py +4 -4
- infrahub/core/query/node.py +19 -14
- infrahub/core/query/relationship.py +10 -11
- infrahub/core/query/resource_manager.py +13 -11
- infrahub/core/query/standard_node.py +6 -6
- infrahub/core/query/task.py +3 -3
- infrahub/core/query/task_log.py +1 -1
- infrahub/core/query/utils.py +5 -5
- infrahub/core/registry.py +0 -2
- infrahub/core/relationship/constraints/count.py +1 -1
- infrahub/core/relationship/constraints/peer_kind.py +1 -1
- infrahub/core/relationship/model.py +66 -26
- infrahub/core/schema/__init__.py +6 -4
- infrahub/core/schema/basenode_schema.py +1 -3
- infrahub/core/schema/definitions/core.py +14 -2
- infrahub/core/schema/definitions/internal.py +16 -0
- infrahub/core/schema/generated/genericnode_schema.py +5 -0
- infrahub/core/schema/generated/node_schema.py +5 -0
- infrahub/core/schema/generic_schema.py +5 -1
- infrahub/core/schema/manager.py +45 -42
- infrahub/core/schema/node_schema.py +4 -0
- infrahub/core/schema/profile_schema.py +4 -0
- infrahub/core/schema/relationship_schema.py +2 -2
- infrahub/core/schema/schema_branch.py +248 -14
- infrahub/core/schema/template_schema.py +36 -0
- infrahub/core/task/user_task.py +7 -5
- infrahub/core/timestamp.py +1 -1
- infrahub/core/utils.py +3 -2
- infrahub/core/validators/attribute/choices.py +1 -1
- infrahub/core/validators/attribute/enum.py +1 -1
- infrahub/core/validators/attribute/kind.py +1 -1
- infrahub/core/validators/attribute/length.py +1 -1
- infrahub/core/validators/attribute/optional.py +1 -1
- infrahub/core/validators/attribute/regex.py +1 -1
- infrahub/core/validators/attribute/unique.py +1 -1
- infrahub/core/validators/checks_runner.py +37 -0
- infrahub/core/validators/node/generate_profile.py +1 -1
- infrahub/core/validators/node/hierarchy.py +1 -1
- infrahub/core/validators/query.py +1 -1
- infrahub/core/validators/relationship/count.py +1 -1
- infrahub/core/validators/relationship/optional.py +1 -1
- infrahub/core/validators/relationship/peer.py +1 -1
- infrahub/core/validators/tasks.py +8 -6
- infrahub/core/validators/uniqueness/query.py +20 -17
- infrahub/database/__init__.py +15 -2
- infrahub/database/memgraph.py +1 -1
- infrahub/dependencies/builder/constraint/grouped/node_runner.py +0 -2
- infrahub/dependencies/builder/diff/combiner.py +1 -1
- infrahub/dependencies/builder/diff/conflicts_enricher.py +1 -1
- infrahub/dependencies/builder/diff/coordinator.py +0 -2
- infrahub/dependencies/builder/diff/deserializer.py +1 -1
- infrahub/dependencies/builder/diff/enricher/summary_counts.py +1 -1
- infrahub/events/branch_action.py +47 -21
- infrahub/events/group_action.py +73 -0
- infrahub/events/models.py +159 -51
- infrahub/events/node_action.py +74 -8
- infrahub/events/repository_action.py +8 -8
- infrahub/events/schema_action.py +21 -8
- infrahub/generators/tasks.py +12 -13
- infrahub/git/base.py +3 -5
- infrahub/git/constants.py +0 -1
- infrahub/git/integrator.py +36 -35
- infrahub/git/repository.py +7 -8
- infrahub/git/tasks.py +43 -107
- infrahub/git_credential/helper.py +2 -3
- infrahub/graphql/analyzer.py +572 -11
- infrahub/graphql/app.py +34 -26
- infrahub/graphql/auth/query_permission_checker/anonymous_checker.py +5 -5
- infrahub/graphql/auth/query_permission_checker/default_branch_checker.py +4 -4
- infrahub/graphql/auth/query_permission_checker/merge_operation_checker.py +4 -4
- infrahub/graphql/auth/query_permission_checker/object_permission_checker.py +28 -35
- infrahub/graphql/auth/query_permission_checker/super_admin_checker.py +5 -5
- infrahub/graphql/enums.py +1 -1
- infrahub/graphql/initialization.py +5 -1
- infrahub/graphql/loaders/node.py +2 -2
- infrahub/graphql/manager.py +59 -54
- infrahub/graphql/mutations/account.py +20 -13
- infrahub/graphql/mutations/artifact_definition.py +16 -12
- infrahub/graphql/mutations/branch.py +61 -40
- infrahub/graphql/mutations/computed_attribute.py +19 -13
- infrahub/graphql/mutations/diff.py +37 -9
- infrahub/graphql/mutations/diff_conflict.py +9 -8
- infrahub/graphql/mutations/graphql_query.py +19 -11
- infrahub/graphql/mutations/ipam.py +21 -19
- infrahub/graphql/mutations/main.py +197 -44
- infrahub/graphql/mutations/menu.py +8 -8
- infrahub/graphql/mutations/proposed_change.py +36 -28
- infrahub/graphql/mutations/relationship.py +302 -105
- infrahub/graphql/mutations/repository.py +41 -35
- infrahub/graphql/mutations/resource_manager.py +26 -26
- infrahub/graphql/mutations/schema.py +51 -33
- infrahub/graphql/mutations/tasks.py +16 -10
- infrahub/graphql/parser.py +1 -1
- infrahub/graphql/permissions.py +6 -4
- infrahub/graphql/queries/account.py +22 -18
- infrahub/graphql/queries/branch.py +6 -4
- infrahub/graphql/queries/diff/tree.py +48 -42
- infrahub/graphql/queries/event.py +112 -0
- infrahub/graphql/queries/internal.py +3 -3
- infrahub/graphql/queries/ipam.py +23 -18
- infrahub/graphql/queries/relationship.py +11 -10
- infrahub/graphql/queries/resource_manager.py +43 -27
- infrahub/graphql/queries/search.py +9 -8
- infrahub/graphql/queries/status.py +12 -9
- infrahub/graphql/queries/task.py +11 -9
- infrahub/graphql/resolvers/resolver.py +69 -43
- infrahub/graphql/resolvers/single_relationship.py +16 -10
- infrahub/graphql/schema.py +2 -0
- infrahub/graphql/subscription/__init__.py +1 -1
- infrahub/graphql/subscription/events.py +1 -1
- infrahub/graphql/subscription/graphql_query.py +8 -8
- infrahub/graphql/types/branch.py +2 -2
- infrahub/graphql/types/common.py +6 -1
- infrahub/graphql/types/enums.py +2 -0
- infrahub/graphql/types/event.py +100 -0
- infrahub/graphql/types/interface.py +2 -2
- infrahub/graphql/types/node.py +3 -3
- infrahub/graphql/types/permission.py +2 -2
- infrahub/graphql/types/relationship.py +3 -3
- infrahub/graphql/types/standard_node.py +9 -11
- infrahub/graphql/utils.py +28 -182
- infrahub/groups/tasks.py +2 -3
- infrahub/lock.py +1 -1
- infrahub/menu/constants.py +1 -0
- infrahub/menu/generator.py +14 -3
- infrahub/menu/menu.py +116 -127
- infrahub/menu/models.py +4 -4
- infrahub/message_bus/messages/__init__.py +0 -4
- infrahub/message_bus/messages/event_branch_merge.py +3 -0
- infrahub/message_bus/messages/request_proposedchange_pipeline.py +2 -0
- infrahub/message_bus/operations/__init__.py +3 -5
- infrahub/message_bus/operations/check/__init__.py +2 -2
- infrahub/message_bus/operations/check/generator.py +1 -3
- infrahub/message_bus/operations/check/repository.py +1 -1
- infrahub/message_bus/operations/event/branch.py +7 -3
- infrahub/message_bus/operations/event/schema.py +1 -1
- infrahub/message_bus/operations/finalize/validator.py +1 -1
- infrahub/message_bus/operations/git/file.py +2 -2
- infrahub/message_bus/operations/git/repository.py +1 -1
- infrahub/message_bus/operations/requests/__init__.py +0 -2
- infrahub/message_bus/operations/requests/generator_definition.py +1 -1
- infrahub/message_bus/operations/requests/proposed_change.py +26 -11
- infrahub/message_bus/operations/requests/repository.py +2 -2
- infrahub/message_bus/operations/send/echo.py +1 -1
- infrahub/message_bus/types.py +1 -1
- infrahub/permissions/__init__.py +2 -1
- infrahub/permissions/types.py +26 -0
- infrahub/pools/prefix.py +29 -165
- infrahub/prefect_server/__init__.py +0 -0
- infrahub/prefect_server/app.py +18 -0
- infrahub/prefect_server/database.py +20 -0
- infrahub/prefect_server/events.py +28 -0
- infrahub/prefect_server/models.py +46 -0
- infrahub/proposed_change/models.py +15 -1
- infrahub/proposed_change/tasks.py +173 -35
- infrahub/pytest_plugin.py +4 -4
- infrahub/server.py +12 -11
- infrahub/services/__init__.py +147 -62
- infrahub/services/adapters/cache/__init__.py +7 -5
- infrahub/services/adapters/cache/nats.py +40 -22
- infrahub/services/adapters/cache/redis.py +0 -4
- infrahub/services/adapters/event/__init__.py +10 -18
- infrahub/services/adapters/http/__init__.py +0 -5
- infrahub/services/adapters/http/httpx.py +22 -15
- infrahub/services/adapters/message_bus/__init__.py +23 -6
- infrahub/services/adapters/message_bus/local.py +8 -6
- infrahub/services/adapters/message_bus/nats.py +12 -6
- infrahub/services/adapters/message_bus/rabbitmq.py +22 -9
- infrahub/services/adapters/workflow/__init__.py +11 -8
- infrahub/services/adapters/workflow/local.py +28 -7
- infrahub/services/adapters/workflow/worker.py +23 -7
- infrahub/services/component.py +38 -35
- infrahub/services/scheduler.py +32 -29
- infrahub/storage.py +2 -4
- infrahub/task_manager/constants.py +1 -1
- infrahub/task_manager/event.py +182 -0
- infrahub/task_manager/models.py +125 -1
- infrahub/task_manager/task.py +1 -1
- infrahub/tasks/artifact.py +14 -16
- infrahub/tasks/registry.py +1 -1
- infrahub/tasks/telemetry.py +13 -14
- infrahub/transformations/tasks.py +3 -5
- infrahub/trigger/__init__.py +0 -0
- infrahub/trigger/catalogue.py +15 -0
- infrahub/trigger/constants.py +9 -0
- infrahub/trigger/models.py +69 -0
- infrahub/trigger/tasks.py +85 -0
- infrahub/types.py +1 -1
- infrahub/utils.py +1 -1
- infrahub/webhook/constants.py +0 -2
- infrahub/webhook/models.py +8 -2
- infrahub/webhook/tasks.py +20 -73
- infrahub/webhook/triggers.py +20 -0
- infrahub/workers/infrahub_async.py +36 -25
- infrahub/workers/utils.py +63 -0
- infrahub/workflows/catalogue.py +13 -37
- infrahub/workflows/initialization.py +6 -8
- infrahub/workflows/models.py +3 -5
- infrahub/workflows/utils.py +1 -1
- infrahub_sdk/ctl/check.py +3 -3
- infrahub_sdk/ctl/cli_commands.py +11 -10
- infrahub_sdk/ctl/exceptions.py +0 -6
- infrahub_sdk/ctl/exporter.py +1 -1
- infrahub_sdk/ctl/generator.py +5 -5
- infrahub_sdk/ctl/importer.py +3 -2
- infrahub_sdk/ctl/menu.py +1 -1
- infrahub_sdk/ctl/object.py +1 -1
- infrahub_sdk/ctl/repository.py +23 -15
- infrahub_sdk/ctl/schema.py +2 -2
- infrahub_sdk/ctl/utils.py +4 -3
- infrahub_sdk/ctl/validate.py +2 -1
- infrahub_sdk/exceptions.py +6 -0
- infrahub_sdk/generator.py +3 -0
- infrahub_sdk/node.py +2 -2
- infrahub_sdk/schema/__init__.py +14 -2
- infrahub_sdk/schema/main.py +7 -0
- infrahub_sdk/utils.py +11 -1
- infrahub_sdk/yaml.py +2 -3
- {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/METADATA +46 -12
- {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/RECORD +338 -321
- infrahub_testcontainers/container.py +14 -6
- infrahub_testcontainers/docker-compose.test.yml +24 -5
- infrahub_testcontainers/haproxy.cfg +43 -0
- infrahub_testcontainers/helpers.py +85 -1
- infrahub/core/branch/constants.py +0 -2
- infrahub/graphql/query.py +0 -52
- infrahub/message_bus/messages/request_artifactdefinition_check.py +0 -17
- infrahub/message_bus/operations/requests/artifact_definition.py +0 -148
- infrahub/schema/constants.py +0 -1
- infrahub/schema/tasks.py +0 -76
- infrahub/services/adapters/database/__init__.py +0 -9
- infrahub_sdk/ctl/_file.py +0 -13
- /infrahub/{schema → artifacts}/__init__.py +0 -0
- {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/WHEEL +0 -0
- {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/entry_points.txt +0 -0
infrahub/menu/constants.py
CHANGED
infrahub/menu/generator.py
CHANGED
|
@@ -3,10 +3,11 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
5
|
from infrahub.core import registry
|
|
6
|
+
from infrahub.core.constants import InfrahubKind
|
|
6
7
|
from infrahub.core.protocols import CoreMenuItem
|
|
7
8
|
from infrahub.log import get_logger
|
|
8
9
|
|
|
9
|
-
from .constants import FULL_DEFAULT_MENU
|
|
10
|
+
from .constants import FULL_DEFAULT_MENU, TEMPLATE_MENU
|
|
10
11
|
from .models import MenuDict, MenuItemDict
|
|
11
12
|
|
|
12
13
|
if TYPE_CHECKING:
|
|
@@ -39,7 +40,6 @@ async def generate_restricted_menu(
|
|
|
39
40
|
return menu
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
# pylint: disable=too-many-branches,too-many-statements
|
|
43
43
|
async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[CoreMenuItem]) -> MenuDict:
|
|
44
44
|
structure = MenuDict()
|
|
45
45
|
full_schema = registry.schema.get_full(branch=branch, duplicate=False)
|
|
@@ -82,6 +82,11 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
|
|
|
82
82
|
|
|
83
83
|
items_to_add = {schema.kind: False for schema in full_schema.values() if schema.include_in_menu is True}
|
|
84
84
|
|
|
85
|
+
# Object templates should go into a dedicated menu item
|
|
86
|
+
object_templates_menu = MenuItemDict(
|
|
87
|
+
identifier=InfrahubKind.OBJECTTEMPLATE, label=TEMPLATE_MENU.title(), icon="mdi:pencil-ruler", order_weight=20000
|
|
88
|
+
)
|
|
89
|
+
|
|
85
90
|
nbr_remaining_items_last_round = len(items_to_add.values())
|
|
86
91
|
nbr_remaining_items = len([value for value in items_to_add.values() if value is False])
|
|
87
92
|
while not all(items_to_add.values()):
|
|
@@ -96,7 +101,10 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
|
|
|
96
101
|
items_to_add[item_name] = True
|
|
97
102
|
continue
|
|
98
103
|
|
|
99
|
-
if
|
|
104
|
+
if schema.namespace == "Template":
|
|
105
|
+
object_templates_menu.children[menu_item.identifier] = menu_item
|
|
106
|
+
items_to_add[item_name] = True
|
|
107
|
+
elif not schema.menu_placement:
|
|
100
108
|
first_element = MenuItemDict.from_schema(model=schema)
|
|
101
109
|
first_element.identifier = f"{first_element.identifier}Sub"
|
|
102
110
|
first_element.order_weight = 1
|
|
@@ -113,6 +121,9 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
|
|
|
113
121
|
break
|
|
114
122
|
nbr_remaining_items_last_round = nbr_remaining_items
|
|
115
123
|
|
|
124
|
+
if object_templates_menu.children:
|
|
125
|
+
structure.data[object_templates_menu.identifier] = object_templates_menu
|
|
126
|
+
|
|
116
127
|
# ----------------------------------------------------------------------------
|
|
117
128
|
# Assign the remaining items for which we couldn't find the menu_placement to the default menu
|
|
118
129
|
# ----------------------------------------------------------------------------
|
infrahub/menu/menu.py
CHANGED
|
@@ -96,6 +96,16 @@ default_menu = [
|
|
|
96
96
|
section=MenuSection.INTERNAL,
|
|
97
97
|
order_weight=1000,
|
|
98
98
|
),
|
|
99
|
+
MenuItemDefinition(
|
|
100
|
+
namespace="Builtin",
|
|
101
|
+
name="Branches",
|
|
102
|
+
label="Branches",
|
|
103
|
+
path="/branches",
|
|
104
|
+
icon="mdi:layers-triple",
|
|
105
|
+
protected=True,
|
|
106
|
+
section=MenuSection.INTERNAL,
|
|
107
|
+
order_weight=1500,
|
|
108
|
+
),
|
|
99
109
|
MenuItemDefinition(
|
|
100
110
|
namespace="Builtin",
|
|
101
111
|
name="ObjectManagement",
|
|
@@ -103,7 +113,7 @@ default_menu = [
|
|
|
103
113
|
icon="mdi:cube-outline",
|
|
104
114
|
protected=True,
|
|
105
115
|
section=MenuSection.INTERNAL,
|
|
106
|
-
order_weight=
|
|
116
|
+
order_weight=2000,
|
|
107
117
|
children=[
|
|
108
118
|
MenuItemDefinition(
|
|
109
119
|
namespace="Builtin",
|
|
@@ -123,232 +133,211 @@ default_menu = [
|
|
|
123
133
|
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.PROFILE)),
|
|
124
134
|
protected=True,
|
|
125
135
|
section=MenuSection.INTERNAL,
|
|
126
|
-
order_weight=
|
|
136
|
+
order_weight=1500,
|
|
127
137
|
),
|
|
128
138
|
MenuItemDefinition(
|
|
129
139
|
namespace="Builtin",
|
|
130
140
|
name="ResourceManager",
|
|
131
|
-
label="Resource
|
|
141
|
+
label="Resource Managers",
|
|
132
142
|
path="/resource-manager",
|
|
133
143
|
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.RESOURCEPOOL)),
|
|
134
144
|
protected=True,
|
|
135
145
|
section=MenuSection.INTERNAL,
|
|
136
|
-
order_weight=
|
|
146
|
+
order_weight=2000,
|
|
137
147
|
),
|
|
138
|
-
],
|
|
139
|
-
),
|
|
140
|
-
MenuItemDefinition(
|
|
141
|
-
namespace="Builtin",
|
|
142
|
-
name="ChangeControl",
|
|
143
|
-
label="Change Control",
|
|
144
|
-
icon="mdi:source-branch",
|
|
145
|
-
protected=True,
|
|
146
|
-
section=MenuSection.INTERNAL,
|
|
147
|
-
order_weight=2000,
|
|
148
|
-
children=[
|
|
149
148
|
MenuItemDefinition(
|
|
150
149
|
namespace="Builtin",
|
|
151
|
-
name="
|
|
152
|
-
label="
|
|
153
|
-
|
|
154
|
-
icon=
|
|
150
|
+
name="Artifact",
|
|
151
|
+
label="Artifacts",
|
|
152
|
+
kind=InfrahubKind.ARTIFACT,
|
|
153
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACT)),
|
|
155
154
|
protected=True,
|
|
156
155
|
section=MenuSection.INTERNAL,
|
|
157
|
-
order_weight=
|
|
156
|
+
order_weight=2500,
|
|
158
157
|
),
|
|
159
158
|
MenuItemDefinition(
|
|
160
159
|
namespace="Builtin",
|
|
161
|
-
name="
|
|
162
|
-
label="
|
|
163
|
-
|
|
164
|
-
icon=
|
|
160
|
+
name="Schema",
|
|
161
|
+
label="Schemas",
|
|
162
|
+
path="/schema",
|
|
163
|
+
icon="mdi:file-code",
|
|
165
164
|
protected=True,
|
|
166
165
|
section=MenuSection.INTERNAL,
|
|
167
|
-
order_weight=
|
|
166
|
+
order_weight=2000,
|
|
168
167
|
),
|
|
169
168
|
MenuItemDefinition(
|
|
170
169
|
namespace="Builtin",
|
|
171
|
-
name="
|
|
172
|
-
label="
|
|
173
|
-
|
|
174
|
-
icon=
|
|
170
|
+
name="GraphqlQuery",
|
|
171
|
+
label="GraphQL Queries",
|
|
172
|
+
kind=InfrahubKind.GRAPHQLQUERY,
|
|
173
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GRAPHQLQUERY)),
|
|
175
174
|
protected=True,
|
|
176
175
|
section=MenuSection.INTERNAL,
|
|
177
|
-
order_weight=
|
|
176
|
+
order_weight=3500,
|
|
177
|
+
),
|
|
178
|
+
MenuItemDefinition(
|
|
179
|
+
namespace="Builtin",
|
|
180
|
+
name="ActivityLogs",
|
|
181
|
+
label="Activity Logs",
|
|
182
|
+
path="/activities",
|
|
183
|
+
icon="mdi:format-list-bulleted",
|
|
184
|
+
protected=True,
|
|
185
|
+
section=MenuSection.INTERNAL,
|
|
186
|
+
order_weight=4000,
|
|
178
187
|
),
|
|
179
188
|
],
|
|
180
189
|
),
|
|
181
190
|
MenuItemDefinition(
|
|
182
191
|
namespace="Builtin",
|
|
183
|
-
name="
|
|
184
|
-
label="
|
|
185
|
-
icon="mdi:
|
|
192
|
+
name="Actions",
|
|
193
|
+
label="Actions",
|
|
194
|
+
icon="mdi:rocket-launch",
|
|
186
195
|
protected=True,
|
|
187
196
|
section=MenuSection.INTERNAL,
|
|
188
197
|
order_weight=2500,
|
|
189
198
|
children=[
|
|
190
199
|
MenuItemDefinition(
|
|
191
200
|
namespace="Builtin",
|
|
192
|
-
name="
|
|
193
|
-
label="
|
|
194
|
-
|
|
195
|
-
icon=
|
|
201
|
+
name="CheckDefinition",
|
|
202
|
+
label="Check Definition",
|
|
203
|
+
kind=InfrahubKind.CHECKDEFINITION,
|
|
204
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CHECKDEFINITION)),
|
|
205
|
+
protected=True,
|
|
206
|
+
section=MenuSection.INTERNAL,
|
|
207
|
+
order_weight=3000,
|
|
208
|
+
),
|
|
209
|
+
MenuItemDefinition(
|
|
210
|
+
namespace="Builtin",
|
|
211
|
+
name="ArtifactDefinition",
|
|
212
|
+
label="Artifact Definitions",
|
|
213
|
+
kind=InfrahubKind.ARTIFACTDEFINITION,
|
|
214
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACTDEFINITION)),
|
|
196
215
|
protected=True,
|
|
197
216
|
section=MenuSection.INTERNAL,
|
|
198
217
|
order_weight=1000,
|
|
199
218
|
),
|
|
200
219
|
MenuItemDefinition(
|
|
201
220
|
namespace="Builtin",
|
|
202
|
-
name="
|
|
203
|
-
label="
|
|
204
|
-
kind=InfrahubKind.
|
|
205
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
221
|
+
name="Transformation",
|
|
222
|
+
label="Transformations",
|
|
223
|
+
kind=InfrahubKind.TRANSFORM,
|
|
224
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.TRANSFORM)),
|
|
206
225
|
protected=True,
|
|
207
226
|
section=MenuSection.INTERNAL,
|
|
208
|
-
order_weight=
|
|
227
|
+
order_weight=3000,
|
|
209
228
|
),
|
|
210
229
|
MenuItemDefinition(
|
|
211
230
|
namespace="Builtin",
|
|
212
|
-
name="
|
|
213
|
-
label="
|
|
214
|
-
kind=InfrahubKind.
|
|
215
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
231
|
+
name="GeneratorInstance",
|
|
232
|
+
label="Generators",
|
|
233
|
+
kind=InfrahubKind.GENERATORINSTANCE,
|
|
234
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORINSTANCE)),
|
|
216
235
|
protected=True,
|
|
217
236
|
section=MenuSection.INTERNAL,
|
|
218
|
-
order_weight=
|
|
237
|
+
order_weight=1000,
|
|
219
238
|
),
|
|
220
239
|
MenuItemDefinition(
|
|
221
240
|
namespace="Builtin",
|
|
222
|
-
name="
|
|
223
|
-
label="
|
|
224
|
-
kind=InfrahubKind.
|
|
225
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
241
|
+
name="GeneratorDefinition",
|
|
242
|
+
label="Generator Definitions",
|
|
243
|
+
kind=InfrahubKind.GENERATORDEFINITION,
|
|
244
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORDEFINITION)),
|
|
226
245
|
protected=True,
|
|
227
246
|
section=MenuSection.INTERNAL,
|
|
228
|
-
order_weight=
|
|
247
|
+
order_weight=2000,
|
|
229
248
|
),
|
|
230
249
|
],
|
|
231
250
|
),
|
|
232
251
|
MenuItemDefinition(
|
|
233
252
|
namespace="Builtin",
|
|
234
|
-
name="
|
|
235
|
-
label="
|
|
236
|
-
icon="mdi:
|
|
253
|
+
name="Integration",
|
|
254
|
+
label="Integrations",
|
|
255
|
+
icon="mdi:connection",
|
|
237
256
|
protected=True,
|
|
238
257
|
section=MenuSection.INTERNAL,
|
|
239
258
|
order_weight=3000,
|
|
240
259
|
children=[
|
|
241
260
|
MenuItemDefinition(
|
|
242
261
|
namespace="Builtin",
|
|
243
|
-
name="
|
|
244
|
-
label="
|
|
262
|
+
name="Webhooks",
|
|
263
|
+
label="Webhooks",
|
|
264
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
|
|
245
265
|
protected=True,
|
|
246
266
|
section=MenuSection.INTERNAL,
|
|
247
|
-
order_weight=
|
|
267
|
+
order_weight=3000,
|
|
248
268
|
children=[
|
|
249
269
|
MenuItemDefinition(
|
|
250
270
|
namespace="Builtin",
|
|
251
|
-
name="
|
|
252
|
-
label="
|
|
253
|
-
kind=InfrahubKind.
|
|
254
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
271
|
+
name="WebhookStandard",
|
|
272
|
+
label="Webhooks",
|
|
273
|
+
kind=InfrahubKind.STANDARDWEBHOOK,
|
|
274
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.STANDARDWEBHOOK)),
|
|
255
275
|
protected=True,
|
|
256
276
|
section=MenuSection.INTERNAL,
|
|
257
277
|
order_weight=1000,
|
|
258
278
|
),
|
|
259
279
|
MenuItemDefinition(
|
|
260
280
|
namespace="Builtin",
|
|
261
|
-
name="
|
|
262
|
-
label="
|
|
263
|
-
kind=InfrahubKind.
|
|
264
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
281
|
+
name="WebhookCustom",
|
|
282
|
+
label="Custom Webhooks",
|
|
283
|
+
kind=InfrahubKind.CUSTOMWEBHOOK,
|
|
284
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
|
|
265
285
|
protected=True,
|
|
266
286
|
section=MenuSection.INTERNAL,
|
|
267
|
-
order_weight=
|
|
287
|
+
order_weight=2000,
|
|
268
288
|
),
|
|
269
289
|
],
|
|
270
290
|
),
|
|
271
291
|
MenuItemDefinition(
|
|
272
292
|
namespace="Builtin",
|
|
273
|
-
name="
|
|
274
|
-
label="
|
|
293
|
+
name="Git Repository",
|
|
294
|
+
label="Git Repositories",
|
|
295
|
+
kind=InfrahubKind.GENERICREPOSITORY,
|
|
296
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERICREPOSITORY)),
|
|
275
297
|
protected=True,
|
|
276
298
|
section=MenuSection.INTERNAL,
|
|
277
|
-
order_weight=
|
|
278
|
-
children=[
|
|
279
|
-
MenuItemDefinition(
|
|
280
|
-
namespace="Builtin",
|
|
281
|
-
name="GeneratorInstance",
|
|
282
|
-
label="Generator Instance",
|
|
283
|
-
kind=InfrahubKind.GENERATORINSTANCE,
|
|
284
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORINSTANCE)),
|
|
285
|
-
protected=True,
|
|
286
|
-
section=MenuSection.INTERNAL,
|
|
287
|
-
order_weight=1000,
|
|
288
|
-
),
|
|
289
|
-
MenuItemDefinition(
|
|
290
|
-
namespace="Builtin",
|
|
291
|
-
name="GeneratorDefinition",
|
|
292
|
-
label="Generator Definition",
|
|
293
|
-
kind=InfrahubKind.GENERATORDEFINITION,
|
|
294
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORDEFINITION)),
|
|
295
|
-
protected=True,
|
|
296
|
-
section=MenuSection.INTERNAL,
|
|
297
|
-
order_weight=2000,
|
|
298
|
-
),
|
|
299
|
-
],
|
|
299
|
+
order_weight=2000,
|
|
300
300
|
),
|
|
301
301
|
MenuItemDefinition(
|
|
302
302
|
namespace="Builtin",
|
|
303
|
-
name="
|
|
304
|
-
label="
|
|
305
|
-
kind=InfrahubKind.
|
|
306
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.
|
|
303
|
+
name="Credentials",
|
|
304
|
+
label="Credentials",
|
|
305
|
+
kind=InfrahubKind.CREDENTIAL,
|
|
306
|
+
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CREDENTIAL)),
|
|
307
307
|
protected=True,
|
|
308
308
|
section=MenuSection.INTERNAL,
|
|
309
|
-
order_weight=
|
|
309
|
+
order_weight=2000,
|
|
310
310
|
),
|
|
311
311
|
],
|
|
312
312
|
),
|
|
313
313
|
MenuItemDefinition(
|
|
314
314
|
namespace="Builtin",
|
|
315
|
-
name="
|
|
316
|
-
label="
|
|
317
|
-
icon="mdi:
|
|
315
|
+
name="Activity",
|
|
316
|
+
label="Activity",
|
|
317
|
+
icon="mdi:chart-bar-stacked",
|
|
318
318
|
protected=True,
|
|
319
319
|
section=MenuSection.INTERNAL,
|
|
320
|
-
order_weight=
|
|
320
|
+
order_weight=4000,
|
|
321
321
|
children=[
|
|
322
322
|
MenuItemDefinition(
|
|
323
323
|
namespace="Builtin",
|
|
324
|
-
name="
|
|
325
|
-
label="
|
|
326
|
-
|
|
324
|
+
name="Tasks",
|
|
325
|
+
label="Tasks",
|
|
326
|
+
path="/tasks",
|
|
327
|
+
icon="mdi:shield-check",
|
|
327
328
|
protected=True,
|
|
328
329
|
section=MenuSection.INTERNAL,
|
|
329
|
-
order_weight=
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
),
|
|
341
|
-
MenuItemDefinition(
|
|
342
|
-
namespace="Builtin",
|
|
343
|
-
name="WebhookCustom",
|
|
344
|
-
label="Custom Webhook",
|
|
345
|
-
kind=InfrahubKind.CUSTOMWEBHOOK,
|
|
346
|
-
icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
|
|
347
|
-
protected=True,
|
|
348
|
-
section=MenuSection.INTERNAL,
|
|
349
|
-
order_weight=2000,
|
|
350
|
-
),
|
|
351
|
-
],
|
|
330
|
+
order_weight=1000,
|
|
331
|
+
),
|
|
332
|
+
MenuItemDefinition(
|
|
333
|
+
namespace="Builtin",
|
|
334
|
+
name="ActivityLog",
|
|
335
|
+
label="Activity Log",
|
|
336
|
+
path="/activity-log",
|
|
337
|
+
icon="mdi:timeline-text",
|
|
338
|
+
protected=True,
|
|
339
|
+
section=MenuSection.INTERNAL,
|
|
340
|
+
order_weight=2000,
|
|
352
341
|
),
|
|
353
342
|
],
|
|
354
343
|
),
|
infrahub/menu/models.py
CHANGED
|
@@ -9,7 +9,7 @@ from typing_extensions import Self
|
|
|
9
9
|
from infrahub.core.account import GlobalPermission
|
|
10
10
|
from infrahub.core.node import Node
|
|
11
11
|
from infrahub.core.protocols import CoreMenuItem
|
|
12
|
-
from infrahub.core.schema import GenericSchema, MainSchemaTypes, NodeSchema, ProfileSchema
|
|
12
|
+
from infrahub.core.schema import GenericSchema, MainSchemaTypes, NodeSchema, ProfileSchema, TemplateSchema
|
|
13
13
|
|
|
14
14
|
from .constants import MenuSection
|
|
15
15
|
|
|
@@ -17,8 +17,8 @@ if TYPE_CHECKING:
|
|
|
17
17
|
from infrahub.database import InfrahubDatabase
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def get_full_name(obj: CoreMenuItem | NodeSchema | GenericSchema | ProfileSchema) -> str:
|
|
21
|
-
if isinstance(obj,
|
|
20
|
+
def get_full_name(obj: CoreMenuItem | NodeSchema | GenericSchema | ProfileSchema | TemplateSchema) -> str:
|
|
21
|
+
if isinstance(obj, NodeSchema | GenericSchema | ProfileSchema | TemplateSchema):
|
|
22
22
|
return _get_full_name_schema(obj)
|
|
23
23
|
return _get_full_name_node(obj)
|
|
24
24
|
|
|
@@ -97,7 +97,7 @@ class MenuItem(BaseModel):
|
|
|
97
97
|
)
|
|
98
98
|
|
|
99
99
|
@classmethod
|
|
100
|
-
def from_schema(cls, model: NodeSchema | GenericSchema | ProfileSchema) -> Self:
|
|
100
|
+
def from_schema(cls, model: NodeSchema | GenericSchema | ProfileSchema | TemplateSchema) -> Self:
|
|
101
101
|
return cls(
|
|
102
102
|
identifier=get_full_name(model),
|
|
103
103
|
label=model.label or model.kind,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from infrahub.message_bus import InfrahubMessage, InfrahubResponse
|
|
2
2
|
|
|
3
|
-
from .check_artifact_create import CheckArtifactCreate
|
|
4
3
|
from .check_generator_run import CheckGeneratorRun
|
|
5
4
|
from .check_repository_checkdefinition import CheckRepositoryCheckDefinition
|
|
6
5
|
from .check_repository_mergeconflicts import CheckRepositoryMergeConflicts
|
|
@@ -19,7 +18,6 @@ from .proposed_change.request_proposedchange_refreshartifacts import RequestProp
|
|
|
19
18
|
from .refresh_git_fetch import RefreshGitFetch
|
|
20
19
|
from .refresh_registry_branches import RefreshRegistryBranches
|
|
21
20
|
from .refresh_registry_rebasedbranch import RefreshRegistryRebasedBranch
|
|
22
|
-
from .request_artifactdefinition_check import RequestArtifactDefinitionCheck
|
|
23
21
|
from .request_generatordefinition_check import RequestGeneratorDefinitionCheck
|
|
24
22
|
from .request_proposedchange_pipeline import RequestProposedChangePipeline
|
|
25
23
|
from .request_repository_checks import RequestRepositoryChecks
|
|
@@ -27,7 +25,6 @@ from .request_repository_userchecks import RequestRepositoryUserChecks
|
|
|
27
25
|
from .send_echo_request import SendEchoRequest, SendEchoRequestResponse
|
|
28
26
|
|
|
29
27
|
MESSAGE_MAP: dict[str, type[InfrahubMessage]] = {
|
|
30
|
-
"check.artifact.create": CheckArtifactCreate,
|
|
31
28
|
"check.generator.run": CheckGeneratorRun,
|
|
32
29
|
"check.repository.check_definition": CheckRepositoryCheckDefinition,
|
|
33
30
|
"check.repository.merge_conflicts": CheckRepositoryMergeConflicts,
|
|
@@ -45,7 +42,6 @@ MESSAGE_MAP: dict[str, type[InfrahubMessage]] = {
|
|
|
45
42
|
"refresh.git.fetch": RefreshGitFetch,
|
|
46
43
|
"refresh.registry.branches": RefreshRegistryBranches,
|
|
47
44
|
"refresh.registry.rebased_branch": RefreshRegistryRebasedBranch,
|
|
48
|
-
"request.artifact_definition.check": RequestArtifactDefinitionCheck,
|
|
49
45
|
"request.generator_definition.check": RequestGeneratorDefinitionCheck,
|
|
50
46
|
"request.proposed_change.pipeline": RequestProposedChangePipeline,
|
|
51
47
|
"request.proposed_change.refresh_artifacts": RequestProposedChangeRefreshArtifacts,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import Field
|
|
2
2
|
|
|
3
|
+
from infrahub.context import InfrahubContext
|
|
3
4
|
from infrahub.message_bus import InfrahubMessage
|
|
4
5
|
|
|
5
6
|
|
|
@@ -8,3 +9,5 @@ class EventBranchMerge(InfrahubMessage):
|
|
|
8
9
|
|
|
9
10
|
source_branch: str = Field(..., description="The source branch")
|
|
10
11
|
target_branch: str = Field(..., description="The target branch")
|
|
12
|
+
|
|
13
|
+
context: InfrahubContext = Field(..., description="The context of the event")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import Field
|
|
2
2
|
|
|
3
|
+
from infrahub.context import InfrahubContext
|
|
3
4
|
from infrahub.core.constants import CheckType
|
|
4
5
|
from infrahub.message_bus import InfrahubMessage
|
|
5
6
|
|
|
@@ -14,3 +15,4 @@ class RequestProposedChangePipeline(InfrahubMessage):
|
|
|
14
15
|
check_type: CheckType = Field(
|
|
15
16
|
default=CheckType.ALL, description="Can be used to restrict the pipeline to a specific type of job"
|
|
16
17
|
)
|
|
18
|
+
context: InfrahubContext = Field(..., description="The context of the task")
|
|
@@ -18,7 +18,6 @@ from infrahub.services import InfrahubServices
|
|
|
18
18
|
from infrahub.tasks.check import set_check_status
|
|
19
19
|
|
|
20
20
|
COMMAND_MAP = {
|
|
21
|
-
"check.artifact.create": check.artifact.create,
|
|
22
21
|
"check.generator.run": check.generator.run,
|
|
23
22
|
"check.repository.check_definition": check.repository.check_definition,
|
|
24
23
|
"check.repository.merge_conflicts": check.repository.merge_conflicts,
|
|
@@ -34,7 +33,6 @@ COMMAND_MAP = {
|
|
|
34
33
|
"refresh.registry.branches": refresh.registry.branches,
|
|
35
34
|
"refresh.registry.rebased_branch": refresh.registry.rebased_branch,
|
|
36
35
|
"request.generator_definition.check": requests.generator_definition.check,
|
|
37
|
-
"request.artifact_definition.check": requests.artifact_definition.check,
|
|
38
36
|
"request.proposed_change.pipeline": requests.proposed_change.pipeline,
|
|
39
37
|
"request.proposed_change.refresh_artifacts": requests.proposed_change.refresh_artifacts,
|
|
40
38
|
"request.repository.checks": requests.repository.checks,
|
|
@@ -54,15 +52,15 @@ async def execute_message(
|
|
|
54
52
|
if skip_flow and isinstance(func, Flow):
|
|
55
53
|
func = func.fn
|
|
56
54
|
await func(message=message, service=service)
|
|
57
|
-
except Exception as exc:
|
|
55
|
+
except Exception as exc:
|
|
58
56
|
if message.reply_requested:
|
|
59
57
|
response = RPCErrorResponse(errors=[str(exc)], initial_message=message.model_dump())
|
|
60
|
-
await service.
|
|
58
|
+
await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)
|
|
61
59
|
return None
|
|
62
60
|
if message.reached_max_retries:
|
|
63
61
|
service.log.exception("Message failed after maximum number of retries", error=exc)
|
|
64
62
|
await set_check_status(message, conclusion="failure", service=service)
|
|
65
63
|
return None
|
|
66
64
|
message.increase_retry_count()
|
|
67
|
-
await service.send(message, delay=MessageTTL.FIVE, is_retry=True)
|
|
65
|
+
await service.message_bus.send(message, delay=MessageTTL.FIVE, is_retry=True)
|
|
68
66
|
return MessageTTL.FIVE
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
from . import
|
|
1
|
+
from . import generator, repository
|
|
2
2
|
|
|
3
|
-
__all__ = ["
|
|
3
|
+
__all__ = ["generator", "repository"]
|
|
@@ -14,8 +14,6 @@ from infrahub.services import InfrahubServices
|
|
|
14
14
|
from infrahub.tasks.check import set_check_status
|
|
15
15
|
from infrahub.workflows.utils import add_tags
|
|
16
16
|
|
|
17
|
-
# pylint: disable=duplicate-code
|
|
18
|
-
|
|
19
17
|
|
|
20
18
|
@flow(
|
|
21
19
|
name="git-repository-check-generator-run",
|
|
@@ -81,7 +79,7 @@ async def run(message: messages.CheckGeneratorRun, service: InfrahubServices) ->
|
|
|
81
79
|
generator_instance.status.value = GeneratorInstanceStatus.ERROR.value
|
|
82
80
|
check_message = f"Failed to import generator: {exc.message}"
|
|
83
81
|
log.exception(check_message, exc_info=exc)
|
|
84
|
-
except Exception as exc:
|
|
82
|
+
except Exception as exc:
|
|
85
83
|
conclusion = ValidatorConclusion.FAILURE
|
|
86
84
|
generator_instance.status.value = GeneratorInstanceStatus.ERROR.value
|
|
87
85
|
check_message = f"Failed to execute generator: {str(exc)}"
|
|
@@ -132,7 +132,7 @@ async def check_definition(message: messages.CheckRepositoryCheckDefinition, ser
|
|
|
132
132
|
|
|
133
133
|
for event in events:
|
|
134
134
|
event.assign_meta(parent=message)
|
|
135
|
-
await service.send(message=event)
|
|
135
|
+
await service.message_bus.send(message=event)
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
@flow(
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from prefect import flow
|
|
2
4
|
|
|
3
5
|
from infrahub.core import registry
|
|
@@ -7,7 +9,7 @@ from infrahub.core.diff.repository.repository import DiffRepository
|
|
|
7
9
|
from infrahub.dependencies.registry import get_component_registry
|
|
8
10
|
from infrahub.log import get_logger
|
|
9
11
|
from infrahub.message_bus import InfrahubMessage, messages
|
|
10
|
-
from infrahub.services import InfrahubServices
|
|
12
|
+
from infrahub.services import InfrahubServices # noqa: TC001 needed for prefect flow
|
|
11
13
|
from infrahub.workflows.catalogue import (
|
|
12
14
|
DIFF_UPDATE,
|
|
13
15
|
TRIGGER_ARTIFACT_DEFINITION_GENERATE,
|
|
@@ -33,11 +35,13 @@ async def merge(message: messages.EventBranchMerge, service: InfrahubServices) -
|
|
|
33
35
|
|
|
34
36
|
await service.workflow.submit_workflow(
|
|
35
37
|
workflow=TRIGGER_ARTIFACT_DEFINITION_GENERATE,
|
|
38
|
+
context=message.context,
|
|
36
39
|
parameters={"branch": message.target_branch},
|
|
37
40
|
)
|
|
38
41
|
|
|
39
42
|
await service.workflow.submit_workflow(
|
|
40
43
|
workflow=TRIGGER_GENERATOR_DEFINITION_RUN,
|
|
44
|
+
context=message.context,
|
|
41
45
|
parameters={"branch": message.target_branch},
|
|
42
46
|
)
|
|
43
47
|
|
|
@@ -49,9 +53,9 @@ async def merge(message: messages.EventBranchMerge, service: InfrahubServices) -
|
|
|
49
53
|
):
|
|
50
54
|
request_diff_update_model = RequestDiffUpdate(branch_name=diff_root.diff_branch_name)
|
|
51
55
|
await service.workflow.submit_workflow(
|
|
52
|
-
workflow=DIFF_UPDATE, parameters={"model": request_diff_update_model}
|
|
56
|
+
workflow=DIFF_UPDATE, context=message.context, parameters={"model": request_diff_update_model}
|
|
53
57
|
)
|
|
54
58
|
|
|
55
59
|
for event in events:
|
|
56
60
|
event.assign_meta(parent=message)
|
|
57
|
-
await service.send(message=event)
|
|
61
|
+
await service.message_bus.send(message=event)
|
|
@@ -67,7 +67,7 @@ async def execution(message: messages.FinalizeValidatorExecution, service: Infra
|
|
|
67
67
|
validator_id=message.validator_id,
|
|
68
68
|
validator_execution_id=message.validator_execution_id,
|
|
69
69
|
)
|
|
70
|
-
await service.send(message=message, delay=MessageTTL.FIVE)
|
|
70
|
+
await service.message_bus.send(message=message, delay=MessageTTL.FIVE)
|
|
71
71
|
return
|
|
72
72
|
|
|
73
73
|
log.info(
|
|
@@ -27,8 +27,8 @@ async def get(message: messages.GitFileGet, service: InfrahubServices) -> None:
|
|
|
27
27
|
except (FileOutOfRepositoryError, RepositoryFileNotFoundError) as e:
|
|
28
28
|
if message.reply_requested:
|
|
29
29
|
response = GitFileGetResponse(data=GitFileGetResponseData(error_message=e.message, http_code=e.HTTP_CODE))
|
|
30
|
-
await service.
|
|
30
|
+
await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)
|
|
31
31
|
else:
|
|
32
32
|
if message.reply_requested:
|
|
33
33
|
response = GitFileGetResponse(data=GitFileGetResponseData(content=content))
|
|
34
|
-
await service.
|
|
34
|
+
await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)
|