-
Notifications
You must be signed in to change notification settings - Fork 8
Move to .NET Standard 1.6 and dotnet CLI #42
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
Conversation
272504a
to
de0feb8
Compare
de0feb8
to
1418aa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass
Dockerfile
Outdated
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ | ||
RUN export JAVA_HOME | ||
# Adapted from: https://github.com/dotnet/dotnet-docker/blob/master/2.2/sdk/bionic/amd64/Dockerfile | ||
FROM buildpack-deps:bionic-scm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the diff between the two Dockerfile
s? Could you instead use FROM mcr.microsoft.com/dotnet/core/sdk:2.2
and add whatever needs to change? This will also reduce container build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is that the one we were using, as well as the 2.2
you are suggesting, are based on Debian 9 (which is currently the stable -1
version). This new one is the official recommended one for Ubuntu 18.04, a.k.a bionic
. Given our overall reliance on Ubuntu over Debian this seems like a good move to improve reproducibility between CI builds and the local development experience.
The docker container build time is 1m45 - 2m. This included about ~30/45 seconds of building and packing the Platform SDK for use by the subsequent scenarios. This stands against an average 12/15 minutes of scenario runtime. From that perspective I'd happily take the extra time-hit for the improved convergence between environments, given that the increase in container build time is less than the usual variability between builds of the scenario test times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want the bionic base, use the tags 2.2.401-bionic
, or 2.2-bionic
(the latter being less specific). See full tag list here: https://hub.docker.com/_/microsoft-dotnet-core-sdk/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's a tag I strongly prefer using it. I don't want to maintain this mess :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wholeheartedly agree. 😆 Thanks for finding those links had gone crazy searching for them myself.
# Build the examples for use by scripts. | ||
ARG SDK_VERSION | ||
RUN msbuild examples/examples.sln /p:Configuration=Release /p:Version=$SDK_VERSION /t:Clean,Build -verbosity:minimal | ||
RUN dotnet build examples/examples.sln --configuration Release -p:Version=$SDK_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the longform of -p
? --parameter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically taken over from msbuild
and is not even properly documented on the dotnet build
help. Just look at the very end of the page for the sole mention (or search -p
). Hence I'll keep it as is.
apis/apis.csproj
Outdated
|
||
<PropertyGroup> | ||
<Authors>Improbable</Authors> | ||
<Copyright>Copyright 2018 Improbable</Copyright> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2019? Or where does this come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update but this was just a reorder of existing lines.
|
||
set -e -u -o pipefail | ||
|
||
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
REPO_ROOT=$(realpath "${BASH_SOURCE[0]}")/..")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the macOS compatibility is here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not going to move this ATM. This PR does not aim to make the script perfect in its entirety. It focuses more on the dotnet
migration. Later iterations will improve it further.
dotnet pack apis/apis.csproj --no-build --configuration Release -p:"PackageVersion=${SDK_VERSION}" | ||
|
||
pushd "${BIN_DIR}/${TARGET_FRAMEWORK}" | ||
zip -r "${PACKAGE_DIR}/${SDK_VERSION}.zip" ./* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will miss all files/dirs at the top-level AND starting with a .
- probably not a problem just want to flag it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how the script works at the moment. It's not a problem. And a candidate for future improvement.
nuget push "${ARTEFACT_DIR}/Improbable.SpatialOS.Platform.${SDK_VERSION}.nupkg" -Source https://api.nuget.org/v3/index.json | ||
dotnet nuget push "${PACKAGE_DIR}/Improbable.SpatialOS.Platform.${SDK_VERSION}.nupkg" \ | ||
--source https://api.nuget.org/v3/index.json \ | ||
--api-key "${NUGET_API_KEY}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the key is in the environment it will be accessible to basically all engineers (in the build logs). Can dotnet
take a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is currently run manually and you need to get if from LastPass. This will be moved to Vault when we automate this process (Soon ™️ )
1418aa4
to
1c1df0a
Compare
1c1df0a
to
e058320
Compare
This PR aims to eliminate a few of the issues that I have been encountering in the regeneration of the SDK and its associated scripts.
Highlights:
Move from using a bastardised / mixed version of .NET Framework 4.5.1 with .NET Standard 1.5 to using .NET Standard 1.6. This could technically be considered as a breaking change although the current situation is not very clear on requirements: .NET Standard 1.5 is only compatible with .NET Framework 4.6.1 and thus our current scheme is undefined.
Use of
dotnet
CLI instead ofmsbuild
as it nicely wraps functionality of bothmsbuild
andnuget
and has cleaner CLI interfaces.Update of the used docker container to a more recent mainline image (and LTS).