fix(ci): capabilities

This commit is contained in:
Denis Gukov 2021-03-13 01:20:18 +05:00
parent d0392485eb
commit ac2132f290
5 changed files with 14 additions and 6 deletions

View File

@ -26,7 +26,7 @@ var templateID int64
var capabilities = map[string][]string{
"user": {},
"project": {"user"},
"access_key": {"project"},
//"access_key": {"project"},
"repository": {"access_key"},
"inventory": {"repository"},
"environment": {"repository"},

View File

@ -98,7 +98,7 @@ func (p *taskPool) run() {
p.queue = append(p.queue[1:], t)
continue
}
log.Info("Set resourse locker with task " + strconv.Itoa(t.task.ID))
log.Info("Set resource locker with task " + strconv.Itoa(t.task.ID))
resourceLocker <- &resourceLock{lock: true, holder: t}
if !t.prepared {
go t.prepareRun()

View File

@ -52,7 +52,7 @@ func (t *task) prepareRun() {
defer func() {
log.Info("Stopped preparing task " + strconv.Itoa(t.task.ID))
log.Info("Release resourse locker with task " + strconv.Itoa(t.task.ID))
log.Info("Release resource locker with task " + strconv.Itoa(t.task.ID))
resourceLocker <- &resourceLock{lock: false, holder: t}
objType := taskTypeID

View File

@ -85,23 +85,31 @@ func (d *SqlDb) GetProjectTasks(projectID int, params db.RetrieveQueryParams) ([
}
func (d *SqlDb) DeleteTaskWithOutputs(projectID int, taskID int) (err error) {
// check if task exists in the project
_, err = d.GetTask(projectID, taskID)
if err != nil {
return
}
_, err = d.sql.Exec("delete from task__output where project_id=? AND task_id=?", projectID, taskID)
_, err = d.sql.Exec("delete from task__output where task_id=?", taskID)
if err != nil {
return
}
_, err = d.sql.Exec("delete from task where id=?", projectID, taskID)
_, err = d.sql.Exec("delete from task where id=?", taskID)
return
}
func (d *SqlDb) GetTaskOutputs(projectID int, taskID int) (output []db.TaskOutput, err error) {
// check if task exists in the project
_, err = d.GetTask(projectID, taskID)
if err != nil {
return
}
_, err = d.sql.Select(&output,
"select task_id, task, time, output from task__output where task_id=? order by time asc",
taskID)

2
go.mod
View File

@ -39,7 +39,7 @@ require (
github.com/radovskyb/watcher v1.0.7 // indirect
github.com/russross/blackfriday v1.5.2
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa // indirect
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/cobra v0.0.5 // indirect
github.com/ziutek/mymysql v1.5.4 // indirect
golang.org/x/crypto v0.0.0-20200208060501-ecb85df21340