diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f77cfc433..9b3fb4fa2 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "microsoft.dotnet.darc": { - "version": "1.1.0-beta.23053.1", + "version": "1.1.0-beta.23056.9", "commands": [ "darc" ] diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a05644fde..301994c65 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -205,13 +205,13 @@ https://github.com/dotnet/arcade 5a5ae41c42e475e280342b668e668ff34539e36d - + https://github.com/dotnet/arcade-services - 11dfc0ff33280c18db03a2108673a41ade41fd55 + 2e6a975bf4753c44a1a98f77282e64ea3a0e31ab - + https://github.com/dotnet/arcade-services - 11dfc0ff33280c18db03a2108673a41ade41fd55 + 2e6a975bf4753c44a1a98f77282e64ea3a0e31ab https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 62d549f21..12523e2bf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,7 +30,7 @@ - 1.1.0-beta.23053.1 + 1.1.0-beta.23056.9 diff --git a/eng/pipelines/templates/steps/vmr-pull-updates.yml b/eng/pipelines/templates/steps/vmr-pull-updates.yml index 91ed52df0..a63605b16 100644 --- a/eng/pipelines/templates/steps/vmr-pull-updates.yml +++ b/eng/pipelines/templates/steps/vmr-pull-updates.yml @@ -22,36 +22,17 @@ steps: displayName: Clone dotnet/installer path: installer -- script: | - source ./eng/common/tools.sh - InitializeDotNetCli true - ./.dotnet/dotnet tool restore - displayName: Restore darc - workingDirectory: $(Agent.BuildDirectory)/installer - - script: | git checkout -B ${{ parameters.vmrBranch }} echo "##vso[task.setvariable variable=vmrBranch]${{ parameters.vmrBranch }}" displayName: Prepare branch ${{ parameters.vmrBranch }} workingDirectory: ${{ parameters.vmrPath }} -# This step make sure that darc finds the PR commit (which might be in a fork of installer) -# The cloned folder does have the commit so we copy it into temp where the tooling will find it -# We also cannot keep the AzDO remote as pulling from it would require a token -- script: | - cp -r $(Agent.BuildDirectory)/installer $(Agent.TempDirectory)/03298978DFFFCD23 - cd $(Agent.TempDirectory)/03298978DFFFCD23 - git remote remove origin - git remote add origin https://github.com/dotnet/installer - displayName: Prepare dotnet/installer clone - - script: > - $(Agent.BuildDirectory)/installer/.dotnet/dotnet darc vmr update + ./eng/vmr-sync.sh --vmr ${{ parameters.vmrPath }} --tmp $(Agent.TempDirectory) - --github-pat $(BotAccount-dotnet-bot-repo-PAT) - --recursive - --verbose - installer:${{ parameters.targetRef }} + --branch ${{ parameters.vmrBranch }} + --target-ref ${{ parameters.targetRef }} displayName: Synchronize dotnet/dotnet workingDirectory: $(Agent.BuildDirectory)/installer diff --git a/eng/vmr-sync.sh b/eng/vmr-sync.sh index 16f302215..aa747f7a0 100755 --- a/eng/vmr-sync.sh +++ b/eng/vmr-sync.sh @@ -1,7 +1,10 @@ #!/bin/bash -### This script helps to reproduce potential failures of the 'Synchronize dotnet/dotnet' -### build step from the **VMR Source-Build** job locally. +### This script is used for synchronizing the dotnet/dotnet repository locally +### It is used during CI to ingest new code based on dotnet/installer +### I can also help for reproducing potential failures during installer's PRs, +### namely during errors during the 'Synchronize dotnet/dotnet' build step from +### the 'VMR Source-Build'. ### The following scenario is assumed: ### - There is a PR in dotnet/installer ### - The PR is failing on the 'VMR Source-Build' job in the 'Synchronize dotnet/dotnet' step @@ -44,6 +47,9 @@ ### -b, --branch, --vmr-branch BRANCH_NAME ### Optional. Branch of the 'dotnet/dotnet' repo to synchronize to ### This should match the target branch of the PR, defaults to 'main' +### --target-ref GIT_REF +### Optional. Git ref to synchronize to. This can be a specific commit, branch, tag.. +### Defaults to the revision of the parent installer repo ### --debug ### Optional. Turns on the most verbose logging for the VMR tooling @@ -81,9 +87,8 @@ installer_dir="$scriptroot/../" tmp_dir='' vmr_dir='' vmr_branch='main' +target_ref='' verbosity=verbose -# hashed name coming from the VMR tooling -INSTALLER_TMP_DIR_NAME='03298978DFFFCD23' while [[ $# -gt 0 ]]; do opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" @@ -103,6 +108,10 @@ while [[ $# -gt 0 ]]; do -d|--debug) verbosity=debug ;; + --target-ref) + target_ref=$2 + shift + ;; -h|--help) print_help exit 0 @@ -135,6 +144,10 @@ if [[ ! -d "$tmp_dir" ]]; then mkdir -p "$tmp_dir" fi +if [[ "$verbosity" == "debug" ]]; then + set -x +fi + if [[ ! -d "$vmr_dir" ]]; then highlight "Cloning 'dotnet/dotnet' into $vmr_dir.." git clone https://github.com/dotnet/dotnet "$vmr_dir" @@ -151,12 +164,6 @@ fi set -e -# These lines makes sure the temp dir (which the tooling would clone) -# has the synchronized commit inside as well -highlight 'Preparing the temporary directory..' -rm -rf "${tmp_dir:?}/$INSTALLER_TMP_DIR_NAME" -git clone "$installer_dir" "${tmp_dir:?}/$INSTALLER_TMP_DIR_NAME" - # Prepare darc highlight 'Installing .NET, preparing the tooling..' source "$scriptroot/common/tools.sh" @@ -165,15 +172,22 @@ dotnet="$scriptroot/../.dotnet/dotnet" "$dotnet" tool restore # Run the sync -target_sha=$(git -C "$installer_dir" rev-parse HEAD) -highlight "Starting the synchronization to $target_sha.." +if [[ -z "$target_ref" ]]; then + target_ref=$(git -C "$installer_dir" rev-parse HEAD) +fi + +highlight "Starting the synchronization to '$target_ref'.." set +e -if "$dotnet" darc vmr update --vmr "$vmr_dir" --tmp "$tmp_dir" --$verbosity --recursive installer:$target_sha; then +# Temporary workaround while we fix fetching commits +rm -rf "$tmp_dir/installer" +cp -r "$installer_dir" "$tmp_dir/installer" + +if "$dotnet" darc vmr update --vmr "$vmr_dir" --tmp "$tmp_dir" --$verbosity --recursive --additional-remotes "installer:$installer_dir" "installer:$target_ref"; then highlight "Synchronization succeeded" else - fail "Synchronization of dotnet/dotnet to $target_sha failed!" - fail "$vmr_dir is left in its last state (re-run of this script will reset it)." + fail "Synchronization of dotnet/dotnet to '$target_ref' failed!" + fail "'$vmr_dir' is left in its last state (re-run of this script will reset it)." fail "Please inspect the logs which contain path to the failing patch file (use --debug to get all the details)." fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script." exit 1 diff --git a/src/VirtualMonoRepo/InitializeVMR.proj b/src/VirtualMonoRepo/InitializeVMR.proj index b534c897a..781d32d0e 100644 --- a/src/VirtualMonoRepo/InitializeVMR.proj +++ b/src/VirtualMonoRepo/InitializeVMR.proj @@ -7,16 +7,6 @@ $([MSBuild]::EnsureTrailingSlash('$(VmrDir)')) $(ArtifactsDir)tmp/ main - - - $(VmrDir) - true - - - - - $(TarballGitInfoDir) - $(TarballSourceDir) @@ -36,14 +26,11 @@ - - - - + @@ -68,7 +55,8 @@ PackageVersion="8.0.100" Recursive="true" VmrPath="$(VmrDir)" - TmpPath="$(TmpDir)" /> + TmpPath="$(TmpDir)" + SourceMappingsPath="$(MSBuildThisFileDirectory)/source-mappings.json" /> diff --git a/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs b/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs index 307ee8ecc..c8c614620 100644 --- a/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs +++ b/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Framework; +using Microsoft.DotNet.DarcLib.Helpers; using Microsoft.DotNet.DarcLib.VirtualMonoRepo; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -26,6 +27,9 @@ public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask [Required] public string Repository { get; set; } + [Required] + public string SourceMappingsPath { get; set; } + [Required] public string VmrPath { get; set; } @@ -51,7 +55,14 @@ public class VirtualMonoRepo_Initialize : Build.Utilities.Task, ICancelableTask TmpPath = Path.GetFullPath(TmpPath); var vmrInitializer = _serviceProvider.Value.GetRequiredService(); - await vmrInitializer.InitializeRepository(Repository, Revision, PackageVersion, Recursive, _cancellationToken.Token); + await vmrInitializer.InitializeRepository( + Repository, + Revision, + PackageVersion, + Recursive, + new NativePath(SourceMappingsPath), + Array.Empty(), + _cancellationToken.Token); return true; } diff --git a/src/VirtualMonoRepo/source-mappings.json b/src/VirtualMonoRepo/source-mappings.json index 6f81eabc2..006b53c47 100644 --- a/src/VirtualMonoRepo/source-mappings.json +++ b/src/VirtualMonoRepo/source-mappings.json @@ -12,6 +12,8 @@ // These patches are applied on top of the code synchronized into the VMR "patchesPath": "src/installer/src/SourceBuild/patches", + "sourceMappingsPath": "src/installer/src/VirtualMonoRepo/source-mappings.json", + // Some files are copied outside of the src/ directory into other locations // When files in the source paths are changed, they are automatically synchronized too "additionalMappings": [ @@ -22,6 +24,10 @@ { "source": "src/installer/eng/common", "destination": "eng/common" + }, + { + "source": "src/installer/src/VirtualMonoRepo/source-mappings.json", + "destination": "src" } ],