Skip to content

[CI] Publish binaries for Aspire.Cli #9695

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

Merged
merged 7 commits into from
Jun 17, 2025
Merged

Conversation

radical
Copy link
Member

@radical radical commented Jun 4, 2025

Generate self contained single file binaries for Aspire.Cli for the following platforms:

  • linux-arm64
  • linux-x64
  • linux-musl-x64
  • osx-arm64
  • osx-x64
  • win-arm64
  • win-x64
  • win-x86

Produces archives named like aspire-cli-linux-x64-9.4.0-preview.1.25316.11.tar.gz in artifacts/packages/$(CONFIG)/Shipping.

Contributes to #9638

@radical radical added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jun 4, 2025
@github-actions github-actions bot added the area-engineering-systems infrastructure helix infra engineering repo stuff label Jun 4, 2025
@radical radical added area-cli and removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) labels Jun 5, 2025
@davidfowl
Copy link
Member

How big is it

@joperezr
Copy link
Member

joperezr commented Jun 5, 2025

How big is it

~30mb

image

@@ -0,0 +1,40 @@
<Project>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
Copy link
Member

Choose a reason for hiding this comment

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

I would have expected using the NoBuild targets sdk instead. Is there a reason why we need this one? Without it we can probably avoid having to set a target Framework.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm exploring that.

<AdditionalProperties Include="RuntimeIdentifier=$(CliRuntime)" />
<AdditionalProperties Include="PublishSingleFile=true" />
<AdditionalProperties Include="SelfContained=true" />
<!-- <AdditionalProperties Include="GenerateDocumenationFile=false" /> -->
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed?

Text="No files were found to pack. Ensure that the project $(MSBuildProjectFullPath) has a publish target defined." />

<MakeDir Directories="$(CliPublishedArtifactsOutputDir)/$(CliRuntime)" />
<ZipDirectory
Copy link
Member

Choose a reason for hiding this comment

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

I know this is how we do it for the dashboard, but since this will be customer facing we should change it such that only Windows builds use .zip files, but Linux artifacts should generate .tar files instead. Most Linux distros come with utilities to extract tars, but not zips so we should avoid having this as a requirement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm I can't reference System.IO.Compression and System.Formats.Tar from the inline task to make this work. I'll create a new tasks project for this, and use that.

Copy link
Member

Choose a reason for hiding this comment

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

Can we check what does dotnet sdk/installer team do here? If possible, I'd try to avoid adding a lot of complexity to the repo so let's see if there is anything we could reuse

</Project>
Copy link
Member

Choose a reason for hiding this comment

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

undo newline :)

- This generates zip files for non-linux platforms. And `.tar.gz` for
linux.
- And uses Arcade blob publishing to publish the generated archives
@@ -54,6 +56,11 @@
<PublishFlatContainer>true</PublishFlatContainer>
<RelativeBlobPath>$(_UploadPathRoot)/$(_PackageVersion)/%(Filename)%(Extension)</RelativeBlobPath>
</ItemsToPushToBlobFeed>
<ItemsToPushToBlobFeed Include="@(_CliFilesToPublish)">
Copy link
Member

Choose a reason for hiding this comment

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

Did we figure out how to control the aka.ms link version so that we get a "latest" link for each of the branches we build from? For instance, we should have one that points always to latest build from main, and one that points to latest build of release/9.x.

Copy link
Member

Choose a reason for hiding this comment

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

Totally ok if you prefer to do that as a follow-up PR

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that would have to be in a follow-up.

@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<CliRuntime>linux-arm64</CliRuntime>
Copy link
Member

Choose a reason for hiding this comment

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

No need to block your PR for this, but we may need to add a linux-musl build as well. Thoughts @mitchdenny @DamianEdwards @davidfowl

Copy link
Member

Choose a reason for hiding this comment

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

I think that @danegsta was adding in/has added in the musl support on the DCP side too.

Copy link
Member

Choose a reason for hiding this comment

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

This is a new project though, so he wouldn't have done it for this one.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, but I understand your comment now lol, yeah, because of his PR is why I made this comment 😆

Copy link
Member

Choose a reason for hiding this comment

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

Well there is no point shipping musl if the whole stack doesn't support it :)

Copy link
Member

Choose a reason for hiding this comment

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

