使用 Gradle 将大文件发布到 CodeArtifact 时出现管道损坏(写入失败)错误

问题描述 投票:0回答:1

我有一个非常大(12GB)的工件,我试图使用 Gradle 发布到 AWS CodeArtifact,每次运行构建时,它都会失败,并出现以下异常。此项目中的其他较小工件上传没有问题。

> Could not write to resource 'https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com/maven/my-repo/com/my-org/my-artifact/2.0.1/my-artifact-2.0.1.tar.gz'.
   > Broken pipe (Write failed)

启用信息日志记录后,Gradle 似乎执行了 3 次 HTTP 重试,允许上传继续进行,其中 1 次约为 1GB,另一次约为 3GB,最后一次重试约为 6GB,但在第四次失败后,构建失败。

以下是日志:

» ./gradlew publish --info
<=====--------> 40% EXECUTING [40s]
Publishing to repository 'maven' (https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com/maven/my-repo/)
Uploading my-artifact-2.0.1.tar.gz to /maven/my-repo/com/myorg/my-artifact/2.0.1/my-artifact-2.0.1.tar.gz
> :publishMainPublicationToMavenRepository > my-artifact-2.0.1.tar.gz > 1.1GiB/11.6 GiB uploaded
I/O exception (java.net.SocketException) caught when processing request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443: Broken pipe (Write failed)
Retrying request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443
> :publishMainPublicationToMavenRepository > my-artifact-2.0.1.tar.gz > 3.3GiB/11.6 GiB uploaded
I/O exception (java.net.SocketException) caught when processing request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443: Broken pipe (Write failed)
> :publishMainPublicationToMavenRepository > my-artifact-2.0.1.tar.gz > 6.2GiB/11.6 GiB uploaded
Retrying request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443
I/O exception (java.net.SocketException) caught when processing request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443: Broken pipe (Write failed)
Retrying request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443
I/O exception (java.net.SocketException) caught when processing request to {s}->https://us-east-1-codeartifact-domain-0000.d.codeartifact.us-east-1.amazonaws.com:443: Broken pipe (Write failed)

我可以配置 Gradle 来重试上传工件的整个过程,但它只会重新开始上传并在同一位置再次失败。 显然,重试逻辑发生在较低级别,如果我可以增加特定的重试计数,则上传应该完成,但我无法弄清楚如何/在哪里配置此重试值,或者是否可能。

Gradle版本:8.10.2 使用 maven-publish 插件(我相信是最新的)

相关

build.gradle
代码:

plugins {
  id 'java'
  id 'distribution'
  id 'maven-publish'
}

repositories {
  maven {
    url 'https://us-east-1-codeartifact-domain-0000.codeartifact.us-east-1.amazonaws.com/maven/my-repo/'
    credentials {
      username "aws"
      password System.env.CODEARTIFACT_AUTH_TOKEN
    }
  }
}

我在

~/.gradle/gradle.properties
中尝试了以下系统属性,但没有成功:

systemProp.org.gradle.internal.repository.max.retries=10
systemProp.org.gradle.internal.http.retry=10
systemProp.org.gradle.internal.network.retry.max.attempts=10

我试图找到执行这些重试的 Gradle 代码,但我无法判断这是发生在 maven-publish 插件中还是发生在较低级别(如 HTTP 客户端库中)。

http gradle publish ioexception codeartifact
1个回答
0
投票

在我的例子中,由于默认配额大小,发布/上传到 AWS CodeArtifact 失败,记录如下:CodeArtifact Quotas。由于我尝试发布的工件大于最大“资产文件大小”(5 GB),因此服务器拒绝了请求。

但是,我从未弄清楚如何在 Gradle 发布期间配置低级重试,或者是否可以这样做。

© www.soinside.com 2019 - 2024. All rights reserved.