Skip to content

Instantly share code, notes, and snippets.

@mig82
Last active October 20, 2018 00:01
Show Gist options
  • Save mig82/ee33ee670f6efc117bfc5e22bdf1796a to your computer and use it in GitHub Desktop.
Save mig82/ee33ee670f6efc117bfc5e22bdf1796a to your computer and use it in GitHub Desktop.
A bash script to install Android's zipalign in Jenkins as a Global Tool
printf "\nInstalling Android SDK as a Jenkins Custom Tool\n"
printf "WARNING: Remember that to run Android SDK tools you must first add support for 32 bit binaries to your slave -e.g. For AWS Linux \n\t yum install glibc.i686 \n\t yum install libzip.i686 \n\n"
pwd
ls -la
if [ ! -d build-tools ];
then
printf "There's no dir by the name 'build-tools' on this agent yet. Will proceed to install the Android SDK.\n"
printf "Downloading the Android SDK tools for Linux\n"
curl -o android.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
printf "Download successful\n"
printf "Unzipping downloaded Android SDK tools\n"
unzip -o -z android.zip
printf "Done unzipping\n"
printf "Removing downloaded zip file\n"
rm android.zip
printf "Done removing\n"
printf "Installing Android Build Tools 23.0.1\n"
echo "y" | tools/bin/sdkmanager "build-tools;23.0.1"
printf "Done installing Android Build Tools 23.0.1\n"
else
printf "There's already a dir by the name 'build-tools' on this agent. Aborting installation of the Android SDK.\n"
fi
printf "Done installing Android SDK as a Jenkins Custom Tool\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment