aspnetcore
aspnetcore copied to clipboard
[WIP] [Infrastructure] Avoid polluting the repo with changes on builds
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 try again
@copilot one more time
@copilot third time is the charm?
@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
@copilot the fix is almost there, the only file that remains modified after running
eng\build.cmdispackage-lock.jsonon the repo root. You can probably rungit checkout -- package-lock.jsonwi...
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.
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
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.