Add workaround for tar warning about "file changed as we read it" in Docker under Windows host
This commit is contained in:
parent
5bfb634156
commit
853a27da6f
3 changed files with 24 additions and 1 deletions
|
@ -29,6 +29,7 @@ if ($noninteractive)
|
|||
docker run $interactiveFlag -t --rm --sig-proxy=true `
|
||||
--name "$dockerContainerName" `
|
||||
-v "${RepoRoot}:/opt/code" `
|
||||
-e DOTNET_CORESDK_IGNORE_TAR_EXIT_CODE=1 `
|
||||
-e CHANNEL `
|
||||
-e DOTNET_BUILD_SKIP_CROSSGEN `
|
||||
-e PUBLISH_TO_AZURE_BLOB `
|
||||
|
|
|
@ -38,6 +38,20 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
/// </summary>
|
||||
public ITaskItem[] ExcludePatterns { get; set; }
|
||||
|
||||
public bool IgnoreExitCode { get; set; }
|
||||
|
||||
protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
|
||||
{
|
||||
int returnCode = base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
|
||||
|
||||
if (IgnoreExitCode)
|
||||
{
|
||||
returnCode = 0;
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
protected override bool ValidateParameters()
|
||||
{
|
||||
base.ValidateParameters();
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
DependsOnTargets="GenerateLayout;GetCurrentRuntimeInformation"
|
||||
AfterTargets="Build">
|
||||
|
||||
<!-- When running in Docker under a Windows host, tar is warning "file changed as we read it" for several files and returning exit code 1.
|
||||
So this flag allows that to be ignored. -->
|
||||
<PropertyGroup Condition="'$(IgnoreTarExitCode)' == ''">
|
||||
<IgnoreTarExitCode>false</IgnoreTarExitCode>
|
||||
<IgnoreTarExitCode Condition="'$(DOTNET_CORESDK_IGNORE_TAR_EXIT_CODE)' == '1'">true</IgnoreTarExitCode>
|
||||
</PropertyGroup>
|
||||
|
||||
<ZipFileCreateFromDirectory
|
||||
SourceDirectory="$(RedistLayoutPath)"
|
||||
DestinationArchive="$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionSdk).zip"
|
||||
|
@ -12,7 +19,8 @@
|
|||
Condition=" '$(OSName)' != 'win' "
|
||||
SourceDirectory="$(RedistLayoutPath)"
|
||||
DestinationArchive="$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionSdk).tar.gz"
|
||||
OverwriteDestination="true" />
|
||||
OverwriteDestination="true"
|
||||
IgnoreExitCode="$(IgnoreTarExitCode)"/>
|
||||
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
Loading…
Add table
Reference in a new issue