Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add resilience when ephemeral windows workers are reused #24316

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,10 @@ def target(Map args = [:]) {
*/
def withNode(String label, Closure body) {
sleep randomNumber(min: 10, max: 200)
// this should workaround the existing issue with reusing workers with the Gobld
def uuid = UUID.randomUUID().toString()
node(label) {
ws("workspace/${JOB_BASE_NAME}-${BUILD_NUMBER}") {
ws("workspace/${JOB_BASE_NAME}-${BUILD_NUMBER}-${uuid}") {
body()
}
}
Expand Down Expand Up @@ -559,7 +561,12 @@ def withBeatsEnv(Map args = [:], Closure body) {
gox_flags = '-arch 386'
}

deleteDir()
// IMPORTANT: Somehow windows workers got a different opinion regarding removing the workspace.
// Windows workers are ephemerals, so this should not really affect us.
if(isUnix()) {
deleteDir()
}

unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
// NOTE: This is required to run after the unstash
def module = withModule ? getCommonModuleInTheChangeSet(directory) : ''
Expand Down Expand Up @@ -603,17 +610,23 @@ def withBeatsEnv(Map args = [:], Closure body) {
if (archive) {
archiveTestOutput(testResults: testResults, artifacts: artifacts, id: args.id, upload: upload)
}
// Tear down the setup for the permanent workers.
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
fixPermissions("${WORKSPACE}")
// TODO: Somehow windows workers got a different opinion regarding removing the workspace
// IMPORTANT: windows workers are ephemerals, so this should not really affect us.
if (isUnix()) {
dir("${WORKSPACE}") {
deleteDir()
}
}
}
tearDown()
}
}
}
}

/**
* Tear down the setup for the permanent workers.
*/
def tearDown() {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
fixPermissions("${WORKSPACE}")
// IMPORTANT: Somehow windows workers got a different opinion regarding removing the workspace.
// Windows workers are ephemerals, so this should not really affect us.
if (isUnix()) {
dir("${WORKSPACE}") {
deleteDir()
}
}
}
Expand Down