Skip to content

Commit 810eb2c

Browse files
committed
JFROG_CLI_REQUEST_TIMEOUT variable with the request timeout
1 parent 44220ef commit 810eb2c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

artifactory/utils/utils.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ func GetEncryptedPasswordFromArtifactory(artifactoryAuth auth.ServiceDetails, in
9292
}
9393

9494
func CreateServiceManager(serverDetails *config.ServerDetails, httpRetries, httpRetryWaitMilliSecs int, isDryRun bool) (artifactory.ArtifactoryServicesManager, error) {
95-
return CreateServiceManagerWithContext(context.Background(), serverDetails, isDryRun, 0, httpRetries, httpRetryWaitMilliSecs, 0)
95+
return CreateServiceManagerWithTimeout(serverDetails, httpRetries, httpRetryWaitMilliSecs, isDryRun, 0)
96+
}
97+
98+
func CreateServiceManagerWithTimeout(serverDetails *config.ServerDetails, httpRetries, httpRetryWaitMilliSecs int, isDryRun bool, timeout time.Duration) (artifactory.ArtifactoryServicesManager, error) {
99+
return CreateServiceManagerWithContext(context.Background(), serverDetails, isDryRun, 0, httpRetries, httpRetryWaitMilliSecs, timeout)
96100
}
97101

98102
// Create a service manager with threads.

lifecycle/createfromartifacts.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@ package lifecycle
22

33
import (
44
"errors"
5+
"os"
6+
"path"
7+
"time"
8+
59
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
610
rtServicesUtils "github.com/jfrog/jfrog-client-go/artifactory/services/utils"
711
"github.com/jfrog/jfrog-client-go/lifecycle"
812
"github.com/jfrog/jfrog-client-go/lifecycle/services"
913
"github.com/jfrog/jfrog-client-go/utils/io/content"
1014
"github.com/jfrog/jfrog-client-go/utils/log"
11-
"path"
15+
)
16+
17+
const (
18+
TimeoutEnvKey = "JFROG_CLI_REQUEST_TIMEOUT"
1219
)
1320

1421
func (rbc *ReleaseBundleCreateCommand) createFromArtifacts(lcServicesManager *lifecycle.LifecycleServicesManager,
1522
rbDetails services.ReleaseBundleDetails, queryParams services.CommonOptionalQueryParams) (err error) {
1623

17-
rtServicesManager, err := utils.CreateServiceManager(rbc.serverDetails, 3, 0, false)
24+
timeout, _ := time.ParseDuration(os.Getenv(TimeoutEnvKey))
25+
26+
rtServicesManager, err := utils.CreateServiceManagerWithTimeout(rbc.serverDetails, 3, 0, false, timeout)
1827
if err != nil {
1928
return err
2029
}

0 commit comments

Comments
 (0)