Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Create build manifest in PushToBlobFeed for orchestrated build final publish #1836

Merged
merged 2 commits into from Dec 21, 2017

Conversation

dagood
Copy link
Member

@dagood dagood commented Dec 20, 2017

This adds functionality to PushToBlobFeed to create build output manifests. See core-eng/publish.md for details on usage.

https://github.com/dotnet/core-eng/issues/2287 "Add output manifest generation to PushToBlobFeed task"


This is intended for single/low-use feeds: the manifest(s) would build up over time on a central blob feed. Central feeds can ensure manifests are never pushed to them by putting a blob called disable-manifest-push at the root of the feed. (The blob's contents aren't examined and don't matter.)

I initially wanted to use Sleet feed settings for this. However, PushToBlobFeed by default runs Init on every call, which clears the settings. I think it's infeasible and error-prone to distribute an update that disables the Init calls, so I decided to go with disabling via a blob.

I'll add this blob to the dotnet-core central feed before merging this change.
(Done: https://dotnetfeed.blob.core.windows.net/dotnet-core/disable-manifest-push)

FYI @jcagme @weshaggard


I also added a small VersionTools test project. It doesn't match the existing BuildTools infra because it uses the new Core SDK project format (it won't run in CI). I wasn't able to quickly figure out how to get the existing BuildTools test project patterns to work any better than sometimes working with F5 in Visual Studio.

I also created a LaunchDebugger task that IMO is overdue. It makes it really easy to debug BuildTools tasks without temporarily hard-coding a Debugger.Launch().

@dagood dagood self-assigned this Dec 20, 2017
@dagood dagood requested a review from mmitche December 20, 2017 16:49
@mmitche
Copy link
Member

mmitche commented Dec 20, 2017

@dagood Do you have a generated sample manifest around?

@dagood
Copy link
Member Author

dagood commented Dec 20, 2017

Here's one that I created during test runthroughs:

<Build Name="anonymous">
  <Package Id="Feed.Initialization.Placeholder" Version="1.0.0-do-not-use" />
  <Dir Name="proj">
    <Dir Name="relative">
      <Blob foo="bar" more="testing" Id="foo.nupkg" />
    </Dir>
  </Dir>
</Build>

More "real" ones are in the tests: https://github.com/dotnet/buildtools/pull/1836/files#diff-4590351532b923e82d4a615c7d317a82R115 (besides formatting)


(Edit) New one with review changes based on the same artifact push:

<Build Name="anonymous" BuildId="no build id provided">
  <Package Id="Feed.Initialization.Placeholder" Version="1.0.0-do-not-use" />
  <Blob Id="proj/relative/foo.nupkg" foo="bar" more="testing" />
</Build>

Copy link
Member

@mmitche mmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good.

return;
}

string blobPath = $"assets/orchestration-metadata/manifests/{ManifestName}.xml";

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

using MSBuild = Microsoft.Build.Utilities;

namespace Microsoft.DotNet.Build.Tasks.Feed
{
public class PushToBlobFeed : MSBuild.Task
{
private static readonly char[] ManifestDataPairSeparators = { ';' };
private const string DisableManifestPushConfigurationBlob = "disable-manifest-push";
private const string AssetsVirtualDir = "assets/";

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

return null;
}

string[] virtualPathSegments = virtualPath.Split('/');

This comment was marked as spam.

This comment was marked as spam.

public string VirtualDirectory
{
get { return string.Join("/", VirtualDirectorySegments); }
set { VirtualDirectorySegments = value.Split('/'); }

This comment was marked as spam.

// an element like <Dir> or <Dir Name="">. This can happen if someone passes an extra
// slash like "foo/bar//baz". The "//" is a valid virtual dir, even though it breaks the
// virtual dir metaphor.
return dirs.Select(dir => dir.Attribute("Name")?.Value).ToArray();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

string branch = null,
string commit = null)
{
Name = name;

This comment was marked as spam.

}
if (string.IsNullOrEmpty(identity.BuildId))
{
throw new ArgumentException(

This comment was marked as spam.

This comment was marked as spam.

string branch = null,
string commit = null)
{
if (name == null)

This comment was marked as spam.

This comment was marked as spam.

@dagood dagood merged commit 4ef4b9a into dotnet:master Dec 21, 2017
@dagood dagood deleted the generate-manifest branch December 21, 2017 20:24
@@ -34,6 +41,22 @@ public class PushToBlobFeed : MSBuild.Task

public int UploadTimeoutInMinutes { get; set; } = 5;

public bool SkipCreateManifest { get; set; }

public string ManifestName { get; set; } = "anonymous";

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants