diff --git a/.github/workflows/test-workflow-latest.yml b/.github/workflows/test-workflow-latest.yml index cf8dc96..b9f0e67 100644 --- a/.github/workflows/test-workflow-latest.yml +++ b/.github/workflows/test-workflow-latest.yml @@ -71,4 +71,4 @@ jobs: REPOSITORY_NAME: Azure-Samples/azd-ai-starter - name: print result - run: cat ${{ steps.validation3.outputs.resultFile }} + run: cat ${{ steps.validation3.outputs.resultFile }} \ No newline at end of file diff --git a/CommonFailure.md b/CommonFailure.md new file mode 100644 index 0000000..b38a5e9 --- /dev/null +++ b/CommonFailure.md @@ -0,0 +1,34 @@ +# Common Failure + +## File Missing +The file missing error is fairly straightforward. For reference, please see our [Definition of Done](https://github.com/Azure-Samples/azd-template-artifacts/blob/main/docs/development-guidelines/definition-of-done.md) for the required files and structure. + +## Azd UP Failure: + +Before adding the validation action in your local repo, please ensure you’ve run: +``` +azd pipeline config +``` + +### Error BCP332: The provided value (whose length will always be greater than or equal to 15) is too long to assign to a target for which the maximum allowable length is 10 + +- **Root Cause**: The `maxLength` property defined for a parameter in `main.bicep` is too small for the actual value. + +- **Solution**: Increase the `maxLength` value to accommodate longer inputs. + +### Principal XXX does not exist in the directory XXX. Check that you have the correct principal ID. If you are creating this principal and then immediately assigning a role, this error might be related to a replication delay. In this case, set the role assignment principalType property to a value, such as ServicePrincipal, User, or Group. See https://aka.ms/docs-principaltype + +- **Root Cause**: The RBAC assignment in `main.bicep` is missing the required `principalType` property. This can result in a replication delay or incorrect assignment. + +- **Solution**: Add the `principalType` field, e.g. 'ServicePrincipal', 'User', or 'Group'. + +- **Note**: Type 'User' cannot be used in GitHub workflows. +To support both local and CI/CD scenarios, consider adding a parameter to control the RBAC assignment logic. e.g.: Use [CREATE_ROLE_FOR_USER](https://github.com/Azure-Samples/azd-ai-starter/blob/c0c418b0e22ef0a5565e6b03073171f4a72dbb81/infra/main.bicep#L46) + +### ERROR: error executing step command 'deploy --all': failed deploying service 'indexer': archive/tar: write too long + +- **Root Cause**: This is a known issue affecting both the Azure Developer CLI (azd) and the devcontainers/ci GitHub action. + +- **Solution**: + - https://github.com/Azure/azure-dev/issues/4803 + - https://github.com/devcontainers/ci/issues/366 \ No newline at end of file diff --git a/action.yml b/action.yml index 53dfb1c..30980a8 100644 --- a/action.yml +++ b/action.yml @@ -171,7 +171,8 @@ runs: run: | if [ -f "${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep" ]; then # Check if targetScope is set to 'subscription' or 'resourceGroup'. The sample sentence in bicep is: targetScope = 'subscription' - targetScope=$(grep -oP "targetScope\s*=\s*['\"]\K[^'\"]+" ${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep) + targetScope=$(grep -oP "targetScope\s*=\s*['\"]\K[^'\"]+" "${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep" 2>/dev/null || echo "") + echo "targetScope: $targetScope" echo "targetScope=$targetScope" >> $GITHUB_ENV if [ "$targetScope" == "subscription" ]; then echo "targetScope is set to 'subscription' in main.bicep" @@ -179,10 +180,13 @@ runs: elif [ "$targetScope" == "resourceGroup" ]; then echo "targetScope is set to 'resourceGroup' in main.bicep" else - echo "targetScope is not set to 'subscription' or 'resourceGroup' in main.bicep" + echo "targetScope is not set to 'subscription' or 'resourceGroup' in main.bicep, set to 'resourceGroup' by default" + targetScope="resourceGroup" + echo "targetScope=$targetScope" >> $GITHUB_ENV fi fi shell: bash + continue-on-error: true - name: Set azure resource group name in env id: set_resource_group @@ -402,6 +406,14 @@ runs: CREATE_ROLE_FOR_USER: false AZURE_PRINCIPAL_TYPE: "ServicePrincipal" + - name: Azure CLI script + id: delete_resource_group + if : ${{ inputs.validateAzd == 'true' && env.targetScope == 'resourceGroup' }} + run: | + az group delete --resource-group ${{ env.AZURE_RESOURCE_GROUP }} -y || echo "Warning: Failed to delete resource group ${AZURE_RESOURCE_GROUP}, continuing..." + shell: bash + continue-on-error: true + - id: set_output run: | if [[ ${{ inputs.useDevContainer }} == 'true' ]]; then