Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 5.71 KB

CONTRIBUTING.md

File metadata and controls

89 lines (55 loc) · 5.71 KB

Contributing

See dotnet/runtime Contributing for information about coding styles, source structure, making pull requests, and more.

Branches

When making PRs, all source code changes (e.g. Dockerfiles, tests, and infrastructure) should be made in the nightly branch. Only changes to the samples and documentation will be accepted against the master branch.

Workflow Instructions

Building

The build-and-test.ps1 script will build and test the .NET Docker images. Given the matrix of supported .NET versions, distros, and architectures there are numerous Dockerfiles and building can take a while. To make this manageable, the script supports several options for filtering down what images get built and tested.

  • Build and test all of the .NET 5.0 images for the Docker platform your machine is targeting (e.g. linux/x64, linux/arm, linux/arm64, windows/x64).

    > ./build-and-test.ps1 -Version 5.0
  • Build the 3.1 Nano Server 1809 images

    > ./build-and-test.ps1 -Version 3.1 -OS nanoserver-1809 -Mode Build
  • Build and test the samples

    > ./build-and-test.ps1 -Path *samples* -TestCategories sample
  • Test the 5.0 Alpine 3.12 images for the current architecture (e.g. x64, arm, arm64).

    > ./build-and-test.ps1 -Version 5.0 -OS alpine3.12 -Mode Test

Editing Dockerfiles

The Dockerfiles contained in this repo are generated from a set of Cottle based templates. A single template generates the set of Dockerfiles that are similar (e.g. all Windows sdk Dockerfiles for a particular .NET version). This ensures consistency across the various Dockerfiles and eases the burden of making changes to the Dockerfiles. Instead of editing the Dockerfiles directly, the templates should be updated and then the Dockerfiles should get regenerated by running the generate Dockerfiles script.

Editing READMEs

The READMEs contained in this repo are used as the descriptions for the Docker repositories the images are published to. Just like the Dockerfiles, the READMEs are generated from a set of Cottle based templates. This ensures consistency across the various READMEs and eases the burden of making changes. Instead of editing the READMEs directly, the templates should be updated and then the READMEs should get regenerated by running the generate READMEs script.

Tests

There are two basic types of tests for each of the images produced from this repo.

  1. Unit tests that validate the static state of images. This includes things like verifing which environment variables are defined.
  2. Scenario tests that validate basic usage scenarios. For example the SDK image is used to create, build and run a new console app.

When editing Dockerfiles, please ensure the appropriate test changes are also made.

Metadata Changes

The manifest.json contains metadata used by the engineering infrastructure to build and publish the images. It includes information such as:

  • Dockerfiles to build
  • Image Tags
  • Manifest/shared tags to create and which images they reference
  • Docker repositories to publish the images to
  • Dockerfile templates used to generate the Dockerfiles
  • etc.

When adding or removing Dockerfiles, it is important to update the manifest.json accordingly.

Updating Product Versions

Updating the product versions (e.g. .NET runtime, ASP.NET runtime, PowerShell, etc.) contained within the images is typically performed by automation. All of the product version information is stored in the manifest.versions.json file. The Dockerfile templates reference the product versions numbers and checksums from this file. Updating a product version involves updating the manifest.versions.json and regenerating the Dockerfiles. If there are cases where you need to update a product version, you can use the update-dependencies tool. The tool will do the following:

  1. Update the product versions and checksums stored in manifest.versions.json
  2. Regenerate the Dockerfiles
  3. Update the tags listing in the readmes

The following examples illustrate how to run update-dependencies:

  • Update the 3.1 product versions

    > dotnet run --project .\eng\update-dependencies\ -- 3.1 --product-version runtime=3.1.6 --product-version aspnet=3.1.6 --product-version sdk=3.1.302
  • Update the PowerShell version used in the 5.0 images

    > dotnet run --project .\eng\update-dependencies\ -- 5.0 --product-version powershell=7.1.0-preview.4 --compute-shas