Skip to content

Conversation

@wtgodbe
Copy link
Member

@wtgodbe wtgodbe commented Dec 23, 2020

Migrates our TeamCity build infrastructure for release/2.1 official builds to Azure DevOps.

Notes:

  • Pipebuild PR to point the new definition: here
  • Pipebuild PR I'll need to merge once I'm done testing end-to-end builds: here
  • Aspnet/Buildtools PR to allow customization of inputs to the SignFiles target: here, here
  • I removed usage of the aspnet-internal-tools repo entirely, opting instead to use microbuild to do signing at the end of the Windows-SharedFx job (instead of a separate code signing job that checked out and built aspnet-internal-tools)
  • Green test build ran in isolation: here
  • Test build with pipebuild inputs, still running: here

Also called out some relevant things in comments on the file changes, and I still have some general cleanup to do, so this is still a WIP.

CC @Pilchie

@wtgodbe wtgodbe requested review from a team, JunTaoLuo, dougbu and mmitche December 23, 2020 18:05
inputs:
artifactName: artifacts-Windows-Installers
downloadPath: $(Build.StagingDirectory)/downloaded_artifacts/
- task: CopyFiles@2
Copy link
Member Author

Choose a reason for hiding this comment

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

This giant block of CopyFile tasks is really ugly, but I couldn't get it to work with fewer - @riarenas @mmitche is there a cleaner way to copy all of the inputs without doing them one-by-one?

<CharacterSet>Unicode</CharacterSet>
<OutDir>bin\$(Configuration)\$(PlatformShortname)\</OutDir>
<IntDir>obj\$(Configuration)\$(PlatformShortname)\</IntDir>
<OutDir Condition=" '$(OutDir)' == '' ">bin\$(Configuration)\$(PlatformShortname)\</OutDir>
Copy link
Member Author

@wtgodbe wtgodbe Dec 23, 2020

Choose a reason for hiding this comment

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

@JunTaoLuo @dougbu do you remember why we need this setting here at all? This file is imported very late, and up until this moment outdir points to bin\Release\Installers. Installer signing fails without this change because the files to sign must be in outdir, and this setting changes where outdir points to. My change didn't affect where installers got built to, but I'm wondering if I'm missing something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @jkotalik knows something about this? Looks like the change was added in 8356baf but that commit is huge.


<PropertyGroup>
<Version>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion).$(BuildNumber)</Version>
<!-- Ugly hack - Wix doesn't accept build numbers larger than 65535, and AzDo's BuildIds are larger than that.
Copy link
Member Author

Choose a reason for hiding this comment

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

This hack kinda sucks, but I couldn't think of anything better - @joeloff @dougbu @JunTaoLuo any ideas?

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 in TC the build number was literally just a counter. If BuildNumber is used for MSIs, then it doesn't really matter that much because Windows Installer only cares about the first 3 parts. For standalone bundles (EXEs), the 4 part version is considered when evaluating upgrades so having an increasing number is desired.

Are the AzDo numbers incremental as well? Unless it hits something large, e.g. 262140 and the modulus wraps, I guess this would be fine.

Copy link
Member Author

@wtgodbe wtgodbe Dec 23, 2020

Choose a reason for hiding this comment

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

Yeah, AzDO numbers are also incremental. We feed the version into GuidInputs as of #27079. Since the max for any part of the 4-part version is 65535, we'd run into possible issues as soon as any build number got higher than that - it just might happen sooner in AzDO since builds are more frequent there than in TeamCity. But theoretically, the odds of a collision should be the same as the previous odds of an overflow

Copy link
Member Author

Choose a reason for hiding this comment

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

And we'll always be incrementing the 3rd part of the 4-part version anyways (each patch)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is probably the best we can do for now but I'm a little concerned about the modulo logic since it can eventually silently cause issues. Instead of modulo maybe just use subtraction and error out if our build numbers are too large so we would be notified and figure something else out at that time? Though I don't know if that will ever happen, I feel it's safer since it'll fail loudly.

Copy link
Member Author

@wtgodbe wtgodbe Dec 30, 2020

Choose a reason for hiding this comment

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

I think the only risk is if we produce two versions that are exactly the same, which would happen if 2 builds of the same patch were exactly 34,172 AzDO builds apart (which seems unlikely). I believe 2.1.25.1 would still be considered "higher" than 2.1.24.65535 by WiX - @joeloff does that sound right? That is, it isn't strictly an issue if the buildNumbers aren't always increasing?

Copy link
Member Author

Choose a reason for hiding this comment

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

This would be an issue if we were producing previews of this branch, because there wouldn't be a guarantee that the versions would always be increasing (e.g. preview1's BuildNumber could be higher than preview2's, and they'd have the same patch number)

@Pilchie
Copy link
Member

Pilchie commented Dec 23, 2020

