Skip to content

Commit

Permalink
CI stdout is printed to file instead of console (d2iq-archive#5633)
Browse files Browse the repository at this point in the history
Summary:

We're printing CI logs (sbt test integration:test...) directly to a log file. This should:
- improve CI run time since we don't print to console and upload zipped artifacts (1/10 of log size)
- theoretically solve our "jenkins log loop" problem by printing only very few lines (`stderr`) to console
- logs are archived by Jenkins
Additionally an old remnant (`review.py`) of phabricator times was removed.
  • Loading branch information
zen-dog authored Oct 17, 2017
1 parent 0a501c9 commit bf78e3e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 135 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ native/
sandboxes/
sandboxes.tar.gz
tests/performance/results
ci.log
ci.tar.gz
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ansiColor('gnome-terminal') {
junit(allowEmptyResults: true, testResults: 'target/test-reports/*.xml')
junit allowEmptyResults: true, testResults: 'target/test-reports/*integration/*.xml'
archive includes: 'sandboxes.tar.gz'
archive includes: 'ci.tar.gz'
archive includes: 'ci.log' // Only in case the build was aborted and the logs weren't zipped
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions ci/pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def compileAndTest(): Unit = utils.stage("Compile and Test") {
}

@main
def zipSandboxLogs(): Unit = {
def zipLogs(): Unit = {
Try(%("tar", "-zcf", "sandboxes.tar.gz", "sandboxes"))
Try(%("tar", "-zcf", "ci.tar.gz", "--remove-files", "ci.log"))
}

@main
Expand Down Expand Up @@ -158,7 +159,7 @@ def run(): (String, Option[awsClient.Artifact]) = {
try {
compileAndTest()
} finally {
zipSandboxLogs() // Try to archive logs in any case
zipLogs() // Try to archive ci and sandbox logs in any case
}

val (version, maybeArtifact) = createAndUploadPackages()
Expand Down
10 changes: 10 additions & 0 deletions ci/utils.sc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ import java.util.concurrent.TimeUnit
import scala.collection.JavaConverters._
import scala.concurrent.duration.FiniteDuration
import scala.util.control.NonFatal
import java.io.File


import $file.provision

def ciLogFile(name: String = "ci.log"): File = {
val log = new File(name)
if (!log.exists())
log.createNewFile()
log
}

// Color definitions
object Colors {
val BrightRed = "\u001b[31;1m"
Expand Down Expand Up @@ -66,6 +75,7 @@ def runWithTimeout(timeout: FiniteDuration)(commands: Seq[String]): Unit = {
.directory(new java.io.File(pwd.toString))
.command(commands.asJava)
.inheritIO()
.redirectOutput(ProcessBuilder.Redirect.appendTo(ciLogFile()))
.start()

try {
Expand Down
133 changes: 0 additions & 133 deletions review.py

This file was deleted.

0 comments on commit bf78e3e

Please sign in to comment.