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 1b65c3f commit fe565dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion test/e2e/fixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,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 @@ -780,7 +782,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 @@ -794,6 +795,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
3 changes: 1 addition & 2 deletions util/git/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ func Test_nativeGitClient_Submodule(t *testing.T) {
require.NoError(t, err)

// Embed repository bar into repository foo
err = runCmd(foo, "git", "config", "--global", "protocol.file.allow", "always")
require.NoError(t, err)
t.Setenv("GIT_ALLOW_PROTOCOL", "file")
err = runCmd(foo, "git", "submodule", "add", bar)
require.NoError(t, err)

Expand Down

0 comments on commit fe565dc

Please sign in to comment.