Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Agent] Bug Fix - Fixed Processor Arch Detection in Windows - AB#2232751 #5049

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

AdityaMankal-MS
Copy link
Contributor

@AdityaMankal-MS AdityaMankal-MS commented Nov 25, 2024

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.

image

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., the PROCESSOR_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?

  • Rely on the PROCESSOR_IDENTIFIER variable instead of the PROCESSOR_ARCHITECTURE to understand the Processor make (Intel, AMD or ARM)
  • Rely on the uname command to understand if the OS is 32bit or 64bit.

Here are the tested combinations of these variables:

CPU Arch OS PROCESSOR_IDENTIFIER uname -m
Intel 64 Windows 64 Intel64 Family 6 Model 140 Stepping 1, GenuineIntel x86_64
AMD 64 Windows 64 AMD64 Family 25 Model 1 Stepping 1, AuthenticAMD x86_64
ARM 64 Windows ARM ARMv8 (64-bit) Family 8 Model D0C Revision 301, Ampere(R) x86_64

How was the fix tested?

  • PROCESSOR_IDENTIFIER environment variable value does not change depending on the process it is read from.
    image

Layout output on Windows x64

Win x64

Layout output on Windows ARM64

Win ARM 64

@AdityaMankal-MS AdityaMankal-MS marked this pull request as ready for review November 25, 2024 07:51
@AdityaMankal-MS AdityaMankal-MS requested review from a team as code owners November 25, 2024 07:51
@AdityaMankal-MS AdityaMankal-MS marked this pull request as draft November 25, 2024 10:26
@AdityaMankal-MS AdityaMankal-MS force-pushed the user/adityamankal/process_arch_var_fix branch from 363bb76 to 2190f93 Compare November 26, 2024 05:17
@AdityaMankal-MS AdityaMankal-MS marked this pull request as ready for review November 26, 2024 05:17
@AdityaMankal-MS AdityaMankal-MS merged commit b88ed00 into master Nov 26, 2024
22 checks passed
@AdityaMankal-MS AdityaMankal-MS deleted the user/adityamankal/process_arch_var_fix branch November 26, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants