Skip to content

Instantly share code, notes, and snippets.

@philipwhiuk
Last active December 20, 2019 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipwhiuk/d4ec26bfbbbdca8031c48d48af676752 to your computer and use it in GitHub Desktop.
Save philipwhiuk/d4ec26bfbbbdca8031c48d48af676752 to your computer and use it in GitHub Desktop.
Building Go With Jenkins

Project structure:

/pkg
  /tool
     /main.go
/cmd
  /tool
     /lib
       service.go
       service_test.go
Jenkinsfile

Jenkinsfile

...

def build() {
    stage("Build Tool") {
        container('go') {
sh 'go get github.com/jstemmer/go-junit-report'
sh 'go get tool'  ??
sh 'go test -v tool/... | go-junit-report > report.xml'
sh 'go install tool'
    }
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment