Comments (5)
Hi @malkam03 and @alex1989hu
After some investigation we noticed that this issue occurs only for HTTP errors returned from Artifactory.
Golang's HTTP client doesn't return an error for non-2xx responses, so jfrog-client-go will have to check the response's status code and throw an error accordingly.
To make these errors easier to handle, they will be of a new struct containing the status code, status definition and maybe some more useful information.
Pay attention that only the first error to be thrown is returned from the method, even if more than one error was thrown throughout the process.
Nowadays I'm working on a cool new feature of archiving and uploading files to Artifactory, so I'll start implementing this solution in the next few days.
Meanwhile I'll be happy to hear your thoughts about it.
from jfrog-client-go.
@malkam03 @alex1989hu,
Thanks for reporting this issue.
This is resolved in 0.22.0 at https://github.com/jfrog/jfrog-client-go/pull/340/files#diff-fbe1867fd4ced5fcc9f3fd0a019edb80095566953e286e5e41e46439310ce228R437
However, I'd recommend upgrading to the latest version v1.10.0 to get better logging and a retry mechanism.
Please let me know if that helped.
from jfrog-client-go.
Thanks for reporting this issue!
We're looking into it now.
from jfrog-client-go.
Hello, I also met this issue today - started to use the library few days ago to let me able to upload files.
/cc @eyalbe4 Is it a possible solution?
diff --git a/artifactory/services/upload.go b/artifactory/services/upload.go
index 7034b12..5fe09c5 100644
--- a/artifactory/services/upload.go
+++ b/artifactory/services/upload.go
@@ -1,6 +1,7 @@
package services
import (
+ "errors"
"net/http"
"os"
"path/filepath"
@@ -88,7 +89,9 @@ func (us *UploadService) performUploadTasks(consumer parallel.Runner, uploadSumm
log.Debug("Uploaded", strconv.Itoa(totalUploaded), "artifacts.")
totalFailed = totalUploadAttempted - totalUploaded
if totalFailed > 0 {
- log.Error("Failed uploading", strconv.Itoa(totalFailed), "artifacts.")
+ errFailed := errorutils.CheckError(errors.New("Failed uploading" + strconv.Itoa(totalFailed) + "artifacts"))
+ errorsQueue.AddError(errFailed)
+ log.Error(errFailed)
}
err = errorsQueue.GetError()
return
from jfrog-client-go.
cool new feature of archiving and uploading files to Artifactory, so I'll start implementing this solution in the next few days
Hello @asafgabai, I am happy that you checked what happens inside. I think throwing the first error only is much better, than the current behaviour which ignores - due to Go HTTP Client as you wrote - a set of ~errors.
from jfrog-client-go.
Related Issues (20)
- Configure `Enable Dependency Rewrite` and `Patterns Allow List` for Remote Helm Repositories HOT 1
- Opentelemetry: Option to pass context
- Repositories fields not covered by the Go client
- Remote repositories - manage passwords HOT 1
- Correct way to get if a search returned no results?
- Does ContentReader of DownloadFileswithsummary have file information in Bytes HOT 5
- Improve SetUrl Logic to handle `$URL` and `$URL/`. HOT 3
- Missing `include_reference_token` parameter when creating a new access token.
- Create Access Tokens for other users using the Access service
- Security v2 API HOT 1
- AccessServiceManager create access token
- GetAllUsers() only returns mostly empty User struct, only the username and authentication method HOT 1
- GetAllRepositoriesFiltered(params services.RepositoriesFilterParams) should honor the API HOT 1
- CreateFolder function is missing
- Jfrog CLI fails with `400 Bad Request` instead of maybe `403 Forbidden`, returning error impossible to debug error message HOT 3
- httpclient.DoRequest retry logic ignores value of closeBody
- Which utils from utils.FileInfo is it referring to in the README? HOT 1
- build scan command with flag --project is returning xray_details_url without project key
- TempDir is not getting created when the jfrog docker scan command is ran.
- how to add a new member to all federated repository
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jfrog-client-go.