-
Notifications
You must be signed in to change notification settings - Fork 39
[CI] tear down the workspace #885
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -322,13 +322,14 @@ def generateFunctionalTestStep(Map args = [:]){ | |
| if (isPR() || isUpstreamTrigger(filter: 'PR-')) { | ||
| tags += pullRequestFilter | ||
| } | ||
| def workerLabels = "${platform} && immutable && docker" | ||
|
|
||
| return { | ||
| node("${platform} && immutable && docker") { | ||
| try { | ||
| deleteDir() | ||
| unstash 'source' | ||
| withGoEnv(version: "${GO_VERSION}"){ | ||
| node("${workerLabels}") { | ||
| deleteDir() | ||
| unstash 'source' | ||
| withGoEnv(version: "${GO_VERSION}"){ | ||
| try { | ||
| if(isInstalled(tool: 'docker', flag: '--version')) { | ||
| dockerLogin(secret: "${DOCKER_ELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}") | ||
| } | ||
|
|
@@ -339,12 +340,27 @@ def generateFunctionalTestStep(Map args = [:]){ | |
| } | ||
| } | ||
| } | ||
| } | ||
| } catch(e) { | ||
| error(e.toString()) | ||
| } finally { | ||
| junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/outputs/TEST-*.xml") | ||
| } finally { | ||
| junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/outputs/TEST-*.xml") | ||
| archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/outputs/TEST-*.xml" | ||
| tearDown(labels: workerLabels) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Tear down the setup for the static workers. | ||
| */ | ||
| def tearDown(Map args = [:]){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wdyt about having a specific step in the library for cleaning up Go dependencies?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the build system should be the one ensuring the workspace is in good shape. Then the CI should only caring to delete the workspace if required. Though, it seems There are some questions regarding:
Do you think we just need to raise an issue regarding this improvement?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was/am concerned about having the very same method in different pipelines (Beats and here) and probably in many of the other Go projects that we maintain. I agree that the build system should keep the workspace and dependencies in a good shape, but as you know there is nothing as maven/gradle to do so. Regarding your questions:
|
||
| catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { | ||
| dir("${BASE_DIR}"){ | ||
| sh(label: 'Remove the entire module cache', script: 'go clean -modcache', returnStatus: true) | ||
| } | ||
| if (isStaticWorker(labels: args.labels)) { | ||
| dir("${WORKSPACE}") { | ||
| deleteDir() | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only need the finally, then error is redundant