Skip to content

Commit 00888e0

Browse files
committed
Minor changes
1 parent 716afd3 commit 00888e0

File tree

5 files changed

+13
-61
lines changed

5 files changed

+13
-61
lines changed

backend/infrahub/message_bus/messages/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"git.diff.names_only": GitDiffNamesOnly,
5353
"git.file.get": GitFileGet,
5454
"git.repository.connectivity": GitRepositoryConnectivity,
55-
"git.repository.add_read_only": GitRepositoryAddReadOnly,
5655
"git.repository.import_objects": GitRepositoryImportObjects,
5756
"schema.migration.path": SchemaMigrationPath,
5857
"schema.validator.path": SchemaValidatorPath,
@@ -61,7 +60,6 @@
6160
"refresh.webhook.configuration": RefreshWebhookConfiguration,
6261
"request.artifact_definition.check": RequestArtifactDefinitionCheck,
6362
"request.generator_definition.check": RequestGeneratorDefinitionCheck,
64-
"request.proposed_change.data_integrity": RequestProposedChangeDataIntegrity,
6563
"request.proposed_change.pipeline": RequestProposedChangePipeline,
6664
"request.proposed_change.refresh_artifacts": RequestProposedChangeRefreshArtifacts,
6765
"request.proposed_change.repository_checks": RequestProposedChangeRepositoryChecks,

backend/infrahub/proposed_change/tasks.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING
4-
53
from infrahub_sdk.protocols import CoreProposedChange
64
from prefect import flow, task
75
from prefect.logging import get_run_logger
@@ -10,11 +8,11 @@
108
from infrahub.core.constants import ProposedChangeState
119
from infrahub.core.diff.coordinator import DiffCoordinator
1210
from infrahub.dependencies.registry import get_component_registry
11+
from infrahub.proposed_change.models import (
12+
RequestProposedChangeDataIntegrity, # noqa: TCH001. as symbol is required by prefect flow
13+
)
1314
from infrahub.services import services
1415

15-
if TYPE_CHECKING:
16-
from infrahub.proposed_change.models import RequestProposedChangeDataIntegrity
17-
1816

1917
@flow(name="proposed-changes-cancel-branch", description="Cancel all Proposed change associated with a branch.")
2018
async def cancel_proposed_changes_branch(branch_name: str) -> None:
@@ -49,22 +47,15 @@ async def cancel_proposed_change(proposed_change: CoreProposedChange) -> None:
4947

5048
@flow(
5149
name="proposed-changed-data-integrity",
52-
flow_run_name="Triggers data integrity check on proposed change {model.proposed_change}",
50+
flow_run_name="Triggers data integrity check",
5351
)
5452
async def run_proposed_change_data_integrity_check(model: RequestProposedChangeDataIntegrity) -> None:
5553
"""Triggers a data integrity validation check on the provided proposed change to start."""
5654

5755
service = services.service
58-
async with service.task_report(
59-
related_node=model.proposed_change,
60-
title="Data Integrity",
61-
):
62-
log = get_run_logger()
63-
log.info(f"Got a request to process data integrity defined in proposed_change: {model.proposed_change}")
64-
65-
destination_branch = await registry.get_branch(db=service.database, branch=model.destination_branch)
66-
source_branch = await registry.get_branch(db=service.database, branch=model.source_branch)
67-
component_registry = get_component_registry()
68-
async with service.database.start_transaction() as dbt:
69-
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=dbt, branch=source_branch)
70-
await diff_coordinator.update_branch_diff(base_branch=destination_branch, diff_branch=source_branch)
56+
destination_branch = await registry.get_branch(db=service.database, branch=model.destination_branch)
57+
source_branch = await registry.get_branch(db=service.database, branch=model.source_branch)
58+
component_registry = get_component_registry()
59+
async with service.database.start_transaction() as dbt:
60+
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=dbt, branch=source_branch)
61+
await diff_coordinator.update_branch_diff(base_branch=destination_branch, diff_branch=source_branch)

backend/infrahub/workflows/catalogue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
type=WorkflowType.INTERNAL,
143143
module="infrahub.git.tasks",
144144
function="add_git_repository_read_only",
145-
branch_support=BranchSupportType.AWARE,
146145
tags=[WorkflowTag.DATABASE_CHANGE],
147146
)
148147

