Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global.json file should be considered as an SDK version source #137

Open
3 tasks done
sophiewigmore opened this issue Feb 2, 2021 · 2 comments
Open
3 tasks done
Labels
enhancement A new feature or request

Comments

@sophiewigmore
Copy link
Member

sophiewigmore commented Feb 2, 2021

What happened?

  • What were you attempting to do?

Trying to pack build an application that contains a global.json file that looks like this:

{
      "sdk": {
            "version": "2.1.0"
      }
}

In the dotnet-core-sdk buildpack, the global.json file is a part of the plan entry resolver priority list, so we should be looking at this file as a version source.

  • What did you expect to happen?

Expected the app to build properly, and to see "2.1.0" with the version source global.json in the SDK buildpack logs.

  • What was the actual behavior? Please provide log output, if possible.

Logs from SDK that do not include global.json

Paketo .NET Core SDK Buildpack 0.1.4
  Resolving .NET Core SDK version
    Candidate version sources (in priority order):
      RUNTIME_VERSION     -> "2.1.812"
      simple_brats.csproj -> "2.1.*"
      <unknown>           -> "*"

The pack build failed during publish:

Paketo .NET Publish Buildpack 0.1.3
  Executing build process
    Running 'dotnet publish /workspace --configuration Release --runtime ubuntu.18.04-x64 --self-contained false --output /tmp/dotnet-publish-output047634497'
failed to execute 'dotnet publish': exit status 145
      Failed after 2.741886ms
        A compatible SDK version for global.json version: [2.1.0] from [/workspace/global.json] was not found
        Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
          https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
ERROR: failed to build: exit status 1

Build Configuration

Trying to build this app: https://github.com/cloudfoundry/dotnet-core-buildpack/tree/v2.3.22/fixtures/source_2.1_global_json_templated

With the global.json changed to have version 2.1.0 inside instead of templating.

  • What platform (pack, kpack, tekton buildpacks plugin, etc.) are you
    using? Please include a version.

pack v0.15.1+git-79adc30.build-1660

  • What buildpacks are you using? Please include versions.

  • What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>?

  • Can you provide a sample app or relevant configuration (buildpack.yml,
    nginx.conf, etc.)?

Checklist

  • I have included log output.
  • The log output includes an error message.
  • I have included steps for reproduction.
@fg-j fg-j added the enhancement A new feature or request label Mar 15, 2021
@fg-j fg-j added bug Something isn't working and removed enhancement A new feature or request bug Something isn't working labels Dec 1, 2021
@fg-j
Copy link

fg-j commented Dec 1, 2021

According to the .NET docs:

The global.json file allows you to define which .NET SDK version is used when you run .NET CLI commands. Selecting the .NET SDK is independent from specifying the runtime your project targets. The .NET SDK version indicates which versions of the .NET CLI is used.

Given the intended purpose of the global.json file, I think it should be considered as an SDK version source. In fact, I think the version source should probably overrule the version determined by RUNTIME_VERSION. A global.json file is the canonical manner of indicating what version of the .NET CLI to use for an app, and I think it should be respected even if it results in a "no available compatible version" error. This way, a developer will be alerted to a difference between their local build environment and the environment of the buildpack build.

@fg-j fg-j added the enhancement A new feature or request label Dec 1, 2021
@fg-j
Copy link

fg-j commented Jun 15, 2022

It may be easier to implement this now that .NET RFC 004 has been accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or request
Projects
None yet
Development

No branches or pull requests

2 participants