Create build manifest in PushToBlobFeed for orchestrated build final publish #1836
Conversation
@dagood Do you have a generated sample manifest around? |
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> |
There was a problem hiding this 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return null; | ||
} | ||
|
||
string[] virtualPathSegments = virtualPath.Split('/'); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
public string VirtualDirectory | ||
{ | ||
get { return string.Join("/", VirtualDirectorySegments); } | ||
set { VirtualDirectorySegments = value.Split('/'); } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
// 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
string branch = null, | ||
string commit = null) | ||
{ | ||
Name = name; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
if (string.IsNullOrEmpty(identity.BuildId)) | ||
{ | ||
throw new ArgumentException( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
string branch = null, | ||
string commit = null) | ||
{ | ||
if (name == null) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bd84b29
to
fef5345
Compare
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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'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 aDebugger.Launch()
.