Add retries when fetching tableau artifacts in sbt (#10984)

* Add retries when fetching tableau artifacts in sbt

Seeing frequent network failures when fetching tableau artifacts e.g.,
https://github.com/enso-org/enso/actions/runs/10705660288/job/29681570936#step:7:918

Network failures are OK but we shouldn't kill builds immediately because
of that. Let's try harder.

* update codeowners

* use backoff

* fighting with sbt

(cherry picked from commit 92dd3c9613)
This commit is contained in:
Hubert Plociniczak 2024-09-09 10:16:54 +02:00 committed by James Dunkerley
parent e2835ce104
commit 5af6f9530d
3 changed files with 43 additions and 9 deletions

2
.github/CODEOWNERS vendored
View File

@ -30,7 +30,7 @@ Cargo.toml
/build.sbt @4e6 @jaroslavtulach @hubertp @Akirathan /build.sbt @4e6 @jaroslavtulach @hubertp @Akirathan
/distribution/ @4e6 @jdunkerley @radeusgd @GregoryTravis @AdRiley @marthasharkey /distribution/ @4e6 @jdunkerley @radeusgd @GregoryTravis @AdRiley @marthasharkey
/engine/ @4e6 @jaroslavtulach @hubertp @Akirathan /engine/ @4e6 @jaroslavtulach @hubertp @Akirathan
/project/ @4e6 @jaroslavtulach @hubertp /project/ @4e6 @jaroslavtulach @hubertp @Akirathan
/tools/ @4e6 @jaroslavtulach @radeusgd @hubertp /tools/ @4e6 @jaroslavtulach @radeusgd @hubertp
# Enso Libraries # Enso Libraries

View File

@ -3579,14 +3579,47 @@ lazy val `std-tableau` = project
val unmanagedPath = unmanagedDirectory.toPath val unmanagedPath = unmanagedDirectory.toPath
IO.withTemporaryDirectory( IO.withTemporaryDirectory(
tmp => { tmp => {
val files = IO.unzipURL( import scala.concurrent.ExecutionContext.Implicits.global
unmanagedExternalZip.value, implicit val filesNotEmptySuccess: retry.Success[Set[File]] =
tmp, retry.Success(!_.isEmpty)
f => import scala.concurrent.duration._
f.endsWith(".jar") && !f.contains("gradle") && !f.contains( val future = retry.Backoff(4, 1.second).apply { () =>
"javadoc" scala.concurrent.Future {
) && !f.contains("jna") try {
) IO.unzipURL(
unmanagedExternalZip.value,
tmp,
f =>
f.endsWith(".jar") && !f.contains("gradle") && !f
.contains(
"javadoc"
) && !f.contains("jna")
)
} catch {
case _: java.net.SocketException |
_: java.net.ConnectException =>
Set.empty[File]
}
}
}
future.onComplete { result =>
if (result.isFailure || result.get.isEmpty) {
logger.log(
Level.Error,
"Failed to fetch any external artifacts for tableau"
)
}
}
val files = scala.concurrent.Await.result(future, 60.seconds)
if (files.isEmpty) {
logger.log(
Level.Error,
"Failed to fetch any external artifacts for tableau"
)
throw new IllegalStateException(
"Failed to fetch any external artifacts"
)
}
files.map { f => files.map { f =>
IO.move(f, unmanagedPath.resolve(f.getName).toFile) IO.move(f, unmanagedPath.resolve(f.getName).toFile)
Attributed.blank(unmanagedPath.resolve(f.getName).toFile) Attributed.blank(unmanagedPath.resolve(f.getName).toFile)

View File

@ -8,5 +8,6 @@ libraryDependencies += "io.circe" %% "circe-yaml" % "0
libraryDependencies += "commons-io" % "commons-io" % "2.12.0" libraryDependencies += "commons-io" % "commons-io" % "2.12.0"
libraryDependencies += "nl.gn0s1s" %% "bump" % "0.1.3" libraryDependencies += "nl.gn0s1s" %% "bump" % "0.1.3"
libraryDependencies += "com.google.googlejavaformat" % "google-java-format" % "1.18.1" libraryDependencies += "com.google.googlejavaformat" % "google-java-format" % "1.18.1"
libraryDependencies += "com.softwaremill.retry" %% "retry" % "0.3.6"
scalacOptions ++= Seq("-deprecation", "-feature") scalacOptions ++= Seq("-deprecation", "-feature")