infrahub-server 1.2.4__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/core/branch/tasks.py +50 -10
- infrahub/core/graph/__init__.py +1 -1
- infrahub/core/migrations/graph/__init__.py +2 -0
- infrahub/core/migrations/graph/m026_0000_prefix_fix.py +54 -0
- infrahub/core/node/__init__.py +4 -1
- infrahub/core/node/resource_manager/number_pool.py +1 -1
- infrahub/core/schema/manager.py +0 -1
- infrahub/core/schema/schema_branch.py +5 -3
- infrahub/core/schema/schema_branch_computed.py +12 -1
- infrahub/events/branch_action.py +3 -0
- infrahub/events/group_action.py +1 -1
- infrahub/events/node_action.py +1 -1
- infrahub/git/integrator.py +2 -2
- infrahub/message_bus/messages/__init__.py +0 -2
- infrahub/message_bus/messages/request_proposedchange_pipeline.py +5 -0
- infrahub/message_bus/operations/__init__.py +0 -2
- 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/services/adapters/workflow/worker.py +1 -1
- infrahub/workflows/catalogue.py +10 -0
- infrahub_sdk/generator.py +1 -0
- infrahub_sdk/node.py +16 -4
- {infrahub_server-1.2.4.dist-info → infrahub_server-1.2.5.dist-info}/METADATA +2 -2
- {infrahub_server-1.2.4.dist-info → infrahub_server-1.2.5.dist-info}/RECORD +32 -34
- 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/operations/event/__init__.py +0 -3
- infrahub/message_bus/operations/event/branch.py +0 -61
- {infrahub_server-1.2.4.dist-info → infrahub_server-1.2.5.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.2.4.dist-info → infrahub_server-1.2.5.dist-info}/WHEEL +0 -0
- {infrahub_server-1.2.4.dist-info → infrahub_server-1.2.5.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import json
|
|
3
|
-
from datetime import
|
|
3
|
+
from datetime import datetime, timezone
|
|
4
4
|
from types import TracebackType
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@ class InfrahubPerformanceTest:
|
|
|
35
35
|
self.env_vars = {}
|
|
36
36
|
self.project_name = ""
|
|
37
37
|
self.test_info = {}
|
|
38
|
-
self.start_time = datetime.now(
|
|
38
|
+
self.start_time = datetime.now(timezone.utc)
|
|
39
39
|
self.end_time: datetime | None = None
|
|
40
40
|
self.results_url = results_url
|
|
41
41
|
self.scraper_endpoint = ""
|
|
@@ -57,7 +57,7 @@ class InfrahubPerformanceTest:
|
|
|
57
57
|
|
|
58
58
|
def finalize(self, session: pytest.Session) -> None:
|
|
59
59
|
if self.initialized:
|
|
60
|
-
self.end_time = datetime.now(
|
|
60
|
+
self.end_time = datetime.now(timezone.utc)
|
|
61
61
|
self.extract_test_session_information(session)
|
|
62
62
|
self.send_results()
|
|
63
63
|
|
|
@@ -129,7 +129,7 @@ class InfrahubPerformanceTest:
|
|
|
129
129
|
if not exc_type and self.active_measurements:
|
|
130
130
|
self.add_measurement(
|
|
131
131
|
definition=self.active_measurements.definition,
|
|
132
|
-
value=(datetime.now(
|
|
132
|
+
value=(datetime.now(timezone.utc) - self.active_measurements.start_time).total_seconds() * 1000,
|
|
133
133
|
context=self.active_measurements.context,
|
|
134
134
|
)
|
|
135
135
|
|
|
File without changes
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from pydantic import Field
|
|
2
|
-
|
|
3
|
-
from infrahub.context import InfrahubContext
|
|
4
|
-
from infrahub.message_bus import InfrahubMessage
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class EventBranchMerge(InfrahubMessage):
|
|
8
|
-
"""Sent when a branch has been merged."""
|
|
9
|
-
|
|
10
|
-
source_branch: str = Field(..., description="The source branch")
|
|
11
|
-
target_branch: str = Field(..., description="The target branch")
|
|
12
|
-
|
|
13
|
-
context: InfrahubContext = Field(..., description="The context of the event")
|
|
@@ -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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|