1 - Go to Jenkins administration and install the last version of Custom Tools Plugin
2 - Then, go to Configure System and click on Custom tool installations button and Add Installer
3 - Fill it with the following configuration (you can use the latest go version)
5 - Copy/paste the following script in command area
#!/bin/sh set -e GO_VERSION=1.3.3 GO_DIR=${HOME}/tools/go/${GO_VERSION} GO_TARGZ=go${GO_VERSION}.linux-amd64.tar.gz mkdir -p "${GO_DIR}" # we'll use go too... export PATH=${GO_DIR}/bin:${PATH} export GOROOT=${GO_DIR} ################################################# # Check & install Golang ################################################# if [ -x "${GO_DIR}"/bin/go ] ; then echo "Go ${GO_VERSION} already installed" else # cleanup incomplete installation [ -e "${GO_TARGZ}" ] && rm -f "${GO_TARGZ}" [ -e "${GO_DIR}" ] && rm -rf "${GO_DIR}" # wget the binary archive wget https://storage.googleapis.com/golang/${GO_TARGZ} # untar in $GO_DIR mkdir -p "${GO_DIR}" tar -xvz -C "${GO_DIR}" --strip-components=1 -f "${GO_TARGZ}" fi6 - Go to your project configuration, tick Install custom tools checkbox in Build Environment and select your installed tool as followed.
Then all you have to do is use your go commands with an Execute Shell!
Aucun commentaire:
Enregistrer un commentaire
Un avis ? Une question ?
N'hésitez pas à laissez des commentaires !