From 2a7cd278f2be74e8c806bbd1aa27150b441deb4c Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 14 Oct 2020 14:49:20 +0100 Subject: [PATCH] use go mod download and support windows as suggested in the code review --- Jenkinsfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fbd682811c5..b8949b1dad8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -272,16 +272,15 @@ def withBeatsEnv(Map args = [:], Closure body) { git config --global user.email "beatsmachine@users.noreply.github.com" git config --global user.name "beatsmachine" fi''') - + } + try { // Add more stability when dependencies are not accessible temporarily // See https://github.com/elastic/beats/issues/21609 // retry/try/catch approach reports errors, let's avoid it to keep the // notifications cleaner. - if (sh(label: 'Fetch go dependencies', script: 'go get ./...', returnStatus: true) > 0) { - sh(label: 'Fetch go dependencies - retry', script: 'go get ./...', returnStatus: true) + if (cmd(label: 'Download modules to local cache', script: 'go mod download', returnStatus: true) > 0) { + cmd(label: 'Download modules to local cache - retry', script: 'go mod download', returnStatus: true) } - } - try { body() } finally { if (archive) {