fix(ci): correct checkout paths and inventory resolution for data_migration
This commit is contained in:
parent
00724226e9
commit
4a49c87955
17
.github/workflows/deploy-env-migration.yaml
vendored
17
.github/workflows/deploy-env-migration.yaml
vendored
@ -259,12 +259,17 @@ jobs:
|
|||||||
name: site-migration-toolkit-cmdb
|
name: site-migration-toolkit-cmdb
|
||||||
path: cmdb
|
path: cmdb
|
||||||
|
|
||||||
|
- name: Checkout site-migration-toolkit
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
path: site-migration-toolkit
|
||||||
|
|
||||||
- name: Checkout playbooks
|
- name: Checkout playbooks
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: ai-workspace-infra/playbooks
|
repository: ai-workspace-infra/playbooks
|
||||||
ref: ${{ github.event.inputs.infra_ref }}
|
ref: ${{ github.event.inputs.infra_ref }}
|
||||||
path: infra/playbooks
|
path: playbooks
|
||||||
|
|
||||||
- name: Install Ansible
|
- name: Install Ansible
|
||||||
run: pip install --quiet 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
|
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 }})
|
- name: Run Toolkit Action (${{ github.event.inputs.toolkit_action }})
|
||||||
working-directory: .
|
working-directory: site-migration-toolkit
|
||||||
run: |
|
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:
|
switch_dns:
|
||||||
name: Switch DNS Traffic (Manual Approval)
|
name: Switch DNS Traffic (Manual Approval)
|
||||||
@ -325,7 +330,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repository: ai-workspace-infra/playbooks
|
repository: ai-workspace-infra/playbooks
|
||||||
ref: ${{ github.event.inputs.infra_ref }}
|
ref: ${{ github.event.inputs.infra_ref }}
|
||||||
path: infra/playbooks
|
path: playbooks
|
||||||
|
|
||||||
- name: Install Ansible
|
- name: Install Ansible
|
||||||
run: pip install --quiet ansible
|
run: pip install --quiet ansible
|
||||||
@ -346,5 +351,5 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CLOUDFLARE_DNS_API_TOKEN: ${{ steps.vault.outputs.CLOUDFLARE_DNS_API_TOKEN }}
|
CLOUDFLARE_DNS_API_TOKEN: ${{ steps.vault.outputs.CLOUDFLARE_DNS_API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd infra/playbooks
|
cd 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 }}"
|
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 }}"
|
||||||
|
|||||||
@ -54,7 +54,9 @@ def main():
|
|||||||
print("=" * 60)
|
print("=" * 60)
|
||||||
|
|
||||||
cmd = ["ansible-playbook"]
|
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)])
|
cmd.extend(["-i", str(inventory_path)])
|
||||||
else:
|
else:
|
||||||
print("[WARNING] No valid cmdb/inventory file found. Proceeding without explicit -i flag.")
|
print("[WARNING] No valid cmdb/inventory file found. Proceeding without explicit -i flag.")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user