From 76118f9bfe7396cb9ce2253eb90ca7907778e486 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Mon, 5 Apr 2021 14:12:21 +0200 Subject: [PATCH] feat: stage execution cache (#24780) * feat: stage execution cache * fix: use correct context * fix: do not check stage status on the first run * fix: proper URL * chore: show message when the stache is skip * fix: correct path * fix: add final / * test: is the path needed? * fix: remove prefix * chore: refactor to use curl to download * chore: use pipeline step # Conflicts: # Jenkinsfile --- Jenkinsfile | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0528c6933a37..bdf23850ba02 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,18 +70,20 @@ pipeline { GOFLAGS = '-mod=readonly' } steps { - withGithubNotify(context: "Lint") { - withBeatsEnv(archive: false, id: "lint") { - dumpVariables() - setEnvVar('VERSION', sh(label: 'Get beat version', script: 'make get-version', returnStdout: true)?.trim()) - whenTrue(env.ONLY_DOCS == 'true') { - cmd(label: "make check", script: "make check") - } - whenTrue(env.ONLY_DOCS == 'false') { - cmd(label: "make check-python", script: "make check-python") - cmd(label: "make check-go", script: "make check-go") - cmd(label: "make notice", script: "make notice") - cmd(label: "Check for changes", script: "make check-no-changes") + stageStatusCache(id: 'Lint'){ + withGithubNotify(context: "Lint") { + withBeatsEnv(archive: false, id: "lint") { + dumpVariables() + setEnvVar('VERSION', sh(label: 'Get beat version', script: 'make get-version', returnStdout: true)?.trim()) + whenTrue(env.ONLY_DOCS == 'true') { + cmd(label: "make check", script: "make check") + } + whenTrue(env.ONLY_DOCS == 'false') { + cmd(label: "make check-python", script: "make check-python") + cmd(label: "make check-go", script: "make check-go") + cmd(label: "make notice", script: "make notice") + cmd(label: "Check for changes", script: "make check-no-changes") + } } } } @@ -730,18 +732,20 @@ class RunCommand extends co.elastic.beats.BeatsFunction { super(args) } public run(Map args = [:]){ - def withModule = args.content.get('withModule', false) - if(args?.content?.containsKey('make')) { - steps.target(context: args.context, command: args.content.make, directory: args.project, label: args.label, withModule: withModule, isMage: false, id: args.id) - } - if(args?.content?.containsKey('mage')) { - steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id) - } - if(args?.content?.containsKey('k8sTest')) { - steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id) - } - if(args?.content?.containsKey('cloud')) { - steps.cloud(context: args.context, command: args.content.cloud, directory: args.project, label: args.label, withModule: withModule, dirs: args.content.dirs, id: args.id) + steps.stageStatusCache(args){ + def withModule = args.content.get('withModule', false) + if(args?.content?.containsKey('make')) { + steps.target(context: args.context, command: args.content.make, directory: args.project, label: args.label, withModule: withModule, isMage: false, id: args.id) + } + if(args?.content?.containsKey('mage')) { + steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id) + } + if(args?.content?.containsKey('k8sTest')) { + steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id) + } + if(args?.content?.containsKey('cloud')) { + steps.cloud(context: args.context, command: args.content.cloud, directory: args.project, label: args.label, withModule: withModule, dirs: args.content.dirs, id: args.id) + } } } }