test: create repo via store

This commit is contained in:
Denis Gukov 2022-11-07 02:12:39 +05:00
parent bf32821820
commit 5196cf3e45

View File

@ -80,11 +80,15 @@ func resolveCapability(caps []string, resolved []string, uid string) {
case "access_key":
userKey = addAccessKey(&userProject.ID)
case "repository":
pRepo, err := store.Sql().Exec(
"insert into project__repository (project_id, git_url, ssh_key_id, name) values (?, ?, ?, ?)",
userProject.ID, "git@github.com/ansible,semaphore/semaphore", userKey.ID, "ITR-"+uid)
pRepo, err := store.CreateRepository(db.Repository{
ProjectID: userProject.ID,
GitURL: "git@github.com/ansible,semaphore/semaphore",
GitBranch: "develop",
SSHKeyID: userKey.ID,
Name: "ITR-" + uid,
})
printError(err)
repoID, _ = pRepo.LastInsertId()
repoID = int64(pRepo.ID)
case "inventory":
res, err := store.Sql().Exec(
"insert into project__inventory (project_id, name, type, ssh_key_id, inventory) values (?, ?, ?, ?, ?)",