Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
110 stars 172 forks source link

[SDK Automation] The check `SDK $(sdkName)` is stuck `in progress` when AutoRest config (README.md) does not define any language SDKs #7235

Open konrad-jamrozik opened 10 months ago

konrad-jamrozik commented 10 months ago

PR where this issue was first observed

Symptoms

Check is stuck

The following check is stuck on the PR in progress:

image

ADO pipeline task SDK / SDK Automation logs fatal error with $(sdkName)

An example:

06:41:54.455 error  Fatal error: Error: SDK $(sdkName) is not define in SpecConfig
    at Object.exports.getSdkRepoConfig (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/types/SpecConfig.js:41:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async workflowInitConfig (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:234:27)
    at async Object.exports.workflowInit (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/workflow.js:70:29)
    at async Object.exports.sdkAutoMain (/mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/automation/entrypoint.js:210:31)
    at async /mnt/vss/_work/1/a/unified-pipeline-runtime/private/openapi-sdk-automation/lib/cli/cli.js:20:18

ADO pipeline task Filter SDK / SDK Automation reports no language SDKs to generate

In ADO pipeline, Filter SDK / SDK Automation task does not list any language repositories.

An example:

06:40:29.047 section    Filter SDK to generate
06:40:29.056 info   SDK to generate:
06:40:29.056 warn       azure-resource-manager-schemas not found in specificationRepositoryConfiguration.json. Skipped.
06:40:29.056 warn       azure-cli-extensions not found in specificationRepositoryConfiguration.json. Skipped.
06:40:29.057 endsection     Filter SDK to generate

Contrast it with an example working case from PR 26555:

04:49:57.830 section    Filter SDK to generate
04:49:57.840 info   SDK to generate:
04:49:57.840 info       azure-sdk-for-python-track2
04:49:57.840 info       azure-sdk-for-java
04:49:57.840 info       azure-sdk-for-go
04:49:57.840 info       azure-sdk-for-js
04:49:57.841 info       azure-resource-manager-schemas
04:49:57.841 warn       azure-cli-extensions not found in specificationRepositoryConfiguration.json. Skipped.
04:49:57.841 info       azure-powershell
04:49:57.842 endsection     Filter SDK to generate

Root-cause

The affected PR did not define in the AutoRest config (README.md) any language repository. The SDK Automation tooling doesn't gracefully handle this scenario, resulting in the fatal error with $(sdkName) as mentioned above.

You can observe in the PR the following snippet in the README:

yaml $(swagger-to-sdk)
swagger-to-sdk:
  - repo: azure-resource-manager-schemas
  - repo: azure-cli-extensions

If this config would include a line with azure-sdk-for-* for one of the supported languages, it would prevent the issue. An example of valid config can be found here, e.g. - repo: azure-sdk-for-js.

Relevant source code

@raych1 FYI

raych1 commented 10 months ago

I agree this is a bug around error handling, but this is an edge case. Swagger-to-sdk config in readme is required config to generate SDK.

I will put this bug in my backlog.

konrad-jamrozik commented 10 months ago

I observed that this bug is not triggered if there are no SDKs to generate and there is no AutoRest README diff in the PR. E.g. this PR:

doesn't trigger it.

JackTn commented 3 weeks ago

new issues example: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4075365&view=logs&j=5b9ddb1d-0a4c-5b60-5f43-d992eb6e5840&t=5aaf2286-0a7d-520b-4a04-1c6b6d38f79b