From d49c6bfe2d4ca453f4cb0e7f8f5abbbb7e26f7f2 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Mon, 27 Jul 2026 08:27:29 -0700 Subject: [PATCH] Fail loud when deploy --app matches nothing (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Fail when `--app` / `--env` match no `host_apps` row (was silent no-op) - Fail when `--app` missing from `app_catalog` Prevents "deploy succeeded" that only refreshed web-static nginx while skipping Django — what happened on [chat_backend run 205](https://git.aimloperations.com/ai_ml_operations/chat_backend/actions/runs/205) before `chat_backend` was registered on master. ## Test plan - [ ] `./scripts/deploy.sh --app does_not_exist --env prod` should fail with catalog message - [ ] `./scripts/deploy.sh --app chat_backend --env prod` should proceed with Django once catalog/host_apps presentReviewed-on: https://git.aimloperations.com/ai_ml_operations/server-infra/pulls/6 --- roles/app-deploy/tasks/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/roles/app-deploy/tasks/main.yml b/roles/app-deploy/tasks/main.yml index e8a87b3..761547e 100644 --- a/roles/app-deploy/tasks/main.yml +++ b/roles/app-deploy/tasks/main.yml @@ -24,6 +24,29 @@ ansible.builtin.debug: msg: "ref={{ app_ref | default('(per-app default branch)') }} targets={{ deploy_targets | map(attribute='name') | zip(deploy_targets | map(attribute='env')) | list }}" +# Explicit --app/--env with no host_apps match used to silently no-op Django +# and still refresh web-static (looked like a "static-only" deploy). Fail loud. +- name: Fail when requested app+env is not on this host + ansible.builtin.fail: + msg: >- + No host_apps entry for app={{ app }} env={{ app_env }} on + {{ inventory_hostname }}. Check inventory/host_vars and app_catalog + (django apps need type: django + compose_file). Catalog keys: + {{ app_catalog.keys() | list }}. + when: + - app is defined + - app_env is defined + - deploy_targets | length == 0 + +- name: Fail when requested app missing from app_catalog + ansible.builtin.fail: + msg: >- + app={{ app }} is not in app_catalog. Add it with type: django (docker) + or type: node-static. Known: {{ app_catalog.keys() | list }}. + when: + - app is defined + - app not in app_catalog + - name: Deploy Django (docker compose) apps ansible.builtin.include_tasks: django.yml loop: "{{ deploy_targets | selectattr('name', 'in', django_names) | list }}"