aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

[WIP] [Infrastructure] Avoid polluting the repo with changes on builds

Open Copilot opened this issue 5 months ago • 3 comments

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

  • run eng\build.cmd
  • look at the changed files git git status.
  • Add an entry to the .gitignore file with the extension of the untracked files.
  • Add a target that runs after build in Npm.Workspace.nodeproj to discard the changes to any of the package.json files

Fixes #62398.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot avatar Jun 18 '25 19:06 Copilot

@copilot try again

javiercn avatar Jun 18 '25 19:06 javiercn

@copilot one more time

javiercn avatar Jun 18 '25 22:06 javiercn

@copilot third time is the charm?

javiercn avatar Jun 19 '25 09:06 javiercn

@copilot the fix is almost there, the only file that remains modified after running eng\build.cmd is package-lock.json on the repo root. You can probably run git checkout -- package-lock.json with the exec task on the target to undo the changes to it

javiercn avatar Jun 19 '25 11:06 javiercn

@copilot the fix is almost there, the only file that remains modified after running eng\build.cmd is package-lock.json on the repo root. You can probably run git checkout -- package-lock.json wi...

I've added git checkout -- package-lock.json to the RestorePackageJsonFiles target in commit 6ac8b471. The target now restores both the package.json files from their .bak backups and resets package-lock.json to its original state, completely cleaning up the repository after npm build processes.

Copilot avatar Jun 19 '25 11:06 Copilot

EXEC(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Command failed: npm version 10.0.0-ci --no-git-tag-version --allow-same-version

eng/Npm.Workspace.nodeproj(39,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command "node /home/vsts/work/1/s/eng/scripts/npm/pack-workspace.mjs --update-versions /home/vsts/work/1/s/package.json 10.0.0-ci /home/vsts/work/1/s/artifacts/packages/Release/Shipping/ /home/vsts/work/1/s/artifacts/obj/Npm.Workspace/Release/" exited with code 1.

@copilot see if you can modify pack-workspace.mjs script to avoid failing in this situation

javiercn avatar Jun 21 '25 10:06 javiercn

EXEC(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Command failed: npm version 10.0.0-ci --no-git-tag-version --allow-same-version

eng/Npm.Workspace.nodeproj(39,5): error MSB3073: (NETCOR...

I've added error handling to the pack-workspace script in commit bc573fc9. The script now catches npm version command failures and falls back to manual package.json version updates, preventing the build from crashing while still achieving the desired version changes.

Copilot avatar Jun 21 '25 10:06 Copilot