summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-07-09 02:11:28 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2019-07-09 02:11:28 +0800
commit74efe69750c9a73c0824e6a924805a2fcb1001b4 (patch)
tree74934ed22145cdc128896947dae06998963c3bfb
parent4faefb132f918e971f1f0f1428ca790ce7b128b2 (diff)
downloadmill-74efe69750c9a73c0824e6a924805a2fcb1001b4.tar.gz
mill-74efe69750c9a73c0824e6a924805a2fcb1001b4.tar.bz2
mill-74efe69750c9a73c0824e6a924805a2fcb1001b4.zip
Bump sonatype "wait for something to happen" timeout, make it configurable
Somehow it seems sonatype has gotten slower recently and no longer completes operations in the same 60s timeout that it used to
-rwxr-xr-xci/release.sh10
-rw-r--r--scalalib/src/PublishModule.scala12
-rw-r--r--scalalib/src/publish/SonatypePublisher.scala22
3 files changed, 31 insertions, 13 deletions
diff --git a/ci/release.sh b/ci/release.sh
index c40964e0..31c5e328 100755
--- a/ci/release.sh
+++ b/ci/release.sh
@@ -8,9 +8,15 @@ gpg --import gpg_key
rm gpg_key
-./mill uploadToGithub $GITHUB_ACCESS_TOKEN
+# Build Mill
+./mill -i dev.assembly
-./mill mill.scalalib.PublishModule/publishAll \
+rm -rf ~/.mill
+
+# Second build & run tests
+out/dev/assembly/dest/mill uploadToGithub $GITHUB_ACCESS_TOKEN
+
+out/dev/assembly/dest/mill mill.scalalib.PublishModule/publishAll \
--sonatypeCreds lihaoyi:$SONATYPE_PASSWORD \
--gpgPassphrase $GPG_PASSWORD \
--publishArtifacts __.publishArtifacts \
diff --git a/scalalib/src/PublishModule.scala b/scalalib/src/PublishModule.scala
index e5d6a3a4..d47b16a8 100644
--- a/scalalib/src/PublishModule.scala
+++ b/scalalib/src/PublishModule.scala
@@ -85,7 +85,8 @@ trait PublishModule extends JavaModule { outer =>
signed: Boolean = true,
readTimeout: Int = 60000,
connectTimeout: Int = 5000,
- release: Boolean): define.Command[Unit] = T.command {
+ release: Boolean,
+ awaitTimeout: Int = 120 * 1000): define.Command[Unit] = T.command {
val PublishModule.PublishData(artifactInfo, artifacts) = publishArtifacts()
new SonatypePublisher(
sonatypeUri,
@@ -96,7 +97,8 @@ trait PublishModule extends JavaModule { outer =>
signed,
readTimeout,
connectTimeout,
- T.ctx().log
+ T.ctx().log,
+ awaitTimeout
).publish(artifacts.map{case (a, b) => (a.path, b)}, artifactInfo, release)
}
}
@@ -117,7 +119,8 @@ object PublishModule extends ExternalModule {
gpgKeyName: String = null,
sonatypeUri: String = "https://oss.sonatype.org/service/local",
sonatypeSnapshotUri: String = "https://oss.sonatype.org/content/repositories/snapshots",
- signed: Boolean = true) = T.command {
+ signed: Boolean = true,
+ awaitTimeout: Int = 120 * 1000) = T.command {
val x: Seq[(Seq[(os.Path, String)], Artifact)] = Task.sequence(publishArtifacts.value)().map{
case PublishModule.PublishData(a, s) => (s.map{case (p, f) => (p.path, f)}, a)
@@ -131,7 +134,8 @@ object PublishModule extends ExternalModule {
signed,
readTimeout,
connectTimeout,
- T.ctx().log
+ T.ctx().log,
+ awaitTimeout
).publishAll(
release,
x:_*
diff --git a/scalalib/src/publish/SonatypePublisher.scala b/scalalib/src/publish/SonatypePublisher.scala
index 5c760574..ec29684d 100644
--- a/scalalib/src/publish/SonatypePublisher.scala
+++ b/scalalib/src/publish/SonatypePublisher.scala
@@ -14,7 +14,8 @@ class SonatypePublisher(uri: String,
signed: Boolean,
readTimeout: Int,
connectTimeout: Int,
- log: Logger) {
+ log: Logger,
+ awaitTimeout: Int) {
private val api = new SonatypeHttpApi(uri, credentials, readTimeout = readTimeout, connectTimeout = connectTimeout)
@@ -54,7 +55,13 @@ class SonatypePublisher(uri: String,
}
val releaseGroups = releases.groupBy(_._1.group)
for ((group, groupReleases) <- releaseGroups) {
- publishRelease(release, groupReleases.flatMap(_._2), group, releases.map(_._1))
+ publishRelease(
+ release,
+ groupReleases.flatMap(_._2),
+ group,
+ releases.map(_._1),
+ awaitTimeout
+ )
}
}
@@ -73,7 +80,8 @@ class SonatypePublisher(uri: String,
private def publishRelease(release: Boolean,
payloads: Seq[(String, Array[Byte])],
stagingProfile: String,
- artifacts: Seq[Artifact]): Unit = {
+ artifacts: Seq[Artifact],
+ awaitTimeout: Int): Unit = {
val profileUri = api.getStagingProfileUri(stagingProfile)
val stagingRepoId =
api.createStagingRepo(profileUri, stagingProfile)
@@ -91,13 +99,13 @@ class SonatypePublisher(uri: String,
api.closeStagingRepo(profileUri, stagingRepoId)
log.info("Waiting for staging repository to close")
- awaitRepoStatus("closed", stagingRepoId)
+ awaitRepoStatus("closed", stagingRepoId, awaitTimeout)
log.info("Promoting staging repository")
api.promoteStagingRepo(profileUri, stagingRepoId)
log.info("Waiting for staging repository to release")
- awaitRepoStatus("released", stagingRepoId)
+ awaitRepoStatus("released", stagingRepoId, awaitTimeout)
log.info("Dropping staging repository")
api.dropStagingRepo(profileUri, stagingRepoId)
@@ -122,11 +130,11 @@ class SonatypePublisher(uri: String,
private def awaitRepoStatus(status: String,
stagingRepoId: String,
- attempts: Int = 20): Unit = {
+ awaitTimeout: Int): Unit = {
def isRightStatus =
api.getStagingRepoState(stagingRepoId).equalsIgnoreCase(status)
- var attemptsLeft = attempts
+ var attemptsLeft = awaitTimeout / 3000
while (attemptsLeft > 0 && !isRightStatus) {
Thread.sleep(3000)