fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

Paket , net core sdk 2.1 RC and ubuntu docker build agent - EXEC : Could not fix timestamps in #3198

Open richardjharding opened 6 years ago

richardjharding commented 6 years ago

Description

I've created a vsts build agent derived from microsoft/vsts-agent:ubuntu-14.04-docker-17.06.0-ce-standard image and when I add .net core 2.1 SDK paket fails with errors like

 EXEC : Could not fix timestamps in /opt/vsts/work/1/s/packages/Microsoft.DotNet.PlatformAbstractions/microsoft.dotnet.platformabstractions.2.0.4.nupkg. error : End of Central Directory record could not be found. [/opt/vsts/work/1/s/Sse.Retail.Fusion.Reactor.Specs/Sse.Retail.Fusion.Reactor.Specs.fsproj]
         /opt/vsts/work/1/s/.paket/Paket.Restore.targets(76,5): error MSB3073: The command "mono --runtime=v4.0.30319 "/opt/vsts/work/1/s/.paket/paket.exe" restore --target-framework "netcoreapp2.0"" exited with code 1. [/opt/vsts/work/1/s/Sse.Retail.Fusion.Reactor.Specs/Sse.Retail.Fusion.Reactor.Specs.fsproj]
    0 Warning(s)

Repro steps

The docker file used to create the agent is

FROM microsoft/vsts-agent:ubuntu-14.04-docker-17.06.0-ce-standard 

WORKDIR /root

RUN curl --insecure -o ./sonarscanner.zip -L https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.0.3.778-linux.zip
RUN unzip sonarscanner.zip
RUN rm sonarscanner.zip

ENV SONAR_RUNNER_HOME=/root/sonar-scanner-3.0.3.778-linux
ENV PATH $PATH:/root/sonar-scanner-3.0.3.778-linux/bin

WORKDIR /vsts

RUN sudo apt-get update
RUN sudo apt-get install -y  --no-install-recommends dotnet-sdk-2.1.105
RUN sudo apt-get install -y  --no-install-recommends dotnet-sdk-2.1.300-rc1-008673
RUN rm -rf /var/lib/apt/lists/*
RUN dotnet help

RUN curl -fsSL https://goss.rocks/install | sh

RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN sudo apt install apt-transport-https
RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
RUN sudo apt update
RUN sudo apt-get -y install fsharp
RUN rm -rf /var/lib/apt/lists/*

Expected behavior

dotnet restore completes without errors

Actual behavior

There are errors restoring some packages

5:4>EXEC : Could not fix timestamps in /opt/vsts/work/1/s/packages/Microsoft.DotNet.PlatformAbstractions/microsoft.dotnet.platformabstractions.2.0.4.nupkg. error : End of Central Directory record could not be found. [/opt/vsts/work/1/s/Sse.Retail.Fusion.Reactor.Specs/Sse.Retail.Fusion.Reactor.Specs.fsproj]
         Something went wrong while downloading Microsoft.DotNet.PlatformAbstractions 2.0.4
         Message: Error during extraction of /opt/vsts/work/1/s/packages/Microsoft.DotNet.PlatformAbstractions/microsoft.dotnet.platformabstractions.2.0.4.nupkg.

           ==> Trying again

removing the line in the docker file

RUN sudo apt-get install -y  --no-install-recommends dotnet-sdk-2.1.300-rc1-008673

means the restore works correctly - I have the rc sdk on a windows desktop and paket restores without errors - am I missing some other upgrade?

Paket version 5.161.3, I've also tried deriving from the ubuntu 16 version of the vsts agent and tweaking the f# tools install to suit but the same errors occur during restore

Any help much appreciated

forki commented 6 years ago

/cc @enricosada @matthid ideas?

richardjharding commented 6 years ago

so an update on this - I think its something to do with mono, runtime version in the targets? If I do an explicit

mono ./.paket/paket.exe restore

then it works - its only an issue if I do a dotnet restore on its own

patrickweegen commented 6 years ago

I've got an similar issue, using paket to build .net Core solutions on docker.

I use the microsoft/dotnet images and install mono there:

FROM microsoft/dotnet:2-sdk
LABEL maintainer="Patrick Weegen (patxxx@gmail.com)"
RUN apt-get update && apt-get install -y mono-complete
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    dpkg-reconfigure --frontend=noninteractive locales && \
    update-locale LANG=en_US.UTF-8

When running dotnet restore for my solution I get the following error (copied from bitbucket pipelines, but the same running the image on my local machine):

Bus error (core dumped)
/opt/atlassian/pipelines/agent/build/.paket/Paket.Restore.targets(81,5): error MSB3073: The command "mono --runtime=v4.0.30319 "/opt/atlassian/pipelines/agent/build/.paket/paket.exe" restore" exited with code 135. [/opt/atlassian/pipelines/agent/build/src/FDAS.Presence/FDAS.Presence.csproj]

If I'm using the image based on microsoft/dotnet:2.0-sdk (exactly the same dockerfile only other base image) it all works fine.

Also calling paket.exe restore manually like @richardjharding mentioned above works on the conainer.