[Agent] Bug Fix - Fixed Processor Arch Detection in Windows - AB#2232751 #5049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Installation script of Pipeline Agent reads the
PROCESSOR_ARCHITECTURE
environment variable to determine the processor's make (AMD, Intel, ARM) and OS architecture (32 bit or 64 bit).function detect_platform_and_runtime_id()
Issue
PROCESSOR_ARCHITECTURE
environment variable will be returned as what's most capable when running the external process i.e., the returned value varies depending on which process this environment variable is read from. The installation script of Agent uses Bash to run the dev.sh script when being setup on any Windows machine. Doing this leads to the value always being read as AMD64 - even on 32bit Windows or ARM hardware.Why did our CI pipeline not catch this?
detect_platform_and_runtime_id
function is not involved when running via the CI pipeline as the target architecture is passed as an argument to the setup scripts i.e., thePROCESSOR_ARCHITECTURE
variable is not read to determine the underlying architecture.Who is affected?
Anyone building the Agents on a 32bit Windows or ARM Windows is affected as the build always defaults to x64.
How can this be fixed?
PROCESSOR_IDENTIFIER
variable instead of thePROCESSOR_ARCHITECTURE
to understand the Processor make (Intel, AMD or ARM)uname
command to understand if the OS is 32bit or 64bit.Here are the tested combinations of these variables:
uname -m
How was the fix tested?
PROCESSOR_IDENTIFIER
environment variable value does not change depending on the process it is read from.Layout output on Windows x64
Layout output on Windows ARM64