Add support for viewing pipeline run output

This commit is contained in:
2023-02-25 00:46:55 -07:00
parent dcc334c157
commit a41c12d20c
8 changed files with 1076 additions and 95 deletions
+162
View File
@@ -240,6 +240,112 @@ func (v *GetCloneCredentialsResponse) GetCloneCredentials() []*GetCloneCredentia
return v.CloneCredentials
}
// GetPipelinePipeline includes the requested fields of the GraphQL type Pipeline.
// The GraphQL type's documentation follows.
//
// A pipeline for running ci jobs
type GetPipelinePipeline struct {
// The id of the pipeline.
Id string `json:"id"`
// The name of the pipeline.
Name string `json:"name"`
// The url of the pipeline.
Url string `json:"url"`
// The polling interval for the pipeline.
PollInterval int `json:"pollInterval"`
// The configured credential for cloning the pipeline source.
CloneCredential *GetPipelinePipelineCloneCredential `json:"cloneCredential"`
// The list of runs for the pipeline.
Runs []GetPipelinePipelineRunsRun `json:"runs"`
}
// GetId returns GetPipelinePipeline.Id, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetId() string { return v.Id }
// GetName returns GetPipelinePipeline.Name, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetName() string { return v.Name }
// GetUrl returns GetPipelinePipeline.Url, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetUrl() string { return v.Url }
// GetPollInterval returns GetPipelinePipeline.PollInterval, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetPollInterval() int { return v.PollInterval }
// GetCloneCredential returns GetPipelinePipeline.CloneCredential, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetCloneCredential() *GetPipelinePipelineCloneCredential {
return v.CloneCredential
}
// GetRuns returns GetPipelinePipeline.Runs, and is useful for accessing the field via an interface.
func (v *GetPipelinePipeline) GetRuns() []GetPipelinePipelineRunsRun { return v.Runs }
// GetPipelinePipelineCloneCredential includes the requested fields of the GraphQL type CloneCredential.
// The GraphQL type's documentation follows.
//
// A credential for authenticating with the pipeline source host.
type GetPipelinePipelineCloneCredential struct {
// The id of the credential.
Id string `json:"id"`
// The name of the credential.
Name string `json:"name"`
// The credential type.
Type string `json:"type"`
}
// GetId returns GetPipelinePipelineCloneCredential.Id, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineCloneCredential) GetId() string { return v.Id }
// GetName returns GetPipelinePipelineCloneCredential.Name, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineCloneCredential) GetName() string { return v.Name }
// GetType returns GetPipelinePipelineCloneCredential.Type, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineCloneCredential) GetType() string { return v.Type }
// GetPipelinePipelineRunsRun includes the requested fields of the GraphQL type Run.
// The GraphQL type's documentation follows.
//
// A pipeline run
type GetPipelinePipelineRunsRun struct {
// The id of the run.
Id string `json:"id"`
// The progress status of the run.
InProgress *bool `json:"inProgress"`
// The result of the run.
Result *float64 `json:"result"`
// Logs of the top level container build for the run.
BuildOutput *string `json:"buildOutput"`
// The stdout used to validate the run.
Stdout *string `json:"stdout"`
// The stderr used to validate the run.
Stderr *string `json:"stderr"`
}
// GetId returns GetPipelinePipelineRunsRun.Id, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetId() string { return v.Id }
// GetInProgress returns GetPipelinePipelineRunsRun.InProgress, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetInProgress() *bool { return v.InProgress }
// GetResult returns GetPipelinePipelineRunsRun.Result, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetResult() *float64 { return v.Result }
// GetBuildOutput returns GetPipelinePipelineRunsRun.BuildOutput, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetBuildOutput() *string { return v.BuildOutput }
// GetStdout returns GetPipelinePipelineRunsRun.Stdout, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetStdout() *string { return v.Stdout }
// GetStderr returns GetPipelinePipelineRunsRun.Stderr, and is useful for accessing the field via an interface.
func (v *GetPipelinePipelineRunsRun) GetStderr() *string { return v.Stderr }
// GetPipelineResponse is returned by GetPipeline on success.
type GetPipelineResponse struct {
Pipeline *GetPipelinePipeline `json:"Pipeline"`
}
// GetPipeline returns GetPipelineResponse.Pipeline, and is useful for accessing the field via an interface.
func (v *GetPipelineResponse) GetPipeline() *GetPipelinePipeline { return v.Pipeline }
// GetPipelinesPipelinesPipeline includes the requested fields of the GraphQL type Pipeline.
// The GraphQL type's documentation follows.
//
@@ -387,6 +493,14 @@ func (v *__CreateWebhookInput) GetWebhookType() string { return v.WebhookType }
// GetPipelineId returns __CreateWebhookInput.PipelineId, and is useful for accessing the field via an interface.
func (v *__CreateWebhookInput) GetPipelineId() string { return v.PipelineId }
// __GetPipelineInput is used internally by genqlient
type __GetPipelineInput struct {
Id string `json:"id"`
}
// GetId returns __GetPipelineInput.Id, and is useful for accessing the field via an interface.
func (v *__GetPipelineInput) GetId() string { return v.Id }
func CreateCloneCredential(
ctx context.Context,
client graphql.Client,
@@ -610,6 +724,54 @@ query GetCloneCredentials {
return &data, err
}
func GetPipeline(
ctx context.Context,
client graphql.Client,
id string,
) (*GetPipelineResponse, error) {
req := &graphql.Request{
OpName: "GetPipeline",
Query: `
query GetPipeline ($id: String!) {
Pipeline(id: $id) {
id
name
url
pollInterval
cloneCredential {
id
name
type
}
runs {
id
inProgress
result
buildOutput
stdout
stderr
}
}
}
`,
Variables: &__GetPipelineInput{
Id: id,
},
}
var err error
var data GetPipelineResponse
resp := &graphql.Response{Data: &data}
err = client.MakeRequest(
ctx,
req,
resp,
)
return &data, err
}
func GetPipelines(
ctx context.Context,
client graphql.Client,