@@ -15,69 +15,19 @@ permissions:
1515jobs :
1616 template_validation_job :
1717 runs-on : ubuntu-latest
18- name : Template validation
18+ name : template validation
1919 steps :
20- # Step 1: Checkout the code from your repository
21- - name : Checkout code
22- uses : actions/checkout@v4
20+ - uses : actions/checkout@v4
2321
24- # Step 2: Set up Python
25- - name : Set up Python
26- uses : actions/setup-python@v4
27- with :
28- python-version : " 3.9"
29-
30- # Step 3: Create and populate the virtual environment
31- - name : Create virtual environment and install dependencies
32- run : |
33- python -m venv .venv
34- source .venv/bin/activate
35- python -m pip install --upgrade pip
36- pip install azure-mgmt-resource azure-identity azure-core azure-mgmt-subscription azure-cli-core
37- # Install any other dependencies that might be needed
38- pip freeze > requirements-installed.txt
39- echo "Virtual environment created with these packages:"
40- cat requirements-installed.txt
41-
42- # Step 4: Create azd directory if it doesn't exist
43- - name : Create azd directory
44- run : |
45- mkdir -p ./.azd || true
46- touch ./.azd/.env || true
47-
48- # Step 5: Validate the Azure template
49- - name : Validate Azure Template
50- 22+ - uses : microsoft/template-validation-action@Latest
5123 id : validation
5224 env :
53- AZURE_CLIENT_ID : ${{ secrets .AZURE_CLIENT_ID }}
54- AZURE_TENANT_ID : ${{ secrets .AZURE_TENANT_ID }}
55- AZURE_SUBSCRIPTION_ID : ${{ secrets .AZURE_SUBSCRIPTION_ID }}
56- AZURE_ENV_NAME : ${{ secrets .AZURE_ENV_NAME }}
57- AZURE_LOCATION : ${{ secrets .AZURE_LOCATION }}
25+ AZURE_CLIENT_ID : ${{ vars .AZURE_CLIENT_ID }}
26+ AZURE_TENANT_ID : ${{ vars .AZURE_TENANT_ID }}
27+ AZURE_SUBSCRIPTION_ID : ${{ vars .AZURE_SUBSCRIPTION_ID }}
28+ AZURE_ENV_NAME : ${{ vars .AZURE_ENV_NAME }}
29+ AZURE_LOCATION : ${{ vars .AZURE_LOCATION }}
5830 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5931
60- # Step 6: Debug output in case of failure
61- - name : Debug on failure
62- if : failure()
63- run : |
64- echo "Validation failed. Checking environment:"
65- ls -la
66- if [ -d ".venv" ]; then
67- echo ".venv directory exists"
68- ls -la .venv/bin/
69- else
70- echo ".venv directory does not exist"
71- fi
72- if [ -d "tva_*" ]; then
73- echo "TVA directory exists:"
74- find . -name "tva_*" -type d
75- ls -la $(find . -name "tva_*" -type d)
76- else
77- echo "No TVA directory found"
78- fi
79-
80- # Step 7: Print the result of the validation
81- - name : Print result
82- if : success()
32+ - name : print result
8333 run : cat ${{ steps.validation.outputs.resultFile }}
0 commit comments