Skip to content

Instantly share code, notes, and snippets.

@cute-angelia
Forked from tmpbook/build.sh
Last active March 4, 2020 05:35
Show Gist options
  • Save cute-angelia/ffd4410d0e7af9971bf839375cb9bfbf to your computer and use it in GitHub Desktop.
Save cute-angelia/ffd4410d0e7af9971bf839375cb9bfbf to your computer and use it in GitHub Desktop.
Jenkins build setup for Go Projects.
# You need install jenkins go plugin first -> https://wiki.jenkins.io/display/JENKINS/Go+Plugin
#!/usr/bin/bash
pwd
export GOPROXY=https://goproxy.io
cd ./ && make proto
export GOROOT=/usr/local/go
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
## only edit svr-class => want
cd $GOPATH/src/$project_name/svr/svr-class && go mod vendor && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment