From d2513627763c4c6541c71a7b7839b7e082368ec8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 30 Mar 2021 21:11:42 -0400 Subject: [PATCH] Make it so Jenkins can actually build --- Jenkinsfile | 56 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aaf5688..9ab7943 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,33 @@ pipeline { - agent { - docker { - image 'golang:latest' - args '--privileged' - } - } - environment { - GO114MODULE = 'on' - CGO_ENABLED = 0 - GOPATH = "${JENKINS_HOME}/workspace/${JOB_NAME}/builds/${BUILD_ID}" - } - stages { - stage('Build') { - steps { - sh "go build" - } - } - stage('Test') { - steps { - sh "go test ./... -v" - } - } - } - } \ No newline at end of file + agent any + tools { + go 'go1.16' + } + environment { + GO114MODULE = 'on' + CGO_ENABLED = 0 + GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}" + } + stages { + stage('Pre Test') { + steps { + echo 'Installing dependencies' + sh 'go version' + sh 'go get -u golang.org/x/lint/golint' + } + } + + stage('Build') { + steps { + echo 'Compiling and building' + sh 'go build' + } + } + + stage('Test') { + steps { + sh "go test ./... -v" + } + } + } +} \ No newline at end of file