From 83681f1b76690c57696a39a5840eed9ed79993de Mon Sep 17 00:00:00 2001 From: AshCripps Date: Fri, 18 Oct 2019 13:25:08 +0100 Subject: [PATCH 1/5] ansible: Edit select-compiler.sh to select different versions of xcode --- jenkins/scripts/select-compiler.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) mode change 100644 => 100755 jenkins/scripts/select-compiler.sh diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh old mode 100644 new mode 100755 index 71114ab6d..81595c161 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -13,6 +13,8 @@ # way to do ccache is to push `/path/to/gcc-version` on to the front of PATH, # then push a `/path/to/ccache/wrappers` in front of the compiler path. + + if [ "$DONTSELECT_COMPILER" != "DONT" ]; then NODE_NAME=${NODE_NAME:-$HOSTNAME} echo "Selecting compiler based on $NODE_NAME" @@ -22,14 +24,15 @@ if [ "$DONTSELECT_COMPILER" != "DONT" ]; then *aix* ) SELECT_ARCH=AIXPPC ;; *x64* ) SELECT_ARCH=X64 ;; *arm64* ) SELECT_ARCH=ARM64 ;; + *macos* ) SELECT_ARCH=MACOS ;; esac fi # get node version -if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then - NODE_VERSION="$(python tools/getnodeversion.py)" - NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)" -fi + if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then + NODE_VERSION="$(python tools/getnodeversion.py)" + NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)" + fi if [ "$SELECT_ARCH" = "PPC64LE" ]; then # Set default @@ -154,4 +157,22 @@ elif [ "$SELECT_ARCH" = "ARM64" ]; then ;; esac + elif [ "$SELECT_ARCH" = "MACOS" ]; then + + echo "Setting compiler for Node version $NODEJS_MAJOR_VERSION on macos" + + if [ "$NODEJS_MAJOR_VERSION" -ge "13" ]; then + # set xcode version to latest + sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + echo "set xcode to latest - At least version 10" + elif [ "$NODEJS_MAJOR_VERSION" -ge "12" ]; then + sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + echo "set xcode to latest - at least version 8" + elif [ "$NODEJS_MAJOR_VERSION" -ge "10" ]; then + sudo xcode-select -s /Applications/Xcode8.3.3.app/Contents/Developer + echo "set xcode to at least version 8" + elif [ "$NODEJS_MAJOR_VERSION" -ge "8" ]; then + sudo xcode-select -s /Applications/Xcode8.3.3.app/Contents/Developer + echo "set xcode to at least version 8" + fi fi From 21d4cdb7882dab7924feabec2127efd43ebe60a4 Mon Sep 17 00:00:00 2001 From: AshCripps Date: Fri, 18 Oct 2019 13:34:00 +0100 Subject: [PATCH 2/5] Remove unneeded commented line --- jenkins/scripts/select-compiler.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index 81595c161..7ec06d9bb 100755 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -13,8 +13,6 @@ # way to do ccache is to push `/path/to/gcc-version` on to the front of PATH, # then push a `/path/to/ccache/wrappers` in front of the compiler path. - - if [ "$DONTSELECT_COMPILER" != "DONT" ]; then NODE_NAME=${NODE_NAME:-$HOSTNAME} echo "Selecting compiler based on $NODE_NAME" From eee452c70cd2596bfcbc3a434cf8e7473b1fbb5f Mon Sep 17 00:00:00 2001 From: AshCripps Date: Fri, 18 Oct 2019 13:35:58 +0100 Subject: [PATCH 3/5] clean up whitespace --- jenkins/scripts/select-compiler.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index 7ec06d9bb..ea5ce6b98 100755 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -27,10 +27,10 @@ if [ "$DONTSELECT_COMPILER" != "DONT" ]; then fi # get node version - if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then - NODE_VERSION="$(python tools/getnodeversion.py)" - NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)" - fi +if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then + NODE_VERSION="$(python tools/getnodeversion.py)" + NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)" +fi if [ "$SELECT_ARCH" = "PPC64LE" ]; then # Set default From 81c0518ad8c7d5e81c5245f105d34786d0de65c0 Mon Sep 17 00:00:00 2001 From: AshCripps Date: Mon, 21 Oct 2019 10:44:35 +0100 Subject: [PATCH 4/5] Set node 12 to use version 8 --- jenkins/scripts/select-compiler.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index ea5ce6b98..7c9018ab6 100755 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -164,13 +164,13 @@ elif [ "$SELECT_ARCH" = "ARM64" ]; then sudo xcode-select -s /Applications/Xcode.app/Contents/Developer echo "set xcode to latest - At least version 10" elif [ "$NODEJS_MAJOR_VERSION" -ge "12" ]; then - sudo xcode-select -s /Applications/Xcode.app/Contents/Developer - echo "set xcode to latest - at least version 8" + sudo xcode-select -s /Applications/Xcode8.3.3.app/Contents/Developer + echo "set xcode to version 8" elif [ "$NODEJS_MAJOR_VERSION" -ge "10" ]; then sudo xcode-select -s /Applications/Xcode8.3.3.app/Contents/Developer - echo "set xcode to at least version 8" + echo "set xcode to version 8" elif [ "$NODEJS_MAJOR_VERSION" -ge "8" ]; then sudo xcode-select -s /Applications/Xcode8.3.3.app/Contents/Developer - echo "set xcode to at least version 8" + echo "set xcode to version 8" fi fi From 473007b98a173b63db2d508971cb33bf6a4a9b4f Mon Sep 17 00:00:00 2001 From: AshCripps Date: Tue, 29 Oct 2019 10:54:59 +0000 Subject: [PATCH 5/5] Edit install script to install more xcodes + edit manual steps --- ansible/MANUAL_STEPS.md | 3 +++ .../package-upgrade/files/install-xcode.sh | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ansible/MANUAL_STEPS.md b/ansible/MANUAL_STEPS.md index f2fd8ad32..0dfcc3f40 100644 --- a/ansible/MANUAL_STEPS.md +++ b/ansible/MANUAL_STEPS.md @@ -11,6 +11,9 @@ and change: to `%admin ALL = (ALL) NOPASSWD:ALL` +also add this line to allow the jenkins user to change xcode version +`iojs ALL=(ALL) NOPASSWD: /usr/bin/xcode-select` + 2. Allow ssh access ```bash diff --git a/ansible/roles/package-upgrade/files/install-xcode.sh b/ansible/roles/package-upgrade/files/install-xcode.sh index a84a84e05..a6bb4392a 100755 --- a/ansible/roles/package-upgrade/files/install-xcode.sh +++ b/ansible/roles/package-upgrade/files/install-xcode.sh @@ -6,7 +6,28 @@ osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}') cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress" -# Installing the latest Xcode command line tools on 10.9.x or higher +# Installing xcode for 10.14+ + +if [[ "$osx_vers" -ge 14 ]]; then +wget -P /tmp/ foo.bar/Xcode10.xip #Placeholder URL +xip --expand /tmp/Xcode10.xip +mv /tmp/Xcode.app /Applications/Xcode10.app +fi + +# Installing xcodes for 10.13 + +if [[ "$osx_vers" -ge 13 ]]; then +wget -P /tmp/ foo.bar/Xcode10.xip #Placeholder URL +xip --expand /tmp/Xcode10.xip +mv /tmp/Xcode.app /Applications/Xcode10.app +# Install second xcode +wget -P /tmp/ foo.bar/Xcode8.xip #Placeholder URL +xip --expand /tmp/Xcode8.xip +mv /tmp/Xcode.app /Applications/Xcode8.app +fi + + +# Installing the latest Xcode command line tools on 10.9.x - 10.12.x if [[ "$osx_vers" -ge 9 ]]; then touch "$cmd_line_tools_temp_file";