Repository navigation
Closed
dotnet/installer
#15226Labels
area-infraSource-build infrastructure and reporting
Description
For distributions like Fedora, we use a tarball containing the source code of a project as one of the inputs to the build system. This model was supported in the old arcade-powered-source-build where we could build a source tarball and then build that in the Fedora build system offline.
This doesn't work with the VMR, at least not with the "obvious" approach. Am I using it wrong? Is there another set of steps to do this? Is this something that's still in development?
Steps to Reproduce
$ git clone https://github.com/dotnet/dotnet
$ cd dotnet
$ git rev-parse HEAD
b8bc661a7429baa89070f3bee636b7fbc1309489
$ git archive -o dotnet-$(git rev-parse HEAD).tar.gz --prefix=dotnet-$(git rev-parse HEAD)/ HEAD .
$ cd ..
$ tar xf dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489.tar.gz
$ cd dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489
$ ./prep.sh
$ ./build.sh --online
Determining projects to restore... Restored /home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/tools/Tools.proj (in 137 ms). [SourceBuiltSdkResolver] Looking for SDK Microsoft.NET.Sdk. Detected config(s) in env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/' [SourceBuiltSdkResolver] Looking for SDK Microsoft.DotNet.Arcade.Sdk. Detected config(s) in env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/' [SourceBuiltSdkResolver] Overriding Microsoft.DotNet.Arcade.Sdk with 'ARCADE' [SourceBuiltSdkResolver] Looking for SDK Microsoft.NET.SDK.WorkloadAutoImportPropsLocator. Detected config(s) in env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/' [SourceBuiltSdkResolver] Looking for SDK Microsoft.DotNet.ILCompiler. Detected config(s) in env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/' [SourceBuiltSdkResolver] Looking for SDK Microsoft.NET.ILLink.Tasks. Detected config(s) in env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/' [SourceBuiltSdkResolver] Looking for SDK Microsoft.NET.SDK.WorkloadManifestTargetsLocator. Detected config(s) in
env: 'ARCADE' for 'Microsoft.DotNet.Arcade.Sdk/7.0.0-beta.22462.6' at '/home/omajid/devel/dotnet/dotnet-b8bc661a7429b
aa89070f3bee636b7fbc1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/'
Determining projects to restore...
Restored /home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/src/source-build-reference-
packages/artifacts/source-build/self/src/eng/NoOp.csproj (in 32 ms).
/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/src/source-build-reference-packages/arti
facts/source-build/self/package-cache/microsoft.build.tasks.git/1.2.0-beta-22429-01/build/Microsoft.Build.Tasks.Git.ta
rgets(25,5): error : Unable to locate repository with working directory that contains directory '/home/omajid/devel/do
tnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/src/source-build-reference-packages/artifacts/source-build/self/src/eng'. [/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/src/source-build-reference-package
s/artifacts/source-build/self/src/eng/NoOp.csproj] [/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc
1309489/packages/restored/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/7.0.0-beta.22462.6/tools/Build.proj]
##vso[task.logissue type=error;sourcepath=/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/src/source-build-reference-packages/artifacts/source-build/self/package-cache/microsoft.build.tasks.git/1.2.0-beta-2
2429-01/build/Microsoft.Build.Tasks.Git.targets;linenumber=25;columnnumber=5;code=;]Unable to locate repository with w
orking directory that contains directory '/home/omajid/devel/dotnet/dotnet-b8bc661a7429baa89070f3bee636b7fbc1309489/sr
c/source-build-reference-packages/artifacts/source-build/self/src/eng'. [/home/omajid/devel/dotnet/dotnet-b8bc661a7429
baa89070f3bee636b7fbc1309489/src/source-build-reference-packages/artifacts/source-build/self/src/eng/NoOp.csproj%5D
Other Information
Metadata
Metadata
Assignees
Labels
area-infraSource-build infrastructure and reporting
Type
Projects
- StatusShow more project fieldsDone
Activity
MichaelSimons commentedon Nov 11, 2022
Thanks for the raising this issue @omajid. The VMR is considered experimental at this point. This is something we will have to get addressed prior to Preview 1.
cc @premun
premun commentedon Nov 11, 2022
I presume the
--clean-while-buildingswitch from VMR's instructions is irrelevant (unwanted?) here?MichaelSimons commentedon Nov 11, 2022
The lack of
--clean-while-buildingis irrelevant. This is just a flag that proactively cleans up artifacts while building mainly used to reduce the disk space required to build. It is omitted often if you want to diagnose issues.MichaelSimons commentedon Nov 17, 2022
[Triage] This feels like it is source-link related. We likely need to extract the minimal info needed by source-link. When fixing, please verify that the build still works if the extracted tarball is placed within the context of another git repo.
MichaelSimons commentedon Dec 1, 2022
[Triage] Given the importance of being able to create a tarball from the VMR to our distro maintainer partners, we should also validate this in CI.
crummel commentedon Dec 15, 2022
Here's the sourcleink docs on the minimal Git metadata: https://github.com/dotnet/sourcelink/tree/main/docs#minimal-git-repository-metadata.
premun commentedon Dec 20, 2022
From the sourcelink docs it seems we only need 2 very basic things:
.git/HEADfile with the SHA of the current commit.git/configfile pointing to thedotnet/dotnetrepo (e.g.[remote "origin"] url="http://github.com/dotnet/dotnet")2 remaining items
premun commentedon Jan 9, 2023
Binlog: Build_0109160911.zip
Repro steps:
./eng/pack-sources.shcd artifacts/packagestar xf dotnet-0153aa339cccb301573e1b68b1a8f8b5daa94557.tar.gzcd dotnet-0153aa339cccb301573e1b68b1a8f8b5daa94557chmod +x *.sh./prep.sh./build.sh --clean-while-building --onlinepremun commentedon Jan 9, 2023
Oh, it seems to be happening on the VMR itself as well. Maybe something about my environment..
premun commentedon Jan 9, 2023
Ah, ignore this, it's the missing
unset RepositoryNamepremun commentedon Jan 9, 2023
Weirdly enough,
git archivedoesn't preserve file permissions and the execute goes away on the prep/build scriptsmmitche commentedon Jan 11, 2023
@premun and I looked at this a bit closer. The issue is just that installer is attempting to git operations even though they are not required.
https://github.com/dotnet/dotnet/blob/main/src/installer/src/redist/targets/GenerateMSIs.targets#L73-L77 should only be run if
CombinedBuildNumberAndRevisionis empty before this line: https://github.com/dotnet/dotnet/blob/main/src/installer/src/redist/targets/GenerateMSIs.targets#L88In official builds, we do not ever need to get the git commit count.
premun commentedon Jan 11, 2023
Should we have some workaround for non-official builds? In case people download the sources only?
It seems we wouldn't need the git commit count for this purpose?
Is the build done by partners also going to have properties initialized like it was an official one?
mmitche commentedon Jan 11, 2023
We could just have those users set a property, or use the date.
premun commentedon Jan 11, 2023
I have an idea - should the script, that exports the sources for you, write this property somewhere with the current git commit count of the VMR?
Is there a suitable
.propsfile that would be good for this?We could just add
<GitCommitCount>$(git rev-list --count HEAD)</GitCommitCount>while we have the VMR available when creating the source archivemmitche commentedon Jan 11, 2023
I don't think it's necessary. It's only there for dev builds, and only for MSI generation. I would take a look at Arcade's infra for MSI generation and see what it uses for the same purpose. Maybe we can just use that.
/cc @marcpopMSFT @dsplaisted if they have any insight here.
premun commentedon Jan 12, 2023
I confirm that setting the
GitCommitCountproperty gave me a successful build. Will deal with this in the associated PRdsplaisted commentedon Jan 12, 2023
Briefly looking at how
GitCommitCountis used in dotnet/installer, it looks like we were getting the git information for each repository for the sourcebuild tarball. I'm guessing that doesn't apply to the VMR build.The other use is for creating the MSIs. If we want to be able to create the MSIs from the VMR build then we will need to figure out what to do. @premun's idea of including the git information in the tarball would work. But I think it will be a while before we need to build the MSIs this way from a zipped-up copy of the VMR.
mmitche commentedon Jan 12, 2023
@dsplaisted For non-dev builds of the tarball, it should be fine to simply not have a GitCommitCount.
The source does not use the git commit count except in cases where we are not doing an official build. IIRC the typical build of the tarball/VMR is official. So I think the thing to do here is to sink the git commit count calculation task until we know we have to use it.
premun commentedon Jan 13, 2023
Thanks all, this did the trick:
dotnet/installer@fa708d7
(not calling git it when it's not needed)