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

Use dotnet-install.sh in .NET feature #628

Merged
merged 38 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
302a34f
Use dotnet-install.sh in .NET feature
sliekens Jul 21, 2023
53b8f30
Use latest.version files
sliekens Jul 22, 2023
c035e85
Cleanup runtime args
sliekens Jul 22, 2023
d3d149b
Use latest.version files in tests as well
sliekens Jul 22, 2023
bfb12d6
Improve tests, remove code duplication
sliekens Jul 23, 2023
00ce410
Add stderr helper
sliekens Jul 27, 2023
e2ce463
Validate version inputs
sliekens Jul 27, 2023
5b0b8d9
Use suggested description
sliekens Jul 27, 2023
6f7ddd1
Shorter version description
sliekens Jul 27, 2023
cde0ae6
Shorter version description
sliekens Jul 27, 2023
fd101aa
Clean up apt lists
sliekens Jul 27, 2023
dc7a0be
Verify 7.0 is latest
sliekens Jul 29, 2023
2d0fb73
Fix PATH, add test for .NET global tools
sliekens Jul 29, 2023
5200853
Include a copy of dotnet-install.sh in the Feature
sliekens Aug 1, 2023
ad0bf10
Configure useful env variables
sliekens Aug 2, 2023
e39d87b
Use stringly typed booleans
sliekens Aug 3, 2023
440d47b
Keep imperative writing style in option hints
sliekens Aug 7, 2023
3d48f77
Update maintainers
sliekens Aug 7, 2023
c415add
Move dotnet-install.sh into a vendor directory
sliekens Aug 7, 2023
d19b609
Refactor variables
sliekens Aug 7, 2023
ea94b44
Amend
sliekens Aug 7, 2023
27b0f44
Amend 2
sliekens Aug 7, 2023
2b2e683
Use default options from devcontainer-feature.json
sliekens Aug 14, 2023
37e14cc
Add back variables
sliekens Aug 27, 2023
deb2094
Fix shellchek warning in fetch_latest_sdk_version
sliekens Aug 27, 2023
95028c4
Inline install_version function
sliekens Aug 27, 2023
fd39498
Fix ShellCheck warnings
sliekens Aug 27, 2023
8ec9c02
Improve CSV parsing
sliekens Aug 27, 2023
9361e33
Default to latest when configuring an empty version
sliekens Aug 28, 2023
f9167de
Add support for runtime-only configurations
sliekens Aug 28, 2023
3ba0f40
Move 'none' check higher up
sliekens Aug 29, 2023
6cdab1e
Deduplicate helper functions, sort into files
sliekens Aug 29, 2023
dd3f3ec
Address the user more directly in NOTES
sliekens Aug 29, 2023
a5ca01b
Remove unnecessary defaults
sliekens Aug 30, 2023
5b71121
Replace feature -> Feature
sliekens Sep 6, 2023
37c220f
Add update-dotnet-install-script workflow
sliekens Sep 6, 2023
059221f
Apply suggestions from code review
sliekens Sep 6, 2023
8eef025
Don't skip ci for automated script update
sliekens Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/update-dotnet-install-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Updates vendor 'dotnet-install' script"
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Runs every Sunday at midnight UTC (adjust as needed)

jobs:
fetch-latest-dotnet-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run fetch-latest-dotnet-install.sh
run: src/dotnet/scripts/fetch-latest-dotnet-install.sh

- name: Create a PR for dotnet-install.sh
id: push_image_info
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
set -e
echo "Start."

# Configure git and Push updates
git config --global user.email [email protected]
git config --global user.name github-actions
git config pull.rebase false

branch=automated-script-update-$GITHUB_RUN_ID
git checkout -b $branch
message='[Updates] Automated vendor 'dotnet-install' script'

# Add / update and commit
git add src/dotnet/scripts/vendor/dotnet-install.sh
git commit -m 'Automated dotnet-install script update' || export NO_UPDATES=true

# Push
if [ "$NO_UPDATES" != "true" ] ; then
git push origin "$branch"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/pulls \
-f title="$message" \
-f body="$message" \
-f head="$branch" \
-f base="$GITHUB_REF_NAME"
fi
67 changes: 67 additions & 0 deletions src/dotnet/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,71 @@
## Configuration examples
sliekens marked this conversation as resolved.
Show resolved Hide resolved

Installing only the latest .NET SDK version (the default).

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": "latest" // or "" or {}
}
```

Installing an additional SDK version. Multiple versions can be specified as comma-separated values.

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"additionalVersions": "lts"
}
}
```

Installing specific SDK versions.

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0",
"additionalVersions": "7.0, 8.0"
}
}
```

Installing a specific SDK feature band.

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.4xx",
}
}
```

Installing a specific SDK patch version.

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.412",
}
}
```

Installing only the .NET Runtime or the ASP.NET Core Runtime. (The SDK includes all runtimes so this configuration is only useful if you need to run .NET apps without building them from source.)

``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "none",
"dotnetRuntimeVersions": "latest, lts",
"aspnetCoreRuntimeVersions": "latest, lts",
}
}
```

## OS Support

Expand Down
41 changes: 25 additions & 16 deletions src/dotnet/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
{
"id": "dotnet",
"version": "1.1.4",
"version": "2.0.0",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.",
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"7",
"6",
"3.1"
"lts",
"none",
"8.0",
"7.0",
"6.0"
],
"default": "latest",
"description": "Select or enter a dotnet CLI version. (Available versions may vary by Linux distribution.)"
"description": "Select or enter a .NET SDK version. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"runtimeOnly": {
samruddhikhandale marked this conversation as resolved.
Show resolved Hide resolved
"type": "boolean",
"default": false,
"description": "Install just the dotnet runtime if true, and sdk if false."
"additionalVersions": {
sliekens marked this conversation as resolved.
Show resolved Hide resolved
"type": "string",
sliekens marked this conversation as resolved.
Show resolved Hide resolved
"default": "",
"description": "Enter additional .NET SDK versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"dotnetRuntimeVersions": {
"type": "string",
"default": "",
"description": "Enter additional .NET runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"installUsingApt": {
"type": "boolean",
"default": true,
"description": "If true, it installs using apt instead of the release URL"
"aspNetCoreRuntimeVersions": {
"type": "string",
"default": "",
"description": "Enter additional ASP.NET Core runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
}
},
"containerEnv": {
sliekens marked this conversation as resolved.
Show resolved Hide resolved
"DOTNET_ROOT": "/usr/local/dotnet/current",
"PATH": "/usr/local/dotnet/current:${PATH}"
"DOTNET_ROOT": "/usr/share/dotnet",
samruddhikhandale marked this conversation as resolved.
Show resolved Hide resolved
"PATH": "$PATH:$DOTNET_ROOT:~/.dotnet/tools",
sliekens marked this conversation as resolved.
Show resolved Hide resolved
"DOTNET_RUNNING_IN_CONTAINER": "true",
"DOTNET_USE_POLLING_FILE_WATCHER": "true"
},
"customizations": {
"vscode": {
Expand Down
Loading