Skip to content

Commit 50706b2

Browse files
committed
hide validate since it is super experimental
1 parent c9bbcf9 commit 50706b2

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

cmd/src/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ The commands are:
3737
actions runs actions to generate patch sets (experimental)
3838
campaigns manages campaigns (experimental)
3939
lsif manages LSIF data
40-
validate validate a Sourcegraph instance
4140
version display and compare the src-cli version against the recommended version for your instance
4241
4342
Use "src [command] -h" for more information about a command.

cmd/src/validate.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func (vd *validator) validate(script []byte, scriptContext map[string]string) er
126126
"src_delete_external_service": vd.deleteExternalService,
127127
"src_search_match_count": vd.searchMatchCount,
128128
"src_list_cloned_repos": vd.listClonedRepos,
129+
"src_wait_repo_cloned": vd.waitRepoCloned,
129130
"src_sleep_seconds": vd.sleepSeconds,
130131
"src_log": vd.log,
131132
"src_run_graphql": vd.runGraphQL,
@@ -260,6 +261,22 @@ func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error)
260261
return names, err
261262
}
262263

264+
func (vd *validator) waitRepoCloned(repoName string, sleepSeconds int, maxTries int) error {
265+
nameFilter := []string{repoName}
266+
267+
for i := 0; i < maxTries; i++ {
268+
names, err := vd.listClonedRepos(nameFilter)
269+
if err != nil {
270+
return err
271+
}
272+
if len(names) == 1 {
273+
return nil
274+
}
275+
time.Sleep(time.Second * time.Duration(sleepSeconds))
276+
}
277+
return fmt.Errorf("repo %s not cloned after %d tries", repoName, maxTries)
278+
}
279+
263280
func (vd *validator) log(line string) {
264281
fmt.Println(line)
265282
}

0 commit comments

Comments
 (0)