CI Setup
December 5, 2017 ยท View on GitHub
Jenkins setup
Example of how to setup Jenkins to install unity automatically on multiple slaves
You might want to do things differently. Here are the decisions we took:
- we install all Unity versions in the same way (i.e. same Unity platform modules for all installs)
- we store the slave root passwords in the Jenkins credentials binding.
- we depend on RVM to be present on the slaves
Prerequisites:
- Install the same version of RVM on all slaves where you will install u3d
- add one root password credential per slave in the jenkins setup. Follow the "U3D_PASSWORD_$SLAVENAME" format

Required plugins:
Set up an install job:
-
create a freestyle job
-
Add a U3D_VERSION string parameter

- Configure the nodes you might want to install on as parameters

- Enable console coloring

- Enable RVM

- Configure the slave passwords

- add an "execute Shell" step
# config. We could make this an option to the job. Or be project specific.
U3D_INSTALL_ARGS=-p Unity,Android,iOS,Linux,Windows,WebGL
# install or update u3d if it isn't already present
if [[ ! `which u3d` ]]; then
gem install u3d
else
gem update u3d
fi
echo "${U3D_INSTALL_ARGS}"
# display whether or not the slave has credentials stored
u3d credentials check
# fetch the password for the slave from the credentials
PASS_KEY=U3D_PASSWORD_${NODE_NAME}
echo "PASS KEY: ${PASS_KEY}"
export U3D_PASSWORD=${!PASS_KEY}
# install the specified version with the specified arguments
u3d install --trace --verbose $U3D_VERSION $U3D_INSTALL_ARGS
u3d list