Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@csa7mdm
Copy link

@csa7mdm csa7mdm commented Dec 11, 2025

Fixes dotnet/source-build#4427

Technical Analysis

The VMR validation pipeline (vmr-build.yml) was downloading prebuilt artifacts to the default prereqs/packages/archive/ location, which allowed build.sh to pick them up implicitly. This left the explicit --with-packages argument path untested in CI.

Changes

  • Modified eng/pipelines/templates/jobs/vmr-build.yml to download prebuilts to a custom location (prebuilt-packages/).
  • Added logic to pass --with-packages to build.sh when reuseBuildArtifactsFrom is set.
  • This ensures the CustomPreviouslySourceBuiltPackagesPath logic in the build script is exercised and verified.

Verification

  • Validated locally that build.sh accepts the --with-packages argument.
  • Verified the YAML logic constructs the command line correctly.

@csa7mdm csa7mdm requested review from a team as code owners December 11, 2025 11:54
@mthalman
Copy link
Member

There's a script error: /__w/_temp/8a1c070b-caf0-4c1a-9454-6aaa2bb147e2.sh: line 96: syntax error near unexpected token 'fi'

@csa7mdm csa7mdm requested a review from mthalman December 15, 2025 16:06
@mthalman
Copy link
Member

@csa7mdm - I see activity from you of merging but not addressing the build issue. Are you planning on doing that?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request modifies the VMR source-only build pipeline to properly test the --with-packages argument by changing where prebuilt artifacts are downloaded and extracted. Previously, artifacts were downloaded to the default location (prereqs/packages/archive/), allowing build.sh to find them implicitly without exercising the --with-packages code path.

Key Changes:

  • Changed reuseBuildArtifactsFrom parameter type from string to array (object)
  • Modified artifact download destination from default location to a custom temporary directory
  • Added explicit --with-packages argument construction when reusing build artifacts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +662 to +665
if [[ '${{ length(parameters.reuseBuildArtifactsFrom) }}' -gt 0 ]]; then
# Prebuilt packages are extracted in the Prep step
:
fi
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

This empty conditional block serves no purpose and should be removed. The comment indicates that prebuilt packages are extracted in the Prep step, but no action is taken here. If this is meant as a placeholder or documentation, it should either be removed entirely or the logic should be clarified.

Suggested change
if [[ '${{ length(parameters.reuseBuildArtifactsFrom) }}' -gt 0 ]]; then
# Prebuilt packages are extracted in the Prep step
:
fi
# Prebuilt packages are extracted in the Prep step when reusing build artifacts.

Copilot uses AI. Check for mistakes.
tar -oxzf "$artifactsTarball" -C "$(previouslySourceBuiltArtifactsDir)"
customPrepArgs="${customPrepArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
additionalBuildArgs="${additionalBuildArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The 'additionalBuildArgs' variable is being appended to with the '--with-packages' argument, but it already may contain '--with-sdk' from the previous 'if' block (line 594). A leading space should be added when appending to ensure proper separation between arguments. Currently, if both SDK and packages are being reused, the arguments will be concatenated incorrectly.

Copilot uses AI. Check for mistakes.
Comment on lines +567 to +573
# Verify download directory exists
if [ ! -d "$(downloadedArtifactsDir)" ]; then
echo "Error: SDK extraction required but '$(downloadedArtifactsDir)' does not exist."
echo "Checking Pipeline Workspace content:"
ls -R "$(Pipeline.Workspace)" || true
exit 1
fi
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The directory existence check is performed unconditionally when prepSdk is false, but the downloadedArtifactsDir only exists when reuseBuildArtifactsFrom is non-empty. This will cause the script to fail when withPreviousSDK is True but reuseBuildArtifactsFrom is empty, because prepSdk will be false (set at line 549) but no artifacts will have been downloaded to downloadedArtifactsDir. The check should be conditional on whether reuseBuildArtifactsFrom is actually set.

Copilot uses AI. Check for mistakes.
Comment on lines +622 to +623
customPrepArgs="${customPrepArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
additionalBuildArgs="${additionalBuildArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Inconsistent trailing slash handling. The path includes a trailing slash here, but the variable 'previouslySourceBuiltArtifactsDir' is already defined without one (line 221). This creates an unnecessary double-slash in the path. Either remove the trailing slash here, or ensure it's consistently applied.

Suggested change
customPrepArgs="${customPrepArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
additionalBuildArgs="${additionalBuildArgs} --with-packages $(previouslySourceBuiltArtifactsDir)/"
customPrepArgs="${customPrepArgs} --with-packages $(previouslySourceBuiltArtifactsDir)"
additionalBuildArgs="${additionalBuildArgs} --with-packages $(previouslySourceBuiltArtifactsDir)"

Copilot uses AI. Check for mistakes.
echo "Found SDK tarball: $previousSdkPath"
echo "Extracting SDK..."
eval tar -oxzf "$previousSdkPath" -C "$(previouslySourceBuiltSdkDir)"
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Inconsistent tar command flags. Line 591 uses 'tar -oxzf' while line 620 uses 'tar -oxzf' as well. However, line 591 uses 'eval' before the tar command while line 620 doesn't. The 'eval' on line 591 appears unnecessary since there's no shell expansion needed in the command, and its presence is inconsistent with the similar tar command at line 620. Consider removing the 'eval' for consistency.

Suggested change
eval tar -oxzf "$previousSdkPath" -C "$(previouslySourceBuiltSdkDir)"
tar -oxzf "$previousSdkPath" -C "$(previouslySourceBuiltSdkDir)"

Copilot uses AI. Check for mistakes.
if [[ -n "$additionalBuildArgs" ]]; then
echo "##vso[task.setvariable variable=additionalBuildArgs]$additionalBuildArgs"
fi
fi
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

Extra closing 'fi' statement found that doesn't match any opening 'if' statement. This appears to be left over from the old code structure and will cause a shell script syntax error. The 'if' statement that this seems to match was removed in the refactoring (the one that checked 'prepSdk == false'), but its closing was placed after the additionalBuildArgs logic, which is incorrect.

Suggested change
fi

Copilot uses AI. Check for mistakes.
@csa7mdm
Copy link
Author

csa7mdm commented Dec 18, 2025

@copilot open a new pull request to apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update pipeline to specify --packages option for previously source built scenarios

3 participants