Not going to claim I'm capable of reviewing this, but very happy to see it.

@Pilchie Pilchie added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Dec 26, 2020
Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

Could you explain why the run.* scripts and build.ps1 needed to change❔

Separately, can we now delete .azure/pipelines/pr-validation-temp.ymlvalidation-temp.yml)❔

@wtgodbe
Copy link
Member Author

wtgodbe commented Dec 28, 2020

Could you explain why the run.* scripts and build.ps1 needed to change?

I was duplicating what we have in extensions where we read PB_ vars from the environment: https://github.com/dotnet/extensions/blob/3a9ef3fa2c14721f1803f7c89d82384438358330/build.ps1#L208-L216. However, this doesn't work for PB_ vars which the pipeline defines as secrets, so I have another commit I'm testing now that goes back to having those vars be passed in from the command line. I'll have to do the same for extensions - it turns out that in that repo, we haven't been restoring from PB_AdditionalRestoreSources or importing PB_PackageVersionProps at all, since those variables are secrets and therefore don't actually get read from the environment.

As for installers\build.ps1, we don't know the full package version at queue time any more (teamCity did have that information at queue time), so we can't pass it in to build.ps1 - so I moved that logic to the .proj file that gets built by the powershell script.

@wtgodbe
Copy link
Member Author

wtgodbe commented Dec 29, 2020

This seems to be working now. Here's a build that was kicked by pipebuild: https://dnceng.visualstudio.com/internal/_build/results?buildId=933230&view=results

It pushed assets to this blob location, which looks the same as previous aspnetcore 2.1 blobs:
https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20201223-10/aspnet/index.json

@wtgodbe wtgodbe marked this pull request as ready for review December 29, 2020 00:46
@dougbu
Copy link
Contributor

dougbu commented Dec 29, 2020

However, this doesn't work for PB_ vars which the pipeline defines as secrets, so I have another commit I'm testing now that goes back to having those vars be passed in from the command line.

This isn't completely necessary. Adding env: settings in the YAML file, copying the secrets, would be more secure. (AzDO sometimes messes up masking secrets when logging command lines.)

@wtgodbe
Copy link
Member Author

wtgodbe commented Dec 29, 2020

This isn't completely necessary. Adding env: settings in the YAML file, copying the secrets, would be more secure. (AzDO sometimes messes up masking secrets when logging command lines.)

Oh, I didn't know that was more secure. I'll give that a try now.

@wtgodbe
Copy link
Member Author

wtgodbe commented Dec 29, 2020

@wtgodbe
Copy link
Member Author

wtgodbe commented Dec 29, 2020

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

First batch of comments

BuildScriptArgs: ${{ parameters.buildArgs }}
BuildConfiguration: ${{ parameters.configuration }}
BuildDirectory: ${{ parameters.buildDirectory }}
TeamName: AspNetCore
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we want to start capturing binlogs all the time? Wouldn't this use up a lot of storage?

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 didn't think it was too impactful for 2.1 since we rarely build that branch - but, I could turn it off for public builds like we do in other branches

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

2nd batch

<CharacterSet>Unicode</CharacterSet>
<OutDir>bin\$(Configuration)\$(PlatformShortname)\</OutDir>
<IntDir>obj\$(Configuration)\$(PlatformShortname)\</IntDir>
<OutDir Condition=" '$(OutDir)' == '' ">bin\$(Configuration)\$(PlatformShortname)\</OutDir>
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @jkotalik knows something about this? Looks like the change was added in 8356baf but that commit is huge.


<PropertyGroup>
<Version>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion).$(BuildNumber)</Version>
<!-- Ugly hack - Wix doesn't accept build numbers larger than 65535, and AzDo's BuildIds are larger than that.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is probably the best we can do for now but I'm a little concerned about the modulo logic since it can eventually silently cause issues. Instead of modulo maybe just use subtraction and error out if our build numbers are too large so we would be notified and figure something else out at that time? Though I don't know if that will ever happen, I feel it's safer since it'll fail loudly.

<FilesToExcludeFromSigning Remove="@(FilesToExcludeFromSigning)" />

<!-- Make sure 3rd party binaries get 3rd party certificate -->
<CustomFileSignInfo Include="MsgPack.dll" CertificateName="3PartySHA2" />
Copy link
Contributor

Choose a reason for hiding this comment

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

How was this list generated? I just want to double check but it looks fine.

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 manually looked at the contents of all of the .nupkg's/.zips that we're signing, and cross-referenced with what's in master: https://github.com/dotnet/aspnetcore/blob/master/eng/Signing.props

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

Last batch, so far so good.

@wtgodbe wtgodbe merged commit 0b598a9 into release/2.1 Jan 12, 2021
@wtgodbe wtgodbe deleted the wtgodbe/21Pipeline branch January 12, 2021 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants