Exposed build output to api
This commit is contained in:
@@ -217,6 +217,16 @@ func createSchema(db database.Database) (graphql.Schema, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"buildOutput": &graphql.Field{
|
||||||
|
Type: graphql.String,
|
||||||
|
Description: "Logs of the top level container build for the run.",
|
||||||
|
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||||
|
if run, ok := p.Source.(database.Run); ok {
|
||||||
|
return string(run.BuildOutput), nil
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
},
|
||||||
|
},
|
||||||
"stdout": &graphql.Field{
|
"stdout": &graphql.Field{
|
||||||
Type: graphql.String,
|
Type: graphql.String,
|
||||||
Description: "The stdout used to validate the run.",
|
Description: "The stdout used to validate the run.",
|
||||||
|
|||||||
+2
-1
@@ -323,7 +323,7 @@ WHERE id=$5;`
|
|||||||
|
|
||||||
func (db *Database) GetRunsForPipeline(pipelineId uuid.UUID) ([]Run, error) {
|
func (db *Database) GetRunsForPipeline(pipelineId uuid.UUID) ([]Run, error) {
|
||||||
query := `
|
query := `
|
||||||
SELECT id, in_progress, result, stdout, stderr
|
SELECT id, in_progress, result, build_output, stdout, stderr
|
||||||
FROM runs
|
FROM runs
|
||||||
WHERE pipeline=$1;`
|
WHERE pipeline=$1;`
|
||||||
|
|
||||||
@@ -342,6 +342,7 @@ WHERE pipeline=$1;`
|
|||||||
&idStr,
|
&idStr,
|
||||||
&run.InProgress,
|
&run.InProgress,
|
||||||
&run.Result,
|
&run.Result,
|
||||||
|
&run.BuildOutput,
|
||||||
&run.Stdout,
|
&run.Stdout,
|
||||||
&run.Stderr,
|
&run.Stderr,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
|
|||||||
+7
-6
@@ -54,12 +54,13 @@ type Webhook struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Run struct {
|
type Run struct {
|
||||||
Id uuid.UUID
|
Id uuid.UUID
|
||||||
Pipeline uuid.UUID
|
Pipeline uuid.UUID
|
||||||
InProgress bool
|
InProgress bool
|
||||||
Result *int64
|
Result *int64
|
||||||
Stdout []byte
|
BuildOutput []byte
|
||||||
Stderr []byte
|
Stdout []byte
|
||||||
|
Stderr []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommandExecution struct {
|
type CommandExecution struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user