feat: hermetic build OS detection#1988
Conversation
|
Mismatch in |
| detect_OS() { | ||
| if [[ "${OSTYPE}" == "linux-gnu"* ]] || [[ "${OSTYPE}" == "freebsd"* ]]; then | ||
| os_architecture="linux-x86_64" | ||
| elif [[ "${OSTYPE}" == "darwin"* ]]; then |
There was a problem hiding this comment.
What about osx-aarm_64?
I think you can use uname -sm to detect OS type and CPU architecture, but I'm not sure whether windows can run this command.
There was a problem hiding this comment.
I defaulted to win32 regardless of architecture and changed it to uname -m to detect the architecture only, while keeping reliance on ${OSTYPE}
| } | ||
|
|
||
| detect_os_architecture() { | ||
| case "${OSTYPE}" in |
There was a problem hiding this comment.
where does OSTYPE come from?
| os_architecture="linux-$(uname -m)" | ||
| ;; | ||
| "darwin"*) | ||
| os_architecture="osx-$(uname -m)" |
There was a problem hiding this comment.
When I run uname -m on my machine, the output is arm64.
However, the right os architecture should be osx-aarch_64.
You can reference the os architecture here
I also implemented a os architecture detection function:
get_os_architecture() {
local os_type
local os_architecture
os_type=$(uname -sm)
case "${os_type}" in
*"Linux x86_64"*)
os_architecture="linux-x86_64"
;;
*"Darwin x86_64"*)
os_architecture="osx-x86_64"
;;
*)
os_architecture="osx-aarch_64"
;;
esac
echo "${os_architecture}"
}
There was a problem hiding this comment.
ah, thanks for the function :) I couldn't confirm for the aarch64 case since I don't have such machine, but I switched the detection function to this one
uses function by Joe Wang
|
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! |
|
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! |
|
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed! |








Adds OS detection to
generate_library.shManual input from workflow matrix is removed in favor of automatic detection