ci: auto-detect the OS instead of relying on NODE_LABELS
And remove WAF_JOBS: waf already defaults to the number of available
CPUs, which is appropriate in most cases, and we can always use the
built-in JOBS variable to override it where necessary.
Change-Id: Id132b9ef8467a563694222ccc64a676cdc076e17
diff --git a/.jenkins b/.jenkins
index a9abf6d..ee16e29 100755
--- a/.jenkins
+++ b/.jenkins
@@ -1,14 +1,30 @@
#!/usr/bin/env bash
-set -e
-source .jenkins.d/util.sh
+set -eo pipefail
-if has Linux $NODE_LABELS; then
- export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
-elif [[ -x /opt/homebrew/bin/brew ]]; then
- eval "$(/opt/homebrew/bin/brew shellenv)"
-fi
+case $(uname) in
+ Linux)
+ if [[ -e /etc/os-release ]]; then
+ source /etc/os-release
+ else
+ source /usr/lib/os-release
+ fi
+ export ID VERSION_ID
+ export ID_LIKE="${ID} ${ID_LIKE} linux"
+ export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
+ ;;
+ Darwin)
+ # Emulate a subset of os-release(5)
+ export ID=macos
+ export VERSION_ID=$(sw_vers -productVersion)
+ if [[ -x /opt/homebrew/bin/brew ]]; then
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+ elif [[ -x /usr/local/bin/brew ]]; then
+ eval "$(/usr/local/bin/brew shellenv)"
+ fi
+ ;;
+esac
+
export CACHE_DIR=${CACHE_DIR:-/tmp}
-export WAF_JOBS=${WAF_JOBS:-1}
[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
for file in .jenkins.d/*; do