nuget.exe 推送抛出错误。基础连接已关闭:连接意外关闭

nuget.exe push throws error. The underlying connection was closed: The connection was closed unexpectedly

我在一个文件夹中创建了几个 nuget 包,我正试图将它从 jenkins 发布到 Nexus。下面是我的舞台代码:

stage('Publish To Nexus') {
    when {
        branch 'dev'
    }
    steps {
        parallel (
            "Publish Application Packages": {
                script {
                    bat "nuget.exe push \"${PACKAGE_PATH}\*.nupkg\"  ${NEXUS_APIKEY} -Source \"${FEED_URL}\" -Timeout 36000"
                }
            },
            "Publish Upgrader Packages": {
                script {
                    bat "nuget.exe push \"${PACKAGE_PATH_UPGRADER}\*.nupkg\" ${NEXUS_APIKEY} -Source \"${FEED_URL}\"  -Timeout 36000"
                }
            }
        )
    }
}

但是,它因错误而失败(尤其是对于大文件):

An error occurred while sending the request.
The underlying connection was closed: The connection was closed unexpectedly.

注意事项:当我一次一个地手动执行命令时,它可以正常上传。需要帮助以了解通过 jenkins 将包上传到 nexus 的更好方法或替代方法。

我通过 retry and timeout.

解决了这个问题
steps {
    script {
        echo "Publishing packages"
        retry(3) {
            timeout(time: 30, unit: 'MINUTES') {
                echo "Publish large file."
                bat "_________"
            }
        }
    }
}