infrahub-server 1.2.3__py3-none-any.whl → 1.2.5__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/cli/db.py +308 -2
- infrahub/cli/git_agent.py +4 -10
- infrahub/config.py +32 -0
- infrahub/core/branch/tasks.py +50 -10
- infrahub/core/constants/__init__.py +1 -0
- infrahub/core/constraint/node/runner.py +6 -5
- infrahub/core/graph/__init__.py +1 -1
- infrahub/core/migrations/graph/__init__.py +4 -0
- infrahub/core/migrations/graph/m018_uniqueness_nulls.py +68 -70
- infrahub/core/migrations/graph/m025_uniqueness_nulls.py +26 -0
- infrahub/core/migrations/graph/m026_0000_prefix_fix.py +54 -0
- infrahub/core/migrations/schema/node_attribute_remove.py +16 -2
- infrahub/core/models.py +1 -1
- infrahub/core/node/__init__.py +4 -1
- infrahub/core/node/constraints/grouped_uniqueness.py +6 -1
- infrahub/core/node/resource_manager/number_pool.py +1 -1
- infrahub/core/registry.py +18 -0
- infrahub/core/schema/basenode_schema.py +21 -1
- infrahub/core/schema/definitions/internal.py +2 -1
- infrahub/core/schema/generated/base_node_schema.py +1 -1
- infrahub/core/schema/manager.py +21 -1
- infrahub/core/schema/schema_branch.py +8 -7
- infrahub/core/schema/schema_branch_computed.py +12 -1
- infrahub/database/__init__.py +10 -0
- infrahub/events/branch_action.py +3 -0
- infrahub/events/group_action.py +6 -1
- infrahub/events/node_action.py +5 -1
- infrahub/git/integrator.py +2 -2
- infrahub/graphql/mutations/main.py +10 -12
- infrahub/message_bus/messages/__init__.py +0 -4
- infrahub/message_bus/messages/request_proposedchange_pipeline.py +5 -0
- infrahub/message_bus/operations/__init__.py +0 -3
- infrahub/message_bus/operations/requests/proposed_change.py +29 -9
- infrahub/message_bus/types.py +2 -34
- infrahub/proposed_change/branch_diff.py +65 -0
- infrahub/proposed_change/tasks.py +12 -4
- infrahub/server.py +6 -11
- infrahub/services/adapters/cache/__init__.py +17 -0
- infrahub/services/adapters/cache/redis.py +11 -1
- infrahub/services/adapters/message_bus/__init__.py +20 -0
- infrahub/services/adapters/workflow/worker.py +1 -1
- infrahub/services/component.py +1 -2
- infrahub/tasks/registry.py +3 -7
- infrahub/workers/infrahub_async.py +4 -10
- infrahub/workflows/catalogue.py +10 -0
- infrahub_sdk/generator.py +1 -0
- infrahub_sdk/node.py +16 -4
- infrahub_sdk/schema/__init__.py +10 -1
- {infrahub_server-1.2.3.dist-info → infrahub_server-1.2.5.dist-info}/METADATA +2 -2
- {infrahub_server-1.2.3.dist-info → infrahub_server-1.2.5.dist-info}/RECORD +57 -60
- infrahub_testcontainers/container.py +4 -0
- infrahub_testcontainers/helpers.py +1 -1
- infrahub_testcontainers/models.py +2 -2
- infrahub_testcontainers/performance_test.py +4 -4
- infrahub/core/branch/flow_models.py +0 -0
- infrahub/message_bus/messages/event_branch_merge.py +0 -13
- infrahub/message_bus/messages/event_worker_newprimaryapi.py +0 -9
- infrahub/message_bus/operations/event/__init__.py +0 -3
- infrahub/message_bus/operations/event/branch.py +0 -61
- infrahub/message_bus/operations/event/worker.py +0 -9
- {infrahub_server-1.2.3.dist-info → infrahub_server-1.2.5.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.2.3.dist-info → infrahub_server-1.2.5.dist-info}/WHEEL +0 -0
- {infrahub_server-1.2.3.dist-info → infrahub_server-1.2.5.dist-info}/entry_points.txt +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from prefect import flow
|
|
4
|
-
|
|
5
|
-
from infrahub.core import registry
|
|
6
|
-
from infrahub.core.diff.model.path import BranchTrackingId
|
|
7
|
-
from infrahub.core.diff.models import RequestDiffUpdate
|
|
8
|
-
from infrahub.core.diff.repository.repository import DiffRepository
|
|
9
|
-
from infrahub.dependencies.registry import get_component_registry
|
|
10
|
-
from infrahub.log import get_logger
|
|
11
|
-
from infrahub.message_bus import InfrahubMessage, messages
|
|
12
|
-
from infrahub.services import InfrahubServices # noqa: TC001 needed for prefect flow
|
|
13
|
-
from infrahub.workflows.catalogue import (
|
|
14
|
-
DIFF_UPDATE,
|
|
15
|
-
TRIGGER_ARTIFACT_DEFINITION_GENERATE,
|
|
16
|
-
TRIGGER_GENERATOR_DEFINITION_RUN,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
log = get_logger()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@flow(name="branch-event-merge")
|
|
23
|
-
async def merge(message: messages.EventBranchMerge, service: InfrahubServices) -> None:
|
|
24
|
-
async with service.database.start_session() as db:
|
|
25
|
-
log.info("Branch merged", source_branch=message.source_branch, target_branch=message.target_branch)
|
|
26
|
-
|
|
27
|
-
events: list[InfrahubMessage] = [
|
|
28
|
-
messages.RefreshRegistryBranches(),
|
|
29
|
-
]
|
|
30
|
-
component_registry = get_component_registry()
|
|
31
|
-
default_branch = registry.get_branch_from_registry()
|
|
32
|
-
diff_repository = await component_registry.get_component(DiffRepository, db=db, branch=default_branch)
|
|
33
|
-
# send diff update requests for every branch-tracking diff
|
|
34
|
-
branch_diff_roots = await diff_repository.get_roots_metadata(base_branch_names=[message.target_branch])
|
|
35
|
-
|
|
36
|
-
await service.workflow.submit_workflow(
|
|
37
|
-
workflow=TRIGGER_ARTIFACT_DEFINITION_GENERATE,
|
|
38
|
-
context=message.context,
|
|
39
|
-
parameters={"branch": message.target_branch},
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
await service.workflow.submit_workflow(
|
|
43
|
-
workflow=TRIGGER_GENERATOR_DEFINITION_RUN,
|
|
44
|
-
context=message.context,
|
|
45
|
-
parameters={"branch": message.target_branch},
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
for diff_root in branch_diff_roots:
|
|
49
|
-
if (
|
|
50
|
-
diff_root.base_branch_name != diff_root.diff_branch_name
|
|
51
|
-
and diff_root.tracking_id
|
|
52
|
-
and isinstance(diff_root.tracking_id, BranchTrackingId)
|
|
53
|
-
):
|
|
54
|
-
request_diff_update_model = RequestDiffUpdate(branch_name=diff_root.diff_branch_name)
|
|
55
|
-
await service.workflow.submit_workflow(
|
|
56
|
-
workflow=DIFF_UPDATE, context=message.context, parameters={"model": request_diff_update_model}
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
for event in events:
|
|
60
|
-
event.assign_meta(parent=message)
|
|
61
|
-
await service.message_bus.send(message=event)
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from prefect import flow
|
|
2
|
-
|
|
3
|
-
from infrahub.message_bus import messages
|
|
4
|
-
from infrahub.services import InfrahubServices
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@flow(name="event-worker-newprimary-api")
|
|
8
|
-
async def new_primary_api(message: messages.EventWorkerNewPrimaryAPI, service: InfrahubServices) -> None:
|
|
9
|
-
service.log.info("api_worker promoted to primary", worker_id=message.worker_id)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|