Skip to content

Commit

Permalink
Dotnet6 (#46)
Browse files Browse the repository at this point in the history
* Pass at upgrading to .NET 6 since 7 isnt supported by some packaging tools

* Update `dotnet-tarball` to `0.1.220`

* Update `dotnet-rpm` to `0.1.220`

* Updated `DebDotNetDependencies` to include `libssl3`
  • Loading branch information
MattInternet committed Sep 20, 2023
1 parent f6776e1 commit 55f6ecb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 73 deletions.
47 changes: 6 additions & 41 deletions .ci/.drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,14 @@ steps:

# Note: I setup BATS here using this: https://medium.com/@pimterry/testing-your-shell-scripts-with-bats-abfca9bdc5b9
- name: build and test
image: mcr.microsoft.com/dotnet/sdk:7.0
image: mcr.microsoft.com/dotnet/sdk:6.0
environment:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
commands:
# Dont allow bats to do the build, thats a convenience for local development but BATS eats a bunch of the output and can hang.
- dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true -p:PublishReadyToRun=true --self-contained true -o publish ./cli
- ./cli.tests/bats/run.sh

# - name: test
# image: docker:20.10-dind
# volumes:
# - name: dockersock
# path: /var/run
# commands:
# - sleep 5 # give docker enough time to start
# - docker ps -a

# - name: build
# image: docker:20.10-dind
# volumes:
# - name: dockersock
# path: /var/run
# commands:
# - sleep 5
# - docker ps
# - docker build . -t dug-test

# volumes:
# - name: dockersock
# temp: {}

---

kind: pipeline
Expand Down Expand Up @@ -100,15 +77,12 @@ depends_on:

steps:
- name: prepare_publishing
image: mcr.microsoft.com/dotnet/sdk:7.0
image: mcr.microsoft.com/dotnet/sdk:6.0
commands:
- echo "Publishing tagged version ${DRONE_TAG}"
- sed -i 's~<Version>0.0.1</Version>~<Version>${DRONE_TAG}</Version>~' ./cli/dug.csproj #Set the Version in the csproj, its the only way to get the packaging tools to respect the version.
when:
ref:
- refs/tags/*.*.*

- name: docker
- name: publish docker
image: plugins/docker
settings:
username:
Expand All @@ -126,7 +100,7 @@ steps:


- name: package linux
image: mcr.microsoft.com/dotnet/sdk:7.0
image: mcr.microsoft.com/dotnet/sdk:6.0
environment:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
commands:
Expand All @@ -139,22 +113,16 @@ steps:
- dotnet deb -c Release -r linux-arm64 -o ./publish ./cli/dug.csproj
- dotnet rpm -c Release -r linux-x64 -o ./publish ./cli/dug.csproj
- dotnet tarball -c Release -r linux-x64 -o ./publish ./cli/dug.csproj
when:
ref:
- refs/tags/*.*.*
depends_on:
- prepare_publishing

- name: build win-x64
image: mcr.microsoft.com/dotnet/sdk:7.0
image: mcr.microsoft.com/dotnet/sdk:6.0
environment:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
commands:
- sed -i 's~<version>0.0.1</version>~<version>${DRONE_TAG}</version>~' ./.ci/win/dug.nuspec #Set the Version in the nuspec
- dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true -o ./.ci/win/output ./cli
when:
ref:
- refs/tags/*.*.*
depends_on:
- prepare_publishing

Expand All @@ -175,17 +143,14 @@ steps:
- build win-x64

- name: build osx-x64
image: mcr.microsoft.com/dotnet/sdk:7.0
image: mcr.microsoft.com/dotnet/sdk:6.0
environment:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
commands:
- dotnet publish -r osx-x64 -c Release -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true -o publish ./cli
- mv ./publish/dug ./publish/dug-osx-x64 #Rename the binary to its architecture type
- dotnet tool restore
- dotnet tarball -c Release -r osx-x64 -o ./publish ./cli/dug.csproj
when:
ref:
- refs/tags/*.*.*
depends_on:
- prepare_publishing

Expand Down
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
]
},
"dotnet-rpm": {
"version": "0.1.189",
"version": "0.1.220",
"commands": [
"dotnet-rpm"
]
},
"dotnet-tarball": {
"version": "0.1.189",
"version": "0.1.220",
"commands": [
"dotnet-tarball"
]
Expand Down
38 changes: 19 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["unfrl.com" , "-w"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -20,7 +20,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["update", "-f", "Resources/default_servers.csv"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -31,7 +31,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["update"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -42,7 +42,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["git.kaijucode.com"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -53,7 +53,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["help", "run"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -64,7 +64,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["cube.packsize.com", "-q", "ANY", "-f", "./test_servers.csv"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -75,7 +75,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["kaijucode.com", "-f", "./test_servers.csv"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -86,7 +86,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["kaijucode.com" , "-q", "MX,A"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -97,7 +97,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["git.kaijucode.com" , "-s", "8.8.8.8,2001:4860:4860::8888"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -108,7 +108,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["kaijucode.com" , "--continents", "SA,NA"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -119,7 +119,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["git.kaijucode.com" , "--continents", "NA,SA,ZA", "--output-template", "catz"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -130,7 +130,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": [],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -141,7 +141,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["version"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -152,7 +152,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["git.kaijucode.com", "--output-template", "IPAddress,ResponseTime,Value", "--output-format", "CSV"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -163,7 +163,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["run" , "-f", "./test_custom_header_servers_color.csv","--data-headers-present", "--data-columns", "city,ipaddress,countrycode,dnssec,reliability,ignore", "git.kaijucode.com"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -174,7 +174,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["git.kaijucode.com", "--output-template", "IPAddress,ResponseTime,Value", "--output-format", "JSON"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -185,7 +185,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["update" , "-r", "normal"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -196,7 +196,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["update" , "-r", "prune", "--reliability-only"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand All @@ -207,7 +207,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/cli/bin/Debug/net7.0/dug.dll",
"program": "${workspaceFolder}/cli/bin/Debug/net6.0/dug.dll",
"args": ["update" , "--data-headers-present", "--data-columns", "city,ipaddress,countrycode,dnssec,reliability", "-f", "./test_custom_header_servers.csv", "-o"],
"cwd": "${workspaceFolder}/cli",
"console": "internalConsole",
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /app

COPY ./cli/dug.csproj .
RUN dotnet restore
COPY ./cli .
RUN dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true -p:PublishReadyToRun=true --self-contained true -o publish

FROM mcr.microsoft.com/dotnet/runtime:7.0 as runtime
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT [ "./dug" ]
4 changes: 2 additions & 2 deletions Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#This DOckerfile "works" but for some reason the animated parts of the output dont look correct.
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /app

COPY ./cli/dug.csproj .
RUN dotnet restore
COPY ./cli .
RUN dotnet publish -r linux-musl-x64 -c Release -p:PublishSingleFile=true --self-contained true -o publish

FROM mcr.microsoft.com/dotnet/runtime:7.0-alpine as runtime
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine as runtime
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT [ "./dug" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Not sure if this counts as an "Installation" but there is a docker image availab

## Development

This is a .net 7 project, so as long as you have the dotnet cli, available [here](https://dotnet.microsoft.com/download/dotnet/7.0) you should be able to do the following: `dotnet build ./cli`
This is a .net 6 project, so as long as you have the dotnet cli, available [here](https://dotnet.microsoft.com/download/dotnet/6.0) you should be able to do the following: `dotnet build ./cli`

The project was developed in VSCode so the debugger profiles that I have used are available if you're also using VSCode.

Expand Down
2 changes: 1 addition & 1 deletion cli.tests/XUnit/cli.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions cli/dug.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Version>0.0.1</Version> <!-- Version is set by ci/cd pipeline -->
<RuntimeIdentifiers>linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="DnsClient" Version="1.7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Spectre.Console" Version="0.41.0" />
<PackageReference Include="TinyCsvParser" Version="2.6.0" />
</ItemGroup>
Expand All @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<DebDotNetDependencies Include="libc6, libgcc1, libgssapi-krb5-2, libstdc++6, zlib1g, libssl1.1 | libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl0.9.8, libicu72 | libicu71 | libicu70 | libicu69 | libicu68 | libicu67 | libicu66 | libicu65 | libicu64 | libicu63 | libicu62 | libicu61 | libicu60 | libicu59 | libicu58 | libicu57 | libicu56 | libicu55 | libicu54 | libicu53 | libicu52" />
<DebDotNetDependencies Include="libc6, libgcc1, libgssapi-krb5-2, libstdc++6, zlib1g, libssl3 | libssl1.1 | libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl0.9.8, libicu72 | libicu71 | libicu70 | libicu69 | libicu68 | libicu67 | libicu66 | libicu65 | libicu64 | libicu63 | libicu62 | libicu61 | libicu60 | libicu59 | libicu58 | libicu57 | libicu56 | libicu55 | libicu54 | libicu53 | libicu52" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions cli/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ apps:
parts:
dug:
plugin: dotnet
dotnet-version: 7.0
dotnet-runtime-version: '7.0.0'
dotnet-version: 6.0
dotnet-runtime-version: '6.0.0'
source: .
source-type: local
override-build: |
Expand Down

0 comments on commit 55f6ecb

Please sign in to comment.