fix(agent): retain correlated runtime stage receipts
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m20s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m20s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -5687,6 +5687,16 @@ _RUNTIME_OPERATION_COUNTS_DIRECT_SQL = """
|
||||
|
||||
|
||||
_RUNTIME_OPERATION_LATEST_SQL = """
|
||||
WITH latest_apply_chain AS (
|
||||
SELECT
|
||||
op_id::text AS apply_op_id,
|
||||
parent_op_id::text AS check_mode_op_id,
|
||||
input ->> 'source_candidate_op_id' AS candidate_op_id
|
||||
FROM automation_operation_log
|
||||
WHERE operation_type = 'ansible_apply_executed'
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1
|
||||
)
|
||||
SELECT
|
||||
op_id::text AS op_id,
|
||||
parent_op_id::text AS parent_op_id,
|
||||
@@ -5714,7 +5724,7 @@ _RUNTIME_OPERATION_LATEST_SQL = """
|
||||
coalesce(output ->> 'returncode', dry_run_result ->> 'returncode') AS returncode,
|
||||
duration_ms,
|
||||
created_at
|
||||
FROM automation_operation_log
|
||||
FROM automation_operation_log operation_row
|
||||
WHERE (
|
||||
operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
@@ -5732,12 +5742,19 @@ _RUNTIME_OPERATION_LATEST_SQL = """
|
||||
)
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1
|
||||
FROM latest_apply_chain
|
||||
WHERE operation_row.op_id::text = latest_apply_chain.apply_op_id
|
||||
OR operation_row.op_id::text = latest_apply_chain.check_mode_op_id
|
||||
OR operation_row.op_id::text = latest_apply_chain.candidate_op_id
|
||||
) THEN 0
|
||||
WHEN operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed'
|
||||
) THEN 0
|
||||
ELSE 1
|
||||
) THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
created_at DESC
|
||||
LIMIT :limit
|
||||
@@ -5745,6 +5762,16 @@ _RUNTIME_OPERATION_LATEST_SQL = """
|
||||
|
||||
|
||||
_RUNTIME_OPERATION_LATEST_DIRECT_SQL = """
|
||||
WITH latest_apply_chain AS (
|
||||
SELECT
|
||||
op_id::text AS apply_op_id,
|
||||
parent_op_id::text AS check_mode_op_id,
|
||||
input ->> 'source_candidate_op_id' AS candidate_op_id
|
||||
FROM automation_operation_log
|
||||
WHERE operation_type = 'ansible_apply_executed'
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1
|
||||
)
|
||||
SELECT
|
||||
op_id::text AS op_id,
|
||||
parent_op_id::text AS parent_op_id,
|
||||
@@ -5772,7 +5799,7 @@ _RUNTIME_OPERATION_LATEST_DIRECT_SQL = """
|
||||
coalesce(output ->> 'returncode', dry_run_result ->> 'returncode') AS returncode,
|
||||
duration_ms,
|
||||
created_at
|
||||
FROM automation_operation_log
|
||||
FROM automation_operation_log operation_row
|
||||
WHERE (
|
||||
operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
@@ -5790,12 +5817,19 @@ _RUNTIME_OPERATION_LATEST_DIRECT_SQL = """
|
||||
)
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1
|
||||
FROM latest_apply_chain
|
||||
WHERE operation_row.op_id::text = latest_apply_chain.apply_op_id
|
||||
OR operation_row.op_id::text = latest_apply_chain.check_mode_op_id
|
||||
OR operation_row.op_id::text = latest_apply_chain.candidate_op_id
|
||||
) THEN 0
|
||||
WHEN operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed'
|
||||
) THEN 0
|
||||
ELSE 1
|
||||
) THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
created_at DESC
|
||||
LIMIT $1
|
||||
|
||||
Reference in New Issue
Block a user