@mitchdenny I've got this PR to add the new DCP musl build into Aspire. I'm only doing linux-musl-x64 support for now, as setting up a linux-musl-arm64 DCP build is going to be a lot more painful.


<Exec
Condition="$(CliRuntime.StartsWith('linux-'))"
Command="pwsh &quot;$(_CreateTarGzScriptPath)&quot; @(_CreateTarGzArguments, ' ')"
Copy link
Member

Choose a reason for hiding this comment

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

This now means there is a new prereq in the build as I don't believe pwsh was required before, correct?

Was there nothing in the SDK that does this naitvely? Might also be worth checking with dotnet monitor CLI tool as they produce tars as part of their build so we should also see what they do. TL:DR is that if we can simplify and get to the same results without having to introduce new pre-reqs and custom scripts, it'd be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

re:pwsh, we use that in multiple places for running tests on github actions.

re:sdk, there is a https://github.com/dotnet/sdk/blob/ad24473f7f2ae16eaee4cbd28eb6897d00df32f3/src/Tasks/sdk-tasks/TarGzFileCreateFromDirectory.cs#L8 which isn't being surfaced in a nuget. But Eric suggested https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.Tar which I will be trying. Still in draft :D

Copy link
Member

Choose a reason for hiding this comment

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

Another option to look into: https://github.com/dotnet/dotnet-monitor/blob/5d4c1ec2da76c832119c85cb63cb724e2c9ffa1e/eng/Publishing.props#L25-L30

dotnet-monitor does this already so perhaps we can check with folks like @wiktork on how they build their tarballs that are then published?

Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent find! There seems to be [Microsoft.DotNet.Build.Tasks.Archives](https://github.com/dotnet/arcade/tree/d9d02d858b71562509f72ea84409853e4deffc8f/src/Microsoft.DotNet.Build.Tasks.Archives) nuget which IIUC supports this. I will try it out.

@radical
Copy link
Member Author

radical commented Jun 17, 2025

WIP, not ready for review yet.

@radical
Copy link
Member Author

radical commented Jun 17, 2025

next:

  • Confirm that the blobs got published, and are accessible
  • How can we use notargets sdk with Microsoft.DotNet.Build.Tasks.Archives

@radical radical force-pushed the cli-single branch 2 times, most recently from 31576a5 to 42e8009 Compare June 17, 2025 06:05
@radical
Copy link
Member Author

radical commented Jun 17, 2025

internal build - https://dev.azure.com/dnceng/internal/_build/results?buildId=2731897&view=results

@radical radical marked this pull request as ready for review June 17, 2025 07:32
@DamianEdwards
Copy link
Member

How big is it

~30 MB

That's compressed. It's actually ~74 MB on disk. This is still WIP right? I thought I saw we got this much smaller than that?

@davidfowl
Copy link
Member

We should merge this infra, aot will make it smaller.

@radical
Copy link
Member Author

radical commented Jun 17, 2025

This is still WIP right?

This PR is ready to go.

@@ -125,6 +125,7 @@
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Workloads" Version="8.0.0-beta.23564.4" />
<PackageVersion Include="Microsoft.Signed.Wix" Version="$(MicrosoftSignedWixVersion)" />
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.23564.4" />
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Archives" Version="8.0.0-beta.23564.4" />
Copy link
Member

Choose a reason for hiding this comment

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

NIT: no need to block you PR on this, but we should probably setup dependency flow for this.

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

:shipit:

<PropertyGroup>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>

<ArchiveName>aspire-cli-$(CliRuntime)</ArchiveName>
Copy link
Member

Choose a reason for hiding this comment

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

I really like how this file ended up looking like :)

Would be great to, in a separate PR, do the same for the dashboardpack project as that one is doing a whole bunch of complex stuff.

<PackageReference Include="Microsoft.DotNet.Build.Tasks.Archives" />
</ItemGroup>

<Target Name="PublishToDisk">
Copy link
Member

Choose a reason for hiding this comment

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

NIT: don't change this now, but might be good to include in your next PR a small comment here saying that the Microsoft.DotNet.Build.Tasks.Archives targets will automatically invoke this target when the project is published so that others in the future understand how this is plugged in.

@joperezr joperezr merged commit 7a1078b into dotnet:main Jun 17, 2025
252 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-cli area-engineering-systems infrastructure helix infra engineering repo stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants