GoogleCloudPlatform/buildpacks

Cannot build dotnet sample project

JanakaSandaruwan opened this issue · 4 comments

Describe the bug
I ran following command on sample-dotnet project
pack build dotnet-app-1 --builder gcr.io/buildpacks/builder:v1

But the build fails with

===> ANALYZING
Timer: Analyzer started at 2023-12-21T11:16:11Z
Image with name "dotnet-app-1" not found
Timer: Analyzer ran for 1.572875ms and ended at 2023-12-21T11:16:11Z
===> DETECTING
Timer: Detector started at 2023-12-21T11:16:11Z
4 of 6 buildpacks participating
google.dotnet.sdk        0.9.1
google.dotnet.publish    0.9.0
google.dotnet.runtime    0.9.1
google.utils.label-image 0.0.2
Timer: Detector ran for 364.296292ms and ended at 2023-12-21T11:16:11Z
===> RESTORING
Timer: Restorer started at 2023-12-21T11:16:11Z
Timer: Restorer ran for 1.815208ms and ended at 2023-12-21T11:16:11Z
===> BUILDING
Timer: Builder started at 2023-12-21T11:16:11Z
=== .NET - Sdk (google.dotnet.sdk@0.9.1) ===
Looking for global.json in /workspace
Using latest stable .NET Core SDK version
2023/12/21 11:16:11 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/dotnetsdk/version.json
***** CACHE MISS: "dotnetsdk"
Installing .NET SDK v8.0.100.
2023/12/21 11:16:12 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/dotnetsdk/dotnetsdk-8.0.100.tar.gz
=== .NET - Publish (google.dotnet.publish@0.9.0) ===
Installing application dependencies.
***** CACHE MISS: "packages"
***** CACHE MISS: "prod dependencies"
--------------------------------------------------------------------------------
Running "dotnet restore --packages /layers/google.dotnet.publish/packages ./helloworld.csproj (DOTNET_CLI_TELEMETRY_OPTOUT=true)"

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.100

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Done "dotnet restore --packages /layers/google.dotnet.publish/pack..." (6.59926817s)
--------------------------------------------------------------------------------
failed to build: (error ID: ce40b84e):
Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.100

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
 -> https://cloud.google.com/docs/buildpacks/overview
If you think you've found an issue, please report it:
 -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
Timer: Builder ran for 42.311480812s and ended at 2023-12-21T11:16:54Z
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

Additional context
How are you using GCP buildpacks?

  • pack and the gcr.io/buildpacks/builder
  • Cloud Functions
  • Cloud Run
  • Cloud Build
  • App Engine Standard
  • App Engine Flex

Can you try using builder:latest instead of builder:v1?

Can you try using builder:latest instead of builder:v1?

Yes. It too failing with following log

