From b6ead796a8a2281be708713a696c3f1af0c2a2dc Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Sun, 20 Oct 2024 11:33:10 +0300 Subject: [PATCH] CR fixes --- integrationutils.go | 24 ++++++++++++------------ utils/consts.go | 12 ++++++------ utils/git.go | 2 +- utils/params.go | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/integrationutils.go b/integrationutils.go index bd97d7119..b749faa90 100644 --- a/integrationutils.go +++ b/integrationutils.go @@ -80,18 +80,18 @@ func setIntegrationTestEnvs(t *testing.T, testDetails *IntegrationTestDetails) f useLocalRepo = "true" } unsetEnvs := utils.SetEnvsAndAssertWithCallback(t, map[string]string{ - utils.RequirementsFileEnv: "requirements.txt", - utils.GitPullRequestIDEnv: testDetails.PullRequestID, - utils.GitProvider: testDetails.GitProvider, - utils.GitTokenEnv: testDetails.GitToken, - utils.GitRepoEnv: testDetails.RepoName, - utils.GitRepoOwnerEnv: testDetails.RepoOwner, - utils.BranchNameTemplateEnv: testDetails.CustomBranchName, - utils.GitApiEndpointEnv: testDetails.ApiEndpoint, - utils.GitProjectEnv: testDetails.GitProject, - utils.GitUsernameEnv: testDetails.GitUsername, - utils.GitBaseBranchEnv: mainBranch, - utils.GitUseCurrentLocalRepositoryEnv: useLocalRepo, + utils.RequirementsFileEnv: "requirements.txt", + utils.GitPullRequestIDEnv: testDetails.PullRequestID, + utils.GitProvider: testDetails.GitProvider, + utils.GitTokenEnv: testDetails.GitToken, + utils.GitRepoEnv: testDetails.RepoName, + utils.GitRepoOwnerEnv: testDetails.RepoOwner, + utils.BranchNameTemplateEnv: testDetails.CustomBranchName, + utils.GitApiEndpointEnv: testDetails.ApiEndpoint, + utils.GitProjectEnv: testDetails.GitProject, + utils.GitUsernameEnv: testDetails.GitUsername, + utils.GitBaseBranchEnv: mainBranch, + utils.GitUseLocalRepositoryEnv: useLocalRepo, }) return func() { envRestoreFunc() diff --git a/utils/consts.go b/utils/consts.go index f8555b5be..5730d8c00 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -34,12 +34,12 @@ const ( JfrogConfigProfileEnv = "JF_CONFIG_PROFILE" // Git environment variables - GitProvider = "JF_GIT_PROVIDER" - GitRepoOwnerEnv = "JF_GIT_OWNER" - GitRepoEnv = "JF_GIT_REPO" - GitProjectEnv = "JF_GIT_PROJECT" - GitUsernameEnv = "JF_GIT_USERNAME" - GitUseCurrentLocalRepositoryEnv = "JF_USE_CURRENT_LOCAL_REPOSITORY" + GitProvider = "JF_GIT_PROVIDER" + GitRepoOwnerEnv = "JF_GIT_OWNER" + GitRepoEnv = "JF_GIT_REPO" + GitProjectEnv = "JF_GIT_PROJECT" + GitUsernameEnv = "JF_GIT_USERNAME" + GitUseLocalRepositoryEnv = "JF_USE_LOCAL_REPOSITORY" // Git naming template environment variables BranchNameTemplateEnv = "JF_BRANCH_NAME_TEMPLATE" diff --git a/utils/git.go b/utils/git.go index 5cc6c02b8..b1b7b7300 100644 --- a/utils/git.go +++ b/utils/git.go @@ -119,7 +119,7 @@ func (gm *GitManager) SetLocalRepositoryAndRemoteName() (*GitManager, error) { var err error // Re-initialize the repository and update remoteName gm.remoteName = vcsutils.RemoteName - gm.localGitRepository, err = git.PlainOpen(".") + err = gm.SetLocalRepository() return gm, err } diff --git a/utils/params.go b/utils/params.go index 545ea125a..6c534b4a6 100644 --- a/utils/params.go +++ b/utils/params.go @@ -375,7 +375,7 @@ func (g *Git) extractScanRepositoryEnvParams(gitParamsFromEnv *Git) (err error) } } if !g.UseLocalRepository { - if g.UseLocalRepository, err = getBoolEnv(GitUseCurrentLocalRepositoryEnv, false); err != nil { + if g.UseLocalRepository, err = getBoolEnv(GitUseLocalRepositoryEnv, false); err != nil { return } }