Skip to content

Commit

Permalink
chore: fix CI (#11022)
Browse files Browse the repository at this point in the history
* chore: fix CI

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* no more set global

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Oct 21, 2022
1 parent c7dd9bc commit 27af817
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 4 additions & 1 deletion test/e2e/fixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,8 @@ func Declarative(filename string, values interface{}) (string, error) {
}

func CreateSubmoduleRepos(repoType string) {
oldEnv := os.Getenv("GIT_ALLOW_PROTOCOL")
CheckError(os.Setenv("GIT_ALLOW_PROTOCOL", "file"))

// set-up submodule repo
FailOnErr(Run("", "cp", "-Rf", "testdata/git-submodule/", submoduleDirectory()))
Expand All @@ -751,7 +753,6 @@ func CreateSubmoduleRepos(repoType string) {
FailOnErr(Run(submoduleParentDirectory(), "chmod", "777", "."))
FailOnErr(Run(submoduleParentDirectory(), "git", "init"))
FailOnErr(Run(submoduleParentDirectory(), "git", "add", "."))
FailOnErr(Run(submoduleParentDirectory(), "git", "config", "--global", "protocol.file.allow", "always"))
FailOnErr(Run(submoduleParentDirectory(), "git", "submodule", "add", "-b", "master", "../submodule.git", "submodule/test"))
if repoType == "ssh" {
FailOnErr(Run(submoduleParentDirectory(), "git", "config", "--file=.gitmodules", "submodule.submodule/test.url", RepoURL(RepoURLTypeSSHSubmodule)))
Expand All @@ -765,6 +766,8 @@ func CreateSubmoduleRepos(repoType string) {
FailOnErr(Run(submoduleParentDirectory(), "git", "remote", "add", "origin", os.Getenv("ARGOCD_E2E_GIT_SERVICE_SUBMODULE_PARENT")))
FailOnErr(Run(submoduleParentDirectory(), "git", "push", "origin", "master", "-f"))
}

CheckError(os.Setenv("GIT_ALLOW_PROTOCOL", oldEnv))
}

// RestartRepoServer performs a restart of the repo server deployment and waits
Expand Down
7 changes: 1 addition & 6 deletions util/git/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ func Test_nativeGitClient_Submodule(t *testing.T) {
require.NoError(t, err)

// Embed repository bar into repository foo
cmd = exec.Command("git", "config", "--global", "protocol.file.allow", "always")
cmd.Dir = foo
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
require.NoError(t, err)
t.Setenv("GIT_ALLOW_PROTOCOL", "file")
cmd = exec.Command("git", "submodule", "add", bar)
cmd.Dir = foo
cmd.Stdout = os.Stdout
Expand Down

0 comments on commit 27af817

Please sign in to comment.