swiftlang/swift-package-manager

publish error with specific package

Opened this issue · 2 comments

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

The behavior of this is inconsistent, but very frequent.

We have a number of packages we are using private, cloud hosted Artifactory to host. There is a package that started to fail to publish at least 9/10 times when trying. The final error is Error: failed publishing: Error Domain=NSURLErrorDomain Code=-1001 "(null)"

The aggrivating thing is that this is happening on github actions. When I run the swift command by hand, locally, it does not (always) error. But this is not sustainable.

The zip produced by the package is only about 83kb.

I'm trying to determine if this is a swift tool issue (something about the code or produced zip?) or an artifactory issue. I've got a ticket open with them as well. But the error message given here is not giving a lot of information to go with.

Expected behavior

Publish upload goes through and no error reported. 3 other packages upload the same way without ever an issue.

The error message might have more information potentially. This could be a timeout, some 400 or 500 error, or something else, but the null response is not giving any more information.

Actual behavior

Error is produced. Below is from the tool with --very-verbose (some strings have been redacted)

  tracking.common_events.v1: 2024-06-21T19:37:58.890Z artifact:swift stderr: debug: /opt/hostedtoolcache/swift-Ubuntu/5.10/x64/usr/bin/swiftc -print-target-info
  tracking.common_events.v1: debug: registering 'repository fetching' with terminator
  tracking.common_events.v1: debug: registering 'registry downloads' with terminator
  tracking.common_events.v1: debug: registering 'binary artifacts downloads' with terminator
  tracking.common_events.v1: info: archiving the source at '/home/runner/work/***s/***s/modules/tracking.common_events.v1/gen/swift/corp.tracking-common_events-v1'
  tracking.common_events.v1: debug: git -C /home/runner/work/***s/***s/modules/tracking.common_events.v1/gen/swift/corp.tracking-common_events-v1/.build/registry/publish/source/corp.tracking-common_events-v1 rev-parse --git-dir
  tracking.common_events.v1: debug: registering 'zip -r /home/runner/work/***s/***s/modules/tracking.common_events.v1/gen/swift/corp.tracking-common_events-v1/.build/registry/publish/corp.tracking-common_events-v1-2024.6.22-dev.5.zip corp.tracking-common_events-v1' with terminator
  tracking.common_events.v1: debug: zip -r /home/runner/work/***s/***s/modules/tracking.common_events.v1/gen/swift/corp.tracking-common_events-v1/.build/registry/publish/corp.tracking-common_events-v1-2024.6.22-dev.5.zip corp.tracking-common_events-v1
  tracking.common_events.v1: info: publishing corp.tracking-common_events-v1 archive at '/home/runner/work/***s/***s/modules/tracking.common_events.v1/gen/swift/corp.tracking-common_events-v1/.build/registry/publish/corp.tracking-common_events-v1-2024.6.22-dev.5.zip' to https://corp.jfrog.io/artifactory/api/swift/swift-repo
  tracking.common_events.v1: info: publishing corp.tracking-common_events-v1 2024.6.22-dev.5 to https://corp.jfrog.io/artifactory/api/swift/swift-repo/corp/tracking-common_events-v1/2024.6.22-dev.5
  tracking.common_events.v1: Error: failed publishing: Error Domain=NSURLErrorDomain Code=-1001 "(null)"

The zip produced by the publish action is left behind in the .build folder, and on inspection has nothing "wrong" with it.

Steps to reproduce

swift cli:

swift package-registry publish corp.tracking-common_events-v1 2024.6.22-dev.5 --url="https://corp.jfrog.io/artifactory/api/swift/swift-repo"

Swift Package Manager version/commit hash

5.10.0 (5.9.2 also produced the same issue)

Swift & OS version (output of swift --version ; uname -a)

Github Actions Ubuntu 22.04.4 LTS
Swift 5.10 via https://swift.org/builds/swift-5.10-release/ubuntu2204/swift-5.10-RELEASE/swift-5.10-RELEASE-ubuntu22.04.tar.gz (https://github.com/swift-actions/setup-swift)

Looking deeper into the code, it looks like we're getting down into the httpClient.execute but thats throwing a real error, which is then mapped.

Looking, it seems like -1001 is usually "The request timed out.", or some other timeout error (reference) with more error context, but thats not showing up here, just null.

(I'm still awaiting word back from artifactory. I suspect its an issue with them, but any other insight here about error messaging would be great)

It looks like this might indeed be an artifactory specific problem. I'm still awaiting feedback from them, but I have been able to successfully publish to AWS CodeArtifact.