1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-05 15:15:44 +02:00

chore!: improve performance on Kubernetes (#3932)

* chore: test stashBack excludes

* improve logging

* chore!: improve performance on Kubernetes

* update stash pattern

* update test

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
This commit is contained in:
Oliver Nocon 2022-08-15 12:55:51 +02:00 committed by GitHub
parent 11e7b5e137
commit 74cc828221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -236,6 +236,7 @@ steps:
workspace: '**/*'
stashExcludes:
workspace: 'nohup.out'
stashBack: '**/node_modules/**,nohup.out'
dubExecute:
dockerImage: 'dlang2/dmd-ubuntu:latest'
githubPublishRelease:

View File

@ -800,11 +800,11 @@ class DockerExecuteOnKubernetesTest extends BasePiperTest {
bodyExecuted = true
}
assertThat(stashList, hasItem(allOf(
not(hasEntry('allowEmpty', true)),
hasEntry('allowEmpty', true),
hasEntry('includes', 'workspace/include.test'),
hasEntry('excludes', 'workspace/exclude.test'))))
assertThat(stashList, hasItem(allOf(
not(hasEntry('allowEmpty', true)),
hasEntry('allowEmpty', true),
hasEntry('includes', 'container/include.test'),
hasEntry('excludes', 'container/exclude.test'))))
}

View File

@ -379,6 +379,11 @@ chown -R ${runAsUser}:${fsGroup} ."""
def includes, excludes
if (config.verbose) {
echo "stashIncludes config: ${config.stashIncludes}"
echo "stashExcludes config: ${config.stashExcludes}"
}
if (stashBack) {
includes = config.stashIncludes.stashBack ?: config.stashIncludes.workspace
excludes = config.stashExcludes.stashBack ?: config.stashExcludes.workspace
@ -387,6 +392,11 @@ chown -R ${runAsUser}:${fsGroup} ."""
excludes = config.stashExcludes.workspace
}
if (config.verbose) {
echo "stash effective (includes): ${includes}"
echo "stash effective (excludes): ${excludes}"
}
stash(
name: stashName,
includes: includes,
@ -394,6 +404,7 @@ chown -R ${runAsUser}:${fsGroup} ."""
// 'true' by default due to negative side-effects, but can be overwritten via parameters
// (as done by artifactPrepareVersion to preserve the .git folder)
useDefaultExcludes: !config.stashNoDefaultExcludes,
allowEmpty: true
)
return stashName
} catch (AbortException | IOException e) {