forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Make gradle build finished logic CC compatible (elastic#96475)"
This reverts commit 841f711.
- Loading branch information
Showing
6 changed files
with
94 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
build-tools-internal/src/main/groovy/elasticsearch.build-complete.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import org.elasticsearch.gradle.util.GradleUtils | ||
|
||
import java.nio.file.Files | ||
|
||
String buildNumber = System.getenv('BUILD_NUMBER') ?: System.getenv('BUILDKITE_BUILD_NUMBER') | ||
String performanceTest = System.getenv('BUILD_PERFORMANCE_TEST') | ||
Boolean isNested = System.getProperty("scan.tag.NESTED") != null | ||
|
||
if (buildNumber && performanceTest == null && GradleUtils.isIncludedBuild(project) == false && isNested == false) { | ||
def uploadFilePath = "build/${buildNumber}.tar.bz2" | ||
File uploadFile = file(uploadFilePath) | ||
project.gradle.buildFinished { result -> | ||
println "build complete, generating: $uploadFile" | ||
if (uploadFile.exists()) { | ||
project.delete(uploadFile) | ||
} | ||
|
||
try { | ||
ant.tar(destfile: uploadFile, compression: "bzip2", longfile: "gnu") { | ||
fileset(dir: projectDir) { | ||
Set<File> fileSet = fileTree(projectDir) { | ||
include("**/*.hprof") | ||
include("**/build/test-results/**/*.xml") | ||
include("**/build/testclusters/**") | ||
include("**/build/testrun/*/temp/**") | ||
include("**/build/**/hs_err_pid*.log") | ||
exclude("**/build/testclusters/**/data/**") | ||
exclude("**/build/testclusters/**/distro/**") | ||
exclude("**/build/testclusters/**/repo/**") | ||
exclude("**/build/testclusters/**/extract/**") | ||
exclude("**/build/testclusters/**/tmp/**") | ||
exclude("**/build/testrun/*/temp/**/data/**") | ||
exclude("**/build/testrun/*/temp/**/distro/**") | ||
exclude("**/build/testrun/*/temp/**/repo/**") | ||
exclude("**/build/testrun/*/temp/**/extract/**") | ||
exclude("**/build/testrun/*/temp/**/tmp/**") | ||
} | ||
.files | ||
.findAll { Files.isRegularFile(it.toPath()) } | ||
|
||
if (fileSet.empty) { | ||
// In cases where we don't match any workspace files, exclude everything | ||
ant.exclude(name: "**/*") | ||
} else { | ||
fileSet.each { | ||
ant.include(name: projectDir.toPath().relativize(it.toPath())) | ||
} | ||
} | ||
} | ||
|
||
fileset(dir: "${gradle.gradleUserHomeDir}/daemon/${gradle.gradleVersion}", followsymlinks: false) { | ||
include(name: "**/daemon-${ProcessHandle.current().pid()}*.log") | ||
} | ||
|
||
fileset(dir: "${gradle.gradleUserHomeDir}/workers", followsymlinks: false) | ||
|
||
fileset(dir: "${project.projectDir}/.gradle/reaper", followsymlinks: false, erroronmissingdir: false) | ||
} | ||
} catch (Exception e) { | ||
logger.lifecycle("Failed to archive additional logs", e) | ||
} | ||
|
||
if (uploadFile.exists() && System.getenv("BUILDKITE") == "true") { | ||
try { | ||
println "Uploading buildkite artifact: ${uploadFilePath}..." | ||
new ProcessBuilder("buildkite-agent", "artifact", "upload", uploadFilePath) | ||
.start() | ||
.waitFor() | ||
|
||
println "Generating buildscan link for artifact..." | ||
|
||
def process = new ProcessBuilder("buildkite-agent", "artifact", "search", uploadFilePath, "--step", System.getenv('BUILDKITE_JOB_ID'), "--format", "%i").start() | ||
process.waitFor() | ||
def artifactUuid = (process.text ?: "").trim() | ||
|
||
println "Artifact UUID: ${artifactUuid}" | ||
if (artifactUuid) { | ||
buildScan.link 'Artifact Upload', "https://buildkite.com/organizations/elastic/pipelines/${System.getenv('BUILDKITE_PIPELINE_SLUG')}/builds/${buildNumber}/jobs/${System.getenv('BUILDKITE_JOB_ID')}/artifacts/${artifactUuid}" | ||
} | ||
} catch (Exception e) { | ||
logger.lifecycle("Failed to upload buildkite artifact", e) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
219 changes: 0 additions & 219 deletions
219
...nal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildFinishedPlugin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters