Created
July 25, 2018 03:42
-
-
Save tmpbook/2907088597892497b98874acc134156d to your computer and use it in GitHub Desktop.
Jenkins build setup for Go Projects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need install jenkins go plugin first -> https://wiki.jenkins.io/display/JENKINS/Go+Plugin | |
#!/usr/bin/bash | |
export GOPATH=$WORKSPACE | |
mkdir -p $GOPATH/src | |
project_name=$(echo $GIT_URL | awk -F/ '{print $NF}' | sed 's/.git//g') | |
echo ${project_name} | |
ln -f -s $WORKSPACE $GOPATH/src/$project_name | |
go get $project_name | |
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $project_name $project_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment