Build Go with Jenkins from Bitbucket
Push the built binary file to the repository isn’t an efficient way, so we need to make Jenkins handle that. This post shows the simple steps to build Golang using Jenkins from Bitbucket.

Here simple snippet Golang that only print a statement:

Configure Jenkins settings on Your Repo

then enable it :)
Install and Configure Go Plugin in Jenkins
Manage Jenkins -> Manage Plugins -> Available -> Go Plugin -> Install

Manage Jenkins -> Global Tool Configuration -> Add Go

then apply -> save :)
Create Job on Jenkins

then ok :)
don’t forget to add access key to you repo



In build, the first command is to download all dependencies before building (Go packages). Second command, to enter the folder (directory) that include the main.go. The final command is to build the Go app.

apply and save your changes.
Now when you create pull request on Bitbucket then merge it to the master, the Jenkins job will detect that then will build the Go app.
I hope you learning from this post!