|
3 | 3 | hosts: localhost |
4 | 4 | connection: local |
5 | 5 | vars: |
6 | | - frontend_src: "{{ frontend_src_dir | default('src/movie-analyst-ui') }}" |
| 6 | + app_service_name: "" |
| 7 | + resource_group_name: "" |
| 8 | + lb_api_url: "" |
7 | 9 | node_version: "16-lts" |
8 | | - |
| 10 | + |
9 | 11 | tasks: |
10 | | - # --- Debug variables first --- |
11 | | - - name: Verify Azure resource variables |
12 | | - debug: |
| 12 | + - name: Validate variables |
| 13 | + fail: |
13 | 14 | msg: | |
14 | | - RESOURCE_GROUP: {{ resource_group_name }} |
15 | | - APP_NAME: {{ app_service_name }} |
16 | | - BACKEND_URL: {{ lb_api_url }} |
17 | | -
|
18 | | - # --- Build steps --- |
19 | | - - name: Install dependencies |
20 | | - command: npm install |
21 | | - args: |
22 | | - chdir: "{{ frontend_src }}" |
23 | | - |
24 | | - - name: Zip frontend application |
25 | | - archive: |
26 | | - path: "{{ frontend_src }}/" |
27 | | - dest: "./frontend-deploy.zip" |
28 | | - format: zip |
29 | | - exclude_path: |
30 | | - - "node_modules/.cache/" |
31 | | - - "test/" |
32 | | - - ".git/" |
33 | | - |
34 | | - # --- Azure Deployment with API Version Fix --- |
35 | | - - name: Get latest supported API version |
36 | | - command: > |
37 | | - az provider show --namespace Microsoft.Web |
38 | | - --query "resourceTypes[?resourceType=='sites'].apiVersions[0]" |
39 | | - --output tsv |
40 | | - register: api_version_check |
41 | | - changed_when: false |
42 | | - ignore_errors: yes |
| 15 | + Invalid variables detected! |
| 16 | + - App Service: {{ app_service_name }} |
| 17 | + - Resource Group: {{ resource_group_name }} |
| 18 | + - API URL: {{ lb_api_url }} |
| 19 | + Check GitHub Actions workflow for proper output handling. |
| 20 | + when: > |
| 21 | + not app_service_name or |
| 22 | + not resource_group_name or |
| 23 | + not lb_api_url or |
| 24 | + '[' in app_service_name or |
| 25 | + '[' in resource_group_name or |
| 26 | + '[' in lb_api_url |
43 | 27 |
|
44 | | - - name: Set actual API version |
45 | | - set_fact: |
46 | | - azure_api_version: >- |
47 | | - {% if api_version_check is succeeded %} |
48 | | - {{ api_version_check.stdout }} |
49 | | - {% else %} |
50 | | - 2024-11-01 # Fallback version |
51 | | - {% endif %} |
| 28 | + - name: Show deployment configuration |
| 29 | + debug: |
| 30 | + msg: | |
| 31 | + Deployment Configuration: |
| 32 | + - App Service: {{ app_service_name }} |
| 33 | + - Resource Group: {{ resource_group_name }} |
| 34 | + - API URL: {{ lb_api_url }} |
| 35 | + - Node Version: {{ node_version }} |
52 | 36 |
|
53 | 37 | - name: Update Node.js runtime |
54 | 38 | command: > |
|
58 | 42 | --linux-fx-version "NODE|{{ node_version }}" |
59 | 43 | --output none |
60 | 44 | environment: |
61 | | - AZURE_CLI_DEFAULT_API_VERSION: "{{ azure_api_version }}" |
| 45 | + AZURE_CLI_DEFAULT_API_VERSION: "2025-04-01" |
62 | 46 |
|
63 | 47 | - name: Set app settings |
64 | 48 | command: > |
|
0 commit comments