Skip to content

Commit 42ccb8f

Browse files
committed
Make verify-workflows.sh idempotent by reusing already-deployed workflows
Fusion has no delete API, so once verify deploys a workflow it stays in the CID and a second run fails re-importing the same name — which made verify effectively single-use. The duplicate check already returns the existing definition's id; use it: when a workflow is already deployed, mark deploy PASS and reuse that id for the execute/browser phases instead of attempting a doomed re-import. Re-running verify now proves the deployed state rather than false-failing on the duplicate.
1 parent 698cd66 commit 42ccb8f

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

verify-workflows.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,29 @@ for wf_file in "${YAML_FILES[@]}"; do
252252
D_STATUS="SKIP"
253253
say " deploy: ${YELLOW}SKIP${RESET} (validate failed)"
254254
else
255-
# Informational duplicate check (recorded in notes, not its own column).
255+
# Duplicate check. Fusion has no delete API, so once a workflow is deployed
256+
# (e.g. by a previous verify run) it stays in the CID and re-importing the
257+
# same name fails. That is not a verify failure: the definition IS deployed.
258+
# If the check reports an existing_id, treat deploy as PASS and reuse that
259+
# id for the execute/browser phases instead of attempting a doomed import.
260+
EXISTING_ID=""
256261
if DUP_OUT="$("$PYTHON" "$QUERY_PY" --check-yaml "$wf_file" --json 2>/dev/null)"; then
257262
DUP_COUNT="$(printf '%s' "$DUP_OUT" | jq '.duplicates | length' 2>/dev/null || echo 0)"
258263
if [ "${DUP_COUNT:-0}" -gt 0 ]; then
259-
NOTES="${NOTES:+$NOTES; }duplicate name already deployed"
260-
say " (dup-check: ${YELLOW}already exists${RESET})"
264+
EXISTING_ID="$(printf '%s' "$DUP_OUT" | jq -r '.duplicates[0].existing_id // empty' 2>/dev/null)"
265+
say " (dup-check: ${YELLOW}already exists${RESET}${EXISTING_ID:+ — reusing ID $EXISTING_ID})"
261266
fi
262267
fi
263268

269+
if [ -n "$EXISTING_ID" ]; then
270+
# Already deployed on a prior run — reuse it, don't re-import.
271+
DEF_ID="$EXISTING_ID"
272+
D_STATUS="PASS"
273+
NOTES="${NOTES:+$NOTES; }already deployed (reused existing ID)"
274+
say " deploy: ${GREEN}PASS${RESET} (already deployed, ID: $DEF_ID)"
264275
# Import. validate + duplicate checks are already separate concerns here,
265276
# so skip them inside the importer to keep each scorecard column distinct.
266-
if DEPLOY_OUT="$("$PYTHON" "$IMPORT_PY" --skip-validate --skip-duplicate-check "$wf_file" 2>&1)"; then
277+
elif DEPLOY_OUT="$("$PYTHON" "$IMPORT_PY" --skip-validate --skip-duplicate-check "$wf_file" 2>&1)"; then
267278
DEF_ID="$(printf '%s\n' "$DEPLOY_OUT" | grep -oE 'ID: [0-9a-f]{32}' | head -1 | sed 's/ID: //')"
268279
D_STATUS="PASS"
269280
say " deploy: ${GREEN}PASS${RESET} (ID: ${DEF_ID:-unknown})"

0 commit comments

Comments
 (0)