From 4a49c879554257a3fe66e4f32668acf3c7f1616a Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Wed, 1 Jul 2026 09:39:08 +0800 Subject: [PATCH] fix(ci): correct checkout paths and inventory resolution for data_migration --- .github/workflows/deploy-env-migration.yaml | 17 +++++++++++------ scripts/run_toolkit.py | 4 +++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-env-migration.yaml b/.github/workflows/deploy-env-migration.yaml index f518f55..7ad00c7 100644 --- a/.github/workflows/deploy-env-migration.yaml +++ b/.github/workflows/deploy-env-migration.yaml @@ -259,12 +259,17 @@ jobs: name: site-migration-toolkit-cmdb path: cmdb + - name: Checkout site-migration-toolkit + uses: actions/checkout@v7 + with: + path: site-migration-toolkit + - name: Checkout playbooks uses: actions/checkout@v7 with: repository: ai-workspace-infra/playbooks ref: ${{ github.event.inputs.infra_ref }} - path: infra/playbooks + path: playbooks - name: Install Ansible run: pip install --quiet ansible @@ -303,9 +308,9 @@ jobs: echo "${TARGET_IP} ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_deploy" >> inventory_migration.ini - name: Run Toolkit Action (${{ github.event.inputs.toolkit_action }}) - working-directory: . + working-directory: site-migration-toolkit run: | - make ${{ github.event.inputs.toolkit_action }} RUN_ARGS="-e target_domain=${{ github.event.inputs.target_domain_base }} -e migration_flow.source.domain_base=${{ github.event.inputs.source_domain_base }}" + make ${{ github.event.inputs.toolkit_action }} RUN_ARGS="-i $GITHUB_WORKSPACE/inventory_migration.ini -e target_domain=${{ github.event.inputs.target_domain_base }} -e migration_flow.source.domain_base=${{ github.event.inputs.source_domain_base }}" switch_dns: name: Switch DNS Traffic (Manual Approval) @@ -325,7 +330,7 @@ jobs: with: repository: ai-workspace-infra/playbooks ref: ${{ github.event.inputs.infra_ref }} - path: infra/playbooks + path: playbooks - name: Install Ansible run: pip install --quiet ansible @@ -346,5 +351,5 @@ jobs: env: CLOUDFLARE_DNS_API_TOKEN: ${{ steps.vault.outputs.CLOUDFLARE_DNS_API_TOKEN }} run: | - cd infra/playbooks - ansible-playbook -i ../../cmdb/inventory update_site_dns.yml -e "target_domain=${{ github.event.inputs.target_domain_base }}" -e "source_domain=${{ github.event.inputs.source_domain_base }}" + cd playbooks + ansible-playbook -i ../cmdb/inventory.ini update_site_dns.yml -e "target_domain=${{ github.event.inputs.target_domain_base }}" -e "source_domain=${{ github.event.inputs.source_domain_base }}" diff --git a/scripts/run_toolkit.py b/scripts/run_toolkit.py index fb8daca..400ce66 100755 --- a/scripts/run_toolkit.py +++ b/scripts/run_toolkit.py @@ -54,7 +54,9 @@ def main(): print("=" * 60) cmd = ["ansible-playbook"] - if inventory_path: + if "-i" in unknown_args: + print("[INFO] Explicit -i flag detected. Skipping auto-inventory resolution.") + elif inventory_path: cmd.extend(["-i", str(inventory_path)]) else: print("[WARNING] No valid cmdb/inventory file found. Proceeding without explicit -i flag.")