Skip to content

Commit aa0b97c

Browse files
committed
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
1 parent 2b60aa7 commit aa0b97c

1 file changed

Lines changed: 44 additions & 40 deletions

File tree

Jenkinsfile

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ pipeline {
7272
GOFLAGS = '-mod=readonly'
7373
}
7474
steps {
75-
withGithubNotify(context: "Lint") {
76-
withBeatsEnv(archive: false, id: "lint") {
77-
dumpVariables()
78-
setEnvVar('VERSION', sh(label: 'Get beat version', script: 'make get-version', returnStdout: true)?.trim())
79-
whenTrue(env.ONLY_DOCS == 'true') {
80-
cmd(label: "make check", script: "make check")
81-
}
82-
whenTrue(env.ONLY_DOCS == 'false') {
83-
cmd(label: "make check-python", script: "make check-python")
84-
cmd(label: "make check-go", script: "make check-go")
85-
cmd(label: "make notice", script: "make notice")
86-
cmd(label: "Check for changes", script: "make check-no-changes")
75+
stageStatusCache(id: 'Lint'){
76+
withGithubNotify(context: "Lint") {
77+
withBeatsEnv(archive: false, id: "lint") {
78+
dumpVariables()
79+
setEnvVar('VERSION', sh(label: 'Get beat version', script: 'make get-version', returnStdout: true)?.trim())
80+
whenTrue(env.ONLY_DOCS == 'true') {
81+
cmd(label: "make check", script: "make check")
82+
}
83+
whenTrue(env.ONLY_DOCS == 'false') {
84+
cmd(label: "make check-python", script: "make check-python")
85+
cmd(label: "make check-go", script: "make check-go")
86+
cmd(label: "make notice", script: "make notice")
87+
cmd(label: "Check for changes", script: "make check-no-changes")
88+
}
8789
}
8890
}
8991
}
@@ -957,40 +959,42 @@ class RunCommand extends co.elastic.beats.BeatsFunction {
957959
super(args)
958960
}
959961
public run(Map args = [:]){
960-
def withModule = args.content.get('withModule', false)
961-
if(args?.content?.containsKey('make')) {
962-
steps.target(context: args.context, command: args.content.make, directory: args.project, label: args.label, withModule: withModule, isMage: false, id: args.id)
963-
}
964-
if(args?.content?.containsKey('mage')) {
965-
steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id)
966-
}
967-
if(args?.content?.containsKey('packaging-arm')) {
968-
steps.packagingArm(context: args.context,
969-
command: args.content.get('packaging-arm'),
970-
directory: args.project,
971-
label: args.label,
972-
isMage: true,
973-
id: args.id,
974-
e2e: args.content.get('e2e'),
975-
package: true,
976-
dockerArch: 'arm64')
977-
}
978-
if(args?.content?.containsKey('packaging-linux')) {
979-
steps.packagingLinux(context: args.context,
980-
command: args.content.get('packaging-linux'),
962+
steps.stageStatusCache(args){
963+
def withModule = args.content.get('withModule', false)
964+
if(args?.content?.containsKey('make')) {
965+
steps.target(context: args.context, command: args.content.make, directory: args.project, label: args.label, withModule: withModule, isMage: false, id: args.id)
966+
}
967+
if(args?.content?.containsKey('mage')) {
968+
steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id)
969+
}
970+
if(args?.content?.containsKey('packaging-arm')) {
971+
steps.packagingArm(context: args.context,
972+
command: args.content.get('packaging-arm'),
981973
directory: args.project,
982974
label: args.label,
983975
isMage: true,
984976
id: args.id,
985977
e2e: args.content.get('e2e'),
986978
package: true,
987-
dockerArch: 'amd64')
988-
}
989-
if(args?.content?.containsKey('k8sTest')) {
990-
steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id)
991-
}
992-
if(args?.content?.containsKey('cloud')) {
993-
steps.cloud(context: args.context, command: args.content.cloud, directory: args.project, label: args.label, withModule: withModule, dirs: args.content.dirs, id: args.id)
979+
dockerArch: 'arm64')
980+
}
981+
if(args?.content?.containsKey('packaging-linux')) {
982+
steps.packagingLinux(context: args.context,
983+
command: args.content.get('packaging-linux'),
984+
directory: args.project,
985+
label: args.label,
986+
isMage: true,
987+
id: args.id,
988+
e2e: args.content.get('e2e'),
989+
package: true,
990+
dockerArch: 'amd64')
991+
}
992+
if(args?.content?.containsKey('k8sTest')) {
993+
steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id)
994+
}
995+
if(args?.content?.containsKey('cloud')) {
996+
steps.cloud(context: args.context, command: args.content.cloud, directory: args.project, label: args.label, withModule: withModule, dirs: args.content.dirs, id: args.id)
997+
}
994998
}
995999
}
9961000
}

0 commit comments

Comments
 (0)