@@ -267,4 +266,5 @@
267266
PROCESS_COMPUTED_MACRO,
268267
COMPUTED_ATTRIBUTE_SETUP,
269268
UPDATE_COMPUTED_ATTRIBUTE_TRANSFORM,
269+
REQUEST_PROPOSED_CHANGE_DATA_INTEGRITY,
270270
]

backend/tests/integration/message_bus/operations/request/test_proposed_change.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from infrahub.message_bus.types import ProposedChangeBranchDiff
1414
from infrahub.server import app, app_initialization
1515
from infrahub.services import InfrahubServices, services
16+
from infrahub.services.adapters.workflow.local import WorkflowLocalExecution
1617
from tests.adapters.log import FakeLogger
1718
from tests.adapters.message_bus import BusRecorder
1819
from tests.helpers.file_repo import FileRepo
@@ -97,7 +98,7 @@ async def prepare_proposed_change(
9798
config = Config(api_token=admin_token, requester=test_client.async_request)
9899
client = InfrahubClient(config=config)
99100

100-
service = InfrahubServices(message_bus=bus, client=client)
101+
service = InfrahubServices(message_bus=bus, client=client, workflow=WorkflowLocalExecution())
101102
services.prepare(service=service)
102103

103104
repo = await InfrahubRepository.new(id=obj.id, name=file_repo.name, location=file_repo.path, client=client)
@@ -154,7 +155,6 @@ async def test_run_pipeline_validate_requested_jobs(
154155
]
155156

156157
assert sorted(bus_post_data_changes.seen_routing_keys) == [
157-
"request.proposed_change.data_integrity",
158158
"request.proposed_change.run_generators",
159159
"request.proposed_change.run_tests",
160160
"request.proposed_change.schema_integrity",

docs/docs/reference/message-bus-events.mdx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -536,24 +536,6 @@ For more detailed explanations on how to use these events within Infrahub, see t
536536
### Request Proposed Change
537537
<!-- vale on -->
538538

539-
<!-- vale off -->
540-
#### Event request.proposed_change.data_integrity
541-
<!-- vale on -->
542-
543-
**Description**: Sent trigger data integrity checks for a proposed change
544-
545-
**Priority**: 3
546-
547-
<!-- vale off -->
548-
| Key | Description | Type | Default Value |
549-
|-----|-------------|------|---------------|
550-
| **meta** | Meta properties for the message | N/A | None |
551-
| **proposed_change** | The unique ID of the Proposed Change | string | None |
552-
| **source_branch** | The source branch of the proposed change | string | None |
553-
| **source_branch_sync_with_git** | Indicates if the source branch should sync with git | boolean | None |
554-
| **destination_branch** | The destination branch of the proposed change | string | None |
555-
| **branch_diff** | The calculated diff between the two branches | N/A | None |
556-
<!-- vale on -->
557539
<!-- vale off -->
558540
#### Event request.proposed_change.pipeline
559541
<!-- vale on -->
@@ -1298,25 +1280,6 @@ For more detailed explanations on how to use these events within Infrahub, see t
12981280
### Request Proposed Change
12991281
<!-- vale on -->
13001282

1301-
<!-- vale off -->
1302-
#### Event request.proposed_change.data_integrity
1303-
<!-- vale on -->
1304-
1305-
**Description**: Sent trigger data integrity checks for a proposed change
1306-
1307-
**Priority**: 3
1308-
1309-
1310-
<!-- vale off -->
1311-
| Key | Description | Type | Default Value |
1312-
|-----|-------------|------|---------------|
1313-
| **meta** | Meta properties for the message | N/A | None |
1314-
| **proposed_change** | The unique ID of the Proposed Change | string | None |
1315-
| **source_branch** | The source branch of the proposed change | string | None |
1316-
| **source_branch_sync_with_git** | Indicates if the source branch should sync with git | boolean | None |
1317-
| **destination_branch** | The destination branch of the proposed change | string | None |
1318-
| **branch_diff** | The calculated diff between the two branches | N/A | None |
1319-
<!-- vale on -->
13201283
<!-- vale off -->
13211284
#### Event request.proposed_change.pipeline
13221285
<!-- vale on -->

0 commit comments

Comments
 (0)