-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix git-init in case
master
is not the default branch
This fix will patch the `git-init` such that if user doesn't provides revision then instead of taking `master` as the default branch we are doing the `symbolic-link` to the HEAD branch. Also added e2e tests for it. Signed-off-by: vinamra28 <[email protected]>
- Loading branch information
Showing
7 changed files
with
166 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ func TestNewGitResource_Valid(t *testing.T) { | |
Name: "test-resource", | ||
Type: resourcev1alpha1.PipelineResourceTypeGit, | ||
URL: "[email protected]:test/test.git", | ||
Revision: "master", | ||
Revision: "", | ||
Refspec: "", | ||
GitImage: "override-with-git:latest", | ||
Submodules: true, | ||
|
@@ -96,7 +96,7 @@ func TestNewGitResource_Valid(t *testing.T) { | |
Name: "test-resource", | ||
Type: resourcev1alpha1.PipelineResourceTypeGit, | ||
URL: "[email protected]:test/test.git", | ||
Revision: "master", | ||
Revision: "", | ||
Refspec: "refs/changes/22/222134", | ||
GitImage: "override-with-git:latest", | ||
Submodules: true, | ||
|
@@ -117,7 +117,7 @@ func TestNewGitResource_Valid(t *testing.T) { | |
Name: "test-resource", | ||
Type: resourcev1alpha1.PipelineResourceTypeGit, | ||
URL: "[email protected]:test/test.git", | ||
Revision: "master", | ||
Revision: "", | ||
Refspec: "", | ||
GitImage: "override-with-git:latest", | ||
Submodules: true, | ||
|
@@ -675,6 +675,44 @@ func TestGitResource_GetDownloadTaskModifier(t *testing.T) { | |
{Name: "NO_PROXY", Value: "no-proxy.git.com"}, | ||
}, | ||
}, | ||
}, { | ||
desc: "Without Refspec and without revision", | ||
gitResource: &git.Resource{ | ||
Name: "git-resource", | ||
Type: resourcev1alpha1.PipelineResourceTypeGit, | ||
URL: "[email protected]:test/test.git", | ||
Revision: "", | ||
Refspec: "", | ||
GitImage: "override-with-git:latest", | ||
Submodules: false, | ||
Depth: 1, | ||
SSLVerify: true, | ||
HTTPProxy: "http-proxy.git.com", | ||
HTTPSProxy: "https-proxy.git.com", | ||
NOProxy: "no-proxy.git.com", | ||
}, | ||
want: corev1.Container{ | ||
Name: "git-source-git-resource-twkr2", | ||
Image: "override-with-git:latest", | ||
Command: []string{"/ko-app/git-init"}, | ||
Args: []string{ | ||
"-url", | ||
"[email protected]:test/test.git", | ||
"-revision", | ||
"", | ||
"-path", | ||
"/test/test", | ||
"-submodules=false", | ||
}, | ||
WorkingDir: "/workspace", | ||
Env: []corev1.EnvVar{ | ||
{Name: "TEKTON_RESOURCE_NAME", Value: "git-resource"}, | ||
{Name: "HOME", Value: pipeline.HomeDir}, | ||
{Name: "HTTP_PROXY", Value: "http-proxy.git.com"}, | ||
{Name: "HTTPS_PROXY", Value: "https-proxy.git.com"}, | ||
{Name: "NO_PROXY", Value: "no-proxy.git.com"}, | ||
}, | ||
}, | ||
}} { | ||
t.Run(tc.desc, func(t *testing.T) { | ||
ts := v1beta1.TaskSpec{} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters