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": case "access_key":
userKey = addAccessKey(&userProject.ID) userKey = addAccessKey(&userProject.ID)
case "repository": case "repository":
pRepo, err := store.Sql().Exec( pRepo, err := store.CreateRepository(db.Repository{
"insert into project__repository (project_id, git_url, ssh_key_id, name) values (?, ?, ?, ?)", ProjectID: userProject.ID,
userProject.ID, "git@github.com/ansible,semaphore/semaphore", userKey.ID, "ITR-"+uid) GitURL: "git@github.com/ansible,semaphore/semaphore",
GitBranch: "develop",
SSHKeyID: userKey.ID,
Name: "ITR-" + uid,
})
printError(err) printError(err)
repoID, _ = pRepo.LastInsertId() repoID = int64(pRepo.ID)
case "inventory": case "inventory":
res, err := store.Sql().Exec( res, err := store.Sql().Exec(
"insert into project__inventory (project_id, name, type, ssh_key_id, inventory) values (?, ?, ?, ?, ?)", "insert into project__inventory (project_id, name, type, ssh_key_id, inventory) values (?, ?, ?, ?, ?)",