Skip to content
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

Remove copy instructions in PushToAzureDevOpsArtifacts #4565

Merged
merged 6 commits into from
Jan 10, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ public class PushToAzureDevOpsArtifacts : MSBuild.Task
[Required]
public ITaskItem[] ItemsToPush { get; set; }

[Required]
public string AssetsTemporaryDirectory { get; set; }

public bool PublishFlatContainer { get; set; }

public string ManifestRepoUri { get; set; }
Expand Down Expand Up @@ -54,28 +51,15 @@ public override bool Execute()
var itemsToPushNoExcludes = ItemsToPush.
Where(i => !string.Equals(i.GetMetadata("ExcludeFromManifest"), "true", StringComparison.OrdinalIgnoreCase));

// To prevent conflicts with other parts of the build system that might move the artifacts
// folder while the artifacts are still being published, we copy the artifacts to a temporary
// location only for the sake of uploading them. This is a temporary solution and will be
// removed in the future.
if (!Directory.Exists(AssetsTemporaryDirectory))
{
Log.LogMessage(MessageImportance.High,
$"Assets temporary directory {AssetsTemporaryDirectory} doesn't exist. Creating it.");
Directory.CreateDirectory(AssetsTemporaryDirectory);
}

if (PublishFlatContainer)
{
// Act as if %(PublishFlatContainer) were true for all items.
blobArtifacts = itemsToPushNoExcludes
.Select(BuildManifestUtil.CreateBlobArtifactModel);
foreach (var blobItem in itemsToPushNoExcludes)
{
var destFile = $"{AssetsTemporaryDirectory}/{Path.GetFileName(blobItem.ItemSpec)}";
File.Copy(blobItem.ItemSpec, destFile);
Log.LogMessage(MessageImportance.High,
$"##vso[artifact.upload containerfolder=BlobArtifacts;artifactname=BlobArtifacts]{destFile}");
$"##vso[artifact.upload containerfolder=BlobArtifacts;artifactname=BlobArtifacts]{blobItem.ItemSpec}");
}
}
else
Expand Down Expand Up @@ -111,20 +95,14 @@ public override bool Execute()

foreach (var packagePath in packageItems)
{
var destFile = $"{AssetsTemporaryDirectory}/{Path.GetFileName(packagePath.ItemSpec)}";
File.Copy(packagePath.ItemSpec, destFile);

Log.LogMessage(MessageImportance.High,
$"##vso[artifact.upload containerfolder=PackageArtifacts;artifactname=PackageArtifacts]{destFile}");
$"##vso[artifact.upload containerfolder=PackageArtifacts;artifactname=PackageArtifacts]{packagePath.ItemSpec}");
}

foreach (var blobItem in blobItems)
{
var destFile = $"{AssetsTemporaryDirectory}/{Path.GetFileName(blobItem.ItemSpec)}";
File.Copy(blobItem.ItemSpec, destFile);

Log.LogMessage(MessageImportance.High,
$"##vso[artifact.upload containerfolder=BlobArtifacts;artifactname=BlobArtifacts]{destFile}");
$"##vso[artifact.upload containerfolder=BlobArtifacts;artifactname=BlobArtifacts]{blobItem.ItemSpec}");
}

packageArtifacts = packageItems.Select(BuildManifestUtil.CreatePackageArtifactModel);
Expand All @@ -141,6 +119,9 @@ public override bool Execute()
ManifestCommit,
ManifestBuildData,
IsStableBuild);

Log.LogMessage(MessageImportance.High,
$"##vso[artifact.upload containerfolder=AssetManifests;artifactname=AssetManifests]{AssetManifestPath}");
}
}
catch (Exception e)
Expand Down