Skip to content

Commit 5981018

Browse files
authored
test: fix SSM credential helper entry to use explicit hostname (#1803)
Some versions of git do not support wildcards in the credential helper host name matching. This issue was encountered in the test environment, which was not correctly using the credential helper. This change fixes the test runner and increases the portability/explicitness of the credential helper.
1 parent d728b5e commit 5981018

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

e2e/nomostest/gitproviders/repository.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,11 @@ func (g *ReadWriteRepository) Init() error {
283283
[]string{"config", fmt.Sprintf("credential.%s.helper", testing.CSRHost), "gcloud.sh"})
284284
}
285285
if g.GitProvider.Type() == e2e.SSM {
286+
hostName := g.GitProvider.(*SSMClient).hostName()
286287
cmds = append(cmds,
287288
// Use credential helper script to provide information that Git needs to
288289
// connect securely to SSM using Google Account credentials.
289-
[]string{"config", "credential.https://*.*.sourcemanager.dev.helper", "gcloud.sh"})
290+
[]string{"config", fmt.Sprintf("credential.%s.helper", hostName), "gcloud.sh"})
290291
}
291292
return g.BulkGit(cmds...)
292293
}

e2e/nomostest/gitproviders/secure_source_manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ func (c *SSMClient) RemoteURL(name string) (string, error) {
7777

7878
// SyncURL returns a URL for Config Sync to sync from.
7979
func (c *SSMClient) SyncURL(name string) string {
80-
return fmt.Sprintf("https://%s-%s-git.%s.sourcemanager.dev/%s/%s", c.instanceID, c.projectNumber, c.region, c.project, name)
80+
return fmt.Sprintf("%s/%s/%s", c.hostName(), c.project, name)
81+
}
82+
83+
func (c *SSMClient) hostName() string {
84+
return fmt.Sprintf("https://%s-%s-git.%s.sourcemanager.dev", c.instanceID, c.projectNumber, c.region)
8185
}
8286

8387
func (c *SSMClient) login() error {

0 commit comments

Comments
 (0)