Skip to content

Conversation

Helcaraxan
Copy link
Contributor

@Helcaraxan Helcaraxan commented Aug 5, 2019

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 of msbuild as it nicely wraps functionality of both msbuild and nuget and has cleaner CLI interfaces.

  • Update of the used docker container to a more recent mainline image (and LTS).

@Helcaraxan Helcaraxan self-assigned this Aug 5, 2019
@improbable-prow-robot improbable-prow-robot added jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/M Denotes a PR that changes 40-149 lines, ignoring generated files. labels Aug 5, 2019
@Helcaraxan Helcaraxan force-pushed the consolidate-scripts branch 3 times, most recently from 272504a to de0feb8 Compare August 5, 2019 18:19
@improbable-prow-robot improbable-prow-robot added size/L Denotes a PR that changes 150-299 lines, ignoring generated files. and removed size/M Denotes a PR that changes 40-149 lines, ignoring generated files. labels Aug 5, 2019
@Helcaraxan Helcaraxan force-pushed the consolidate-scripts branch from de0feb8 to 1418aa4 Compare August 6, 2019 13:24
Copy link

@RNabel RNabel left a 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
Copy link

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 Dockerfiles? 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.

Copy link
Contributor Author

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.

Copy link

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/

Copy link

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

Copy link
Contributor Author

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. :trollface:

# 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
Copy link

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?

Copy link
Contributor Author

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>
Copy link

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?

Copy link
Contributor Author

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)
Copy link

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]}")/..")

Copy link

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.

Copy link
Contributor Author

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" ./*
Copy link

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.

Copy link
Contributor Author

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}"
Copy link

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?

Copy link
Contributor Author

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 ™️ )

@Helcaraxan Helcaraxan force-pushed the consolidate-scripts branch from 1418aa4 to 1c1df0a Compare August 6, 2019 17:22
@Helcaraxan Helcaraxan force-pushed the consolidate-scripts branch from 1c1df0a to e058320 Compare August 7, 2019 07:52
@improbable-prow-robot improbable-prow-robot added size/M Denotes a PR that changes 40-149 lines, ignoring generated files. and removed size/L Denotes a PR that changes 150-299 lines, ignoring generated files. labels Aug 7, 2019
@Helcaraxan Helcaraxan requested a review from RNabel August 7, 2019 10:22
@Helcaraxan Helcaraxan merged commit 363f668 into master Aug 7, 2019
@Helcaraxan Helcaraxan deleted the consolidate-scripts branch August 7, 2019 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/M Denotes a PR that changes 40-149 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants