1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

fix: panic while access a http response in Artifactory pipeline

When the upload target is not resolvable by tcp (e.g. unknown host)
no response object will be generated.
In an error case the response object is used (it was assumed that
this will be there at every point in time).

This commit fixes this behaviour
This commit is contained in:
Andy Grunwald 2017-12-02 21:10:32 +01:00
parent d9f349dd0c
commit 024ca0a1af

View File

@ -163,7 +163,12 @@ func doBuild(ctx *context.Context, build config.Build, target buildtarget.Target
artifact, resp, err := uploadBinaryToArtifactory(ctx, uploadTarget, artifactory.Username, secret, file)
if err != nil {
if resp != nil {
log.WithError(err).Errorf("Artifactory: Upload to target %s failed (HTTP Status: %s)", uploadTarget, resp.Status)
} else {
log.WithError(err).Errorf("Artifactory: Upload to target %s failed", uploadTarget)
}
continue
}