Record docker build output in database
This commit is contained in:
@@ -149,6 +149,7 @@ CREATE TABLE runs (
|
|||||||
id UUID PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
pipeline UUID,
|
pipeline UUID,
|
||||||
in_progress BOOLEAN DEFAULT NULL,
|
in_progress BOOLEAN DEFAULT NULL,
|
||||||
|
build_output TEXT DEFAULT NULL,
|
||||||
result BIGINT DEFAULT NULL,
|
result BIGINT DEFAULT NULL,
|
||||||
stdout TEXT DEFAULT NULL,
|
stdout TEXT DEFAULT NULL,
|
||||||
stderr TEXT DEFAULT NULL,
|
stderr TEXT DEFAULT NULL,
|
||||||
|
|||||||
@@ -295,6 +295,19 @@ RETURNING id, pipeline, in_progress;`
|
|||||||
return run, nil
|
return run, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *Database) UpdateRunBuildOutput(runId uuid.UUID, buildResult string) error {
|
||||||
|
query := `
|
||||||
|
UPDATE runs
|
||||||
|
SET build_output=$1
|
||||||
|
WHERE id=$2;`
|
||||||
|
|
||||||
|
_, err := db.Conn.Exec(context.Background(),
|
||||||
|
query, buildResult, runId)
|
||||||
|
|
||||||
|
return err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (db *Database) UpdateRunResult(r Run) error {
|
func (db *Database) UpdateRunResult(r Run) error {
|
||||||
query := `
|
query := `
|
||||||
UPDATE runs
|
UPDATE runs
|
||||||
|
|||||||
@@ -146,7 +146,12 @@ func ExecutePipeline(pe PipelineExecution, db database.Database, pipelineConf co
|
|||||||
log.Errorf("could no read build response: %w", err)
|
log.Errorf("could no read build response: %w", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debugf("build log: %v", string(response))
|
|
||||||
|
err = db.UpdateRunBuildOutput(pe.Run.Id, string(response))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("could not update build output for run: %w", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = buildResponse.Body.Close()
|
err = buildResponse.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user