janakas@janakas sample-dotnet % pack build --builder=gcr.io/buildpacks/builder sample-dotnet
latest: Pulling from buildpacks/builder
Digest: sha256:4e78049d846f0c959fefd3f019a9147b5f91e04291814bbec35ef0b6c01b179e
Status: Image is up to date for gcr.io/buildpacks/builder:latest
latest: Pulling from buildpacks/google-22/run
Digest: sha256:347f3f712a6ce95ad50388a6ffedb356c2d37ba6f7757ff8bbd91b527c2a6f50
Status: Image is up to date for gcr.io/buildpacks/google-22/run:latest
0.17.2: Pulling from buildpacksio/lifecycle
Digest: sha256:3973d2f80d1d63db99bd9c7f8618f4d673527818ce798710a95d7bd2c74f47e8
Status: Image is up to date for buildpacksio/lifecycle:0.17.2
===> ANALYZING
[analyzer] Timer: Analyzer started at 2023-12-22T06:11:44Z
[analyzer] Image with name "sample-dotnet" not found
[analyzer] Timer: Analyzer ran for 866.209µs and ended at 2023-12-22T06:11:44Z
===> DETECTING
[detector] Timer: Detector started at 2023-12-22T06:11:45Z
[detector] 4 of 6 buildpacks participating
[detector] google.dotnet.sdk        0.9.1
[detector] google.dotnet.publish    0.9.0
[detector] google.dotnet.runtime    0.9.1
[detector] google.utils.label-image 0.0.2
[detector] Timer: Detector ran for 401.646417ms and ended at 2023-12-22T06:11:45Z
===> RESTORING
[restorer] Timer: Restorer started at 2023-12-22T06:11:46Z
[restorer] Timer: Restorer ran for 2.539208ms and ended at 2023-12-22T06:11:46Z
===> BUILDING
[builder] Timer: Builder started at 2023-12-22T06:11:47Z
[builder] === .NET - Sdk (google.dotnet.sdk@0.9.1) ===
[builder] Looking for global.json in /workspace
[builder] Using latest stable .NET Core SDK version
[builder] 2023/12/22 06:11:47 [DEBUG] GET https://dl.google.com/runtimes/ubuntu2204/dotnetsdk/version.json
[builder] ***** CACHE MISS: "dotnetsdk"
[builder] Installing .NET SDK v8.0.100.
[builder] 2023/12/22 06:11:47 [DEBUG] GET https://dl.google.com/runtimes/ubuntu2204/dotnetsdk/dotnetsdk-8.0.100.tar.gz
[builder] === .NET - Publish (google.dotnet.publish@0.9.0) ===
[builder] Installing application dependencies.
[builder] ***** CACHE MISS: "packages"
[builder] ***** CACHE MISS: "prod dependencies"
[builder] --------------------------------------------------------------------------------
[builder] Running "dotnet restore --packages /layers/google.dotnet.publish/packages ./helloworld.csproj (DOTNET_CLI_TELEMETRY_OPTOUT=true)"
[builder] 
[builder] Welcome to .NET 8.0!
[builder] ---------------------
[builder] SDK Version: 8.0.100
[builder] 
[builder] 
[builder] ----------------
[builder] Installed an ASP.NET Core HTTPS development certificate.
[builder] To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux
[builder] 
[builder] ----------------
[builder] Write your first app: https://aka.ms/dotnet-hello-world
[builder] Find out what's new: https://aka.ms/dotnet-whats-new
[builder] Explore documentation: https://aka.ms/dotnet-docs
[builder] Report issues and find source on GitHub: https://github.com/dotnet/core
[builder] Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
[builder] --------------------------------------------------------------------------------------
[builder]   Determining projects to restore...
[builder] /layers/google.dotnet.sdk/sdk/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future. Please
[builder]  refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/workspace/helloworld.csproj]
[builder] /layers/google.dotnet.sdk/sdk/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/workspace/helloworld.csproj]
[builder]   Restored /workspace/helloworld.csproj (in 9.78 sec).
[builder] Done "dotnet restore --packages /layers/google.dotnet.publish/pack..." (22.711982927s)
[builder] --------------------------------------------------------------------------------
[builder] Running "dotnet publish -nologo --verbosity minimal --configuration Release --output /layers/google.dotnet.publish/publish/bin --no-restore --packages /layers/google.dotnet.publish/packages ./helloworld.csproj (DOTNET_CLI_TELEMETRY_OPTOUT=true)"
[builder] /layers/google.dotnet.sdk/sdk/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future. Please
[builder]  refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/workspace/helloworld.csproj]
[builder] Done "dotnet publish -nologo --verbosity minimal --configuration R..." (12.628060798s)
[builder] --------------------------------------------------------------------------------
[builder] failed to build: (error ID: 22e13d5d):
[builder] /layers/google.dotnet.sdk/sdk/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(32,5): warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [/workspace/helloworld.csproj]
[builder] --------------------------------------------------------------------------------
[builder] Sorry your project couldn't be built.
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder]  -> https://cloud.google.com/docs/buildpacks/overview
[builder] If you think you've found an issue, please report it:
[builder]  -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] --------------------------------------------------------------------------------
[builder] Timer: Builder ran for 1m10.376186867s and ended at 2023-12-22T06:12:57Z
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51

Hi, I see the error message saying -

The target framework 'netcoreapp3.1' is out of support and will not receive security updates

Can you check the configuration for target framework in the code.
https://github.com/GoogleCloudPlatform/buildpack-samples/blob/master/sample-dotnet/helloworld.csproj

And update to net8.0

Thank you.

Was able to build this project fine using local. However we should bump the version number on this project. Closing issue