dotnet / aspire-samples

MIT License
738 stars 216 forks source link

Fail to run `azd init` and `azd up` for sample `AspireWithPython` #530

Closed Menghua1 closed 2 weeks ago

Menghua1 commented 3 weeks ago

Describe the issue: Running azd init fails with the following error: Image According to the error message, add

<PropertyGroup>
    <WarningsAsErrors></WarningsAsErrors>
    <NoWarn>ASPIREHOSTINGPYTHON001</NoWarn>
</PropertyGroup>

to samples\AspireWithPython\AspireWithPython.AppHost\AspireWithPython.AppHost.csproj, and then run azd up, and the following error is encountered: Image Image

Repro Steps:

  1. Clone code.
  2. In “.csproj” files, replace all version 9.0.0-rc.1.24511.1 with 9.0.0, and change all Aspire.Npgsql.EntityFrameworkCore.PostgreSQL versions to 9.0.0-preview.5.24526.2.
  3. Run the following four commands under project aspire-samples.
    dotnet nuget add source [https://pkgs.dev.azure.com/dnceng/internal/_packaging/9.0.100-rtm.24523.42-shipping/nuget/v3/index.json](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpkgs.dev.azure.com%2Fdnceng%2Finternal%2F_packaging%2F9.0.100-rtm.24523.42-shipping%2Fnuget%2Fv3%2Findex.json&data=05%7C02%7Cv-menghchen%40microsoft.com%7C4d3f29cf5dff4026dbaf08dcf9578d54%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638659401659716664%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=3YbmCGhKiDa0I5OuUHCP45Av7TA%2FpIoTYUKKn%2F612kw%3D&reserved=0) -n dotnet9-int
    dotnet nuget add source [https://pkgs.dev.azure.com/dnceng/internal/_packaging/8.0.404-servicing.24523.8-shipping/nuget/v3/index.json](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpkgs.dev.azure.com%2Fdnceng%2Finternal%2F_packaging%2F8.0.404-servicing.24523.8-shipping%2Fnuget%2Fv3%2Findex.json&data=05%7C02%7Cv-menghchen%40microsoft.com%7C4d3f29cf5dff4026dbaf08dcf9578d54%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638659401659732127%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=AkI5M7a4mqcpq3zTBbB5Xal3okt1vh605QKDyWKVpsY%3D&reserved=0) -n dotnet8-int
    dotnet nuget add source [https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-aspire-1812ef69/nuget/v3/index.json](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpkgs.dev.azure.com%2Fdnceng%2Finternal%2F_packaging%2Fdarc-int-dotnet-aspire-1812ef69%2Fnuget%2Fv3%2Findex.json&data=05%7C02%7Cv-menghchen%40microsoft.com%7C4d3f29cf5dff4026dbaf08dcf9578d54%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638659401659747679%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=anXEvfC%2FylqTmmMRWVSABhtrAOVlocpmmr526PxlWpM%3D&reserved=0) -n dotnet-aspire
    dotnet nuget add source [https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-extensions-c78c7b16/nuget/v3/index.json](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpkgs.dev.azure.com%2Fdnceng%2Finternal%2F_packaging%2Fdarc-int-dotnet-extensions-c78c7b16%2Fnuget%2Fv3%2Findex.json&data=05%7C02%7Cv-menghchen%40microsoft.com%7C4d3f29cf5dff4026dbaf08dcf9578d54%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638659401659763154%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=0jBl8iAKaoaJ40x2b5Tay36orPhyHegR%2BmeNWXPZCJc%3D&reserved=0) -n dotnet-extensions
  4. Run command cd samples/AspireWithPython.
  5. Run command azd init and azd up.

Environment:

Expected behavior: The command azd init and azd up can be run successfully.

@rajeshkamal5050, @vhvb1989 for notification.

DamianEdwards commented 2 weeks ago

Reproduced even on main without any updates to 9.0 GA packages.

@mitchdenny I think this is because AddPythonApp automatically implies PublishAsDockerFile() without any verification that there is indeed a Dockerfile, so you get all the way through to azd trying to build it and it fails because there's no Dockerfile. Does that sound right?