diff --git a/.changelog/4042.txt b/.changelog/4042.txt new file mode 100644 index 00000000000..5736f459d85 --- /dev/null +++ b/.changelog/4042.txt @@ -0,0 +1,4 @@ +```release-note:improvement +cli: Introduce new CLI flag `-reattach` for `waypoint pipeline run` which will stream +an existing pipeline run either by the latest known run or a specific sequence id. +``` diff --git a/internal/cli/pipeline_run.go b/internal/cli/pipeline_run.go index 46d48dacc2e..8b6f11045cf 100644 --- a/internal/cli/pipeline_run.go +++ b/internal/cli/pipeline_run.go @@ -17,7 +17,9 @@ import ( type PipelineRunCommand struct { *baseCommand - flagPipelineId string + flagPipelineId string + flagReattachRun bool + flagRunSequence int } func (c *PipelineRunCommand) Run(args []string) int { @@ -49,6 +51,15 @@ func (c *PipelineRunCommand) Run(args []string) int { terminal.WithWarningStyle()) } + if c.flagRunSequence > 0 && !c.flagReattachRun { + c.ui.Output("The '-run' flag was specified, automatically assuming '-reattach'. "+ + "CLI will attempt to reattach to pipeline run %d", + c.flagRunSequence, + terminal.WithWarningStyle()) + + c.flagReattachRun = true + } + err := c.DoApp(c.Ctx, func(ctx context.Context, app *clientpkg.App) error { // setup pipeline name to be used for UI printing pipelineIdent := pipelineName @@ -56,19 +67,28 @@ func (c *PipelineRunCommand) Run(args []string) int { pipelineIdent = c.flagPipelineId } - app.UI.Output("Running pipeline %q for application %q", - pipelineIdent, app.Ref().Application, terminal.WithHeaderStyle()) + if c.flagReattachRun { + app.UI.Output("Streaming pipeline %q run for application %q", + pipelineIdent, app.Ref().Application, terminal.WithHeaderStyle()) + } else { + app.UI.Output("Running pipeline %q for application %q", + pipelineIdent, app.Ref().Application, terminal.WithHeaderStyle()) + } sg := app.UI.StepGroup() defer sg.Wait() - step := sg.Add("Syncing pipeline configs...") + step := sg.Add("") defer step.Abort() - _, err := app.ConfigSync(ctx, &pb.Job_ConfigSyncOp{}) - if err != nil { - app.UI.Output(clierrors.Humanize(err), terminal.WithErrorStyle()) - return ErrSentinel + if !c.flagReattachRun { + step.Update("Syncing pipeline configs...") + + _, err := app.ConfigSync(ctx, &pb.Job_ConfigSyncOp{}) + if err != nil { + app.UI.Output(clierrors.Humanize(err), terminal.WithErrorStyle()) + return ErrSentinel + } } step.Update("Building pipeline execution request...") @@ -103,28 +123,75 @@ func (c *PipelineRunCommand) Run(args []string) int { } } - step.Update("Requesting to queue run of pipeline %q...", pipelineIdent) + var ( + resp *pb.RunPipelineResponse + respGet *pb.GetPipelineRunResponse + allRunJobs []string + steps int + runSeq uint64 - // take pipeline id and queue a RunPipeline with a Job Template. - resp, err := c.project.Client().RunPipeline(c.Ctx, runPipelineReq) - if err != nil { - return err - } + err error + ) + if !c.flagReattachRun { + step.Update("Requesting to queue run of pipeline %q...", pipelineIdent) - step.Update("Pipeline %q has started running. Attempting to read job stream sequentially in order", pipelineIdent) - step.Done() + // take pipeline id and queue a RunPipeline with a Job Template. + resp, err = c.project.Client().RunPipeline(c.Ctx, runPipelineReq) + if err != nil { + return err + } + + step.Update("Pipeline %q has started running. Attempting to read job stream sequentially in order", pipelineIdent) + step.Done() + steps = len(resp.JobMap) + allRunJobs = resp.AllJobIds + runSeq = resp.Sequence + } else { + getPipelineReq := &pb.GetPipelineRequest{ + Pipeline: runPipelineReq.Pipeline, + } + + if c.flagRunSequence == 0 { + // take pipeline id and queue a RunPipeline with a Job Template. + respGet, err = c.project.Client().GetLatestPipelineRun(c.Ctx, getPipelineReq) + if err != nil { + return err + } + } else { + // take pipeline id and queue a RunPipeline with a Job Template. + respGet, err = c.project.Client().GetPipelineRun(c.Ctx, &pb.GetPipelineRunRequest{ + Pipeline: getPipelineReq.Pipeline, + Sequence: uint64(c.flagRunSequence), + }) + if err != nil { + return err + } + } + if respGet == nil { + app.UI.Output("Getting a pipeline run returned a nil response", terminal.WithErrorStyle()) + return fmt.Errorf("Response was empty when requesting a pipeline run for pipeline %q", pipelineIdent) + } + + step.Update("Attempting to read job stream sequentially in order for run %q", respGet.PipelineRun.Sequence) + step.Done() + + steps = len(respGet.PipelineRun.Jobs) + for _, j := range respGet.PipelineRun.Jobs { + allRunJobs = append(allRunJobs, j.Id) + } + runSeq = respGet.PipelineRun.Sequence + } // Receive job ids from running pipeline, use job client to attach to job stream // and stream here. First pass can be linear job streaming step = sg.Add("") defer step.Abort() - steps := len(resp.JobMap) - step.Update("%d steps detected, run sequence %d", steps, resp.Sequence) + step.Update("%d steps detected, run sequence %d", steps, runSeq) step.Done() successful := steps - for _, jobId := range resp.AllJobIds { + for _, jobId := range allRunJobs { job, err := c.project.Client().GetJob(c.Ctx, &pb.GetJobRequest{ JobId: jobId, }) @@ -143,7 +210,9 @@ func (c *PipelineRunCommand) Run(args []string) int { if job.Workspace != nil { ws = job.Workspace.Workspace } - app.UI.Output("Executing Step %q in workspace: %q", resp.JobMap[jobId].Step, ws, terminal.WithHeaderStyle()) + //app.UI.Output("Executing Step %q in workspace: %q", resp.JobMap[jobId].Step, ws, terminal.WithHeaderStyle()) + stepName := job.Pipeline.Step + app.UI.Output("Executing Step %q in workspace: %q", stepName, ws, terminal.WithHeaderStyle()) app.UI.Output("Reading job stream (jobId: %s)...", jobId, terminal.WithInfoStyle()) app.UI.Output("") @@ -193,6 +262,20 @@ func (c *PipelineRunCommand) Flags() *flag.Sets { Default: "", Usage: "Run a pipeline by ID.", }) + + f.BoolVar(&flag.BoolVar{ + Name: "reattach", + Target: &c.flagReattachRun, + Default: false, + Usage: "If set, will replay or reattach to an existing pipeline run. If " + + "'-run' is not specified, will attempt to read the latest run.", + }) + + f.IntVar(&flag.IntVar{ + Name: "run", + Target: &c.flagRunSequence, + Usage: "Replay or attach to a specific pipeline run by sequence number.", + }) }) } @@ -212,10 +295,14 @@ func (c *PipelineRunCommand) Help() string { return formatHelp(` Usage: waypoint pipeline run [options] - Run a pipeline by name. If run outside of a project dir, a '-project' flag is + Run a pipeline by name. If run outside of a project dir, a '-project' flag is required. Before running a requested pipeline, this command will sync pipeline configs so it runs the most up to date configuration version for a pipeline. + If '-reattach' is supplied, the CLI will attempt to reattach to an existing + pipeline run. Defaults to latest, but if '-run' is specified, it will attach + to that specific run by sequence number. + ` + c.Flags().Help()) } diff --git a/pkg/server/gen/mocks/waypoint_client.go b/pkg/server/gen/mocks/waypoint_client.go index 8d53ded105f..0abfa914845 100644 --- a/pkg/server/gen/mocks/waypoint_client.go +++ b/pkg/server/gen/mocks/waypoint_client.go @@ -1008,6 +1008,36 @@ func (_m *WaypointClient) GetLatestBuild(ctx context.Context, in *gen.GetLatestB return r0, r1 } +// GetLatestPipelineRun provides a mock function with given fields: ctx, in, opts +func (_m *WaypointClient) GetLatestPipelineRun(ctx context.Context, in *gen.GetPipelineRequest, opts ...grpc.CallOption) (*gen.GetPipelineRunResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *gen.GetPipelineRunResponse + if rf, ok := ret.Get(0).(func(context.Context, *gen.GetPipelineRequest, ...grpc.CallOption) *gen.GetPipelineRunResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gen.GetPipelineRunResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gen.GetPipelineRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetLatestPushedArtifact provides a mock function with given fields: ctx, in, opts func (_m *WaypointClient) GetLatestPushedArtifact(ctx context.Context, in *gen.GetLatestPushedArtifactRequest, opts ...grpc.CallOption) (*gen.PushedArtifact, error) { _va := make([]interface{}, len(opts)) diff --git a/pkg/server/gen/mocks/waypoint_server.go b/pkg/server/gen/mocks/waypoint_server.go index ed1eed9b585..0f58cebe0e3 100644 --- a/pkg/server/gen/mocks/waypoint_server.go +++ b/pkg/server/gen/mocks/waypoint_server.go @@ -730,6 +730,29 @@ func (_m *WaypointServer) GetLatestBuild(_a0 context.Context, _a1 *gen.GetLatest return r0, r1 } +// GetLatestPipelineRun provides a mock function with given fields: _a0, _a1 +func (_m *WaypointServer) GetLatestPipelineRun(_a0 context.Context, _a1 *gen.GetPipelineRequest) (*gen.GetPipelineRunResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *gen.GetPipelineRunResponse + if rf, ok := ret.Get(0).(func(context.Context, *gen.GetPipelineRequest) *gen.GetPipelineRunResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gen.GetPipelineRunResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gen.GetPipelineRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetLatestPushedArtifact provides a mock function with given fields: _a0, _a1 func (_m *WaypointServer) GetLatestPushedArtifact(_a0 context.Context, _a1 *gen.GetLatestPushedArtifactRequest) (*gen.PushedArtifact, error) { ret := _m.Called(_a0, _a1) diff --git a/pkg/server/gen/server.pb.go b/pkg/server/gen/server.pb.go index bb6b46ce6fe..4a4015d4dfc 100644 --- a/pkg/server/gen/server.pb.go +++ b/pkg/server/gen/server.pb.go @@ -32444,7 +32444,7 @@ var file_pkg_server_proto_server_proto_rawDesc = []byte{ 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x06, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x52, - 0x41, 0x47, 0x45, 0x10, 0x08, 0x32, 0xf9, 0x4f, 0x0a, 0x08, 0x57, 0x61, 0x79, 0x70, 0x6f, 0x69, + 0x41, 0x47, 0x45, 0x10, 0x08, 0x32, 0xe5, 0x50, 0x0a, 0x08, 0x57, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2a, 0x2e, 0x68, @@ -33036,56 +33036,63 @@ var file_pkg_server_proto_server_proto_rawDesc = []byte{ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, - 0x65, 0x73, 0x12, 0x28, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, - 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, - 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x68, - 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, - 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x73, 0x12, 0x2b, 0x2e, 0x68, 0x61, - 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x65, 0x12, 0x6a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x12, 0x26, 0x2e, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x47, + 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, + 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, + 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x28, + 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x2d, 0x2e, 0x68, - 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x70, 0x65, - 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x68, 0x61, - 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x70, 0x65, 0x6c, - 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x55, - 0x49, 0x5f, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x28, 0x2e, 0x68, - 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, - 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x47, - 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x73, 0x0a, 0x12, 0x55, 0x49, 0x5f, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, - 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, - 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x10, 0x55, 0x49, 0x5f, 0x47, 0x65, 0x74, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x2e, 0x68, 0x61, 0x73, - 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, - 0x55, 0x49, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, - 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, - 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0f, 0x55, 0x49, 0x5f, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x12, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x73, 0x12, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, + 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, + 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x73, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x79, 0x6e, 0x63, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x2d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, + 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, + 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x55, 0x49, 0x5f, 0x47, 0x65, + 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x28, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, + 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, + 0x12, 0x55, 0x49, 0x5f, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x12, 0x2d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, + 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, + 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x10, 0x55, 0x49, 0x5f, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, + 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x47, + 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, + 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x47, 0x65, 0x74, 0x44, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x6a, 0x0a, 0x0f, 0x55, 0x49, 0x5f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x73, 0x12, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x10, 0x5a, 0x0e, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, - 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x77, 0x61, 0x79, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x55, 0x49, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0x5a, + 0x0e, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -34283,118 +34290,120 @@ var file_pkg_server_proto_server_proto_depIdxs = []int32{ 210, // 721: hashicorp.waypoint.Waypoint.RunPipeline:input_type -> hashicorp.waypoint.RunPipelineRequest 208, // 722: hashicorp.waypoint.Waypoint.GetPipeline:input_type -> hashicorp.waypoint.GetPipelineRequest 216, // 723: hashicorp.waypoint.Waypoint.GetPipelineRun:input_type -> hashicorp.waypoint.GetPipelineRunRequest - 212, // 724: hashicorp.waypoint.Waypoint.ListPipelines:input_type -> hashicorp.waypoint.ListPipelinesRequest - 214, // 725: hashicorp.waypoint.Waypoint.ListPipelineRuns:input_type -> hashicorp.waypoint.ListPipelineRunsRequest - 218, // 726: hashicorp.waypoint.Waypoint.ConfigSyncPipeline:input_type -> hashicorp.waypoint.ConfigSyncPipelineRequest - 237, // 727: hashicorp.waypoint.Waypoint.UI_GetProject:input_type -> hashicorp.waypoint.UI.GetProjectRequest - 239, // 728: hashicorp.waypoint.Waypoint.UI_ListDeployments:input_type -> hashicorp.waypoint.UI.ListDeploymentsRequest - 241, // 729: hashicorp.waypoint.Waypoint.UI_GetDeployment:input_type -> hashicorp.waypoint.UI.GetDeploymentRequest - 244, // 730: hashicorp.waypoint.Waypoint.UI_ListReleases:input_type -> hashicorp.waypoint.UI.ListReleasesRequest - 26, // 731: hashicorp.waypoint.Waypoint.GetVersionInfo:output_type -> hashicorp.waypoint.GetVersionInfoResponse - 68, // 732: hashicorp.waypoint.Waypoint.ListOIDCAuthMethods:output_type -> hashicorp.waypoint.ListOIDCAuthMethodsResponse - 70, // 733: hashicorp.waypoint.Waypoint.GetOIDCAuthURL:output_type -> hashicorp.waypoint.GetOIDCAuthURLResponse - 72, // 734: hashicorp.waypoint.Waypoint.CompleteOIDCAuth:output_type -> hashicorp.waypoint.CompleteOIDCAuthResponse - 173, // 735: hashicorp.waypoint.Waypoint.NoAuthRunTrigger:output_type -> hashicorp.waypoint.RunTriggerResponse - 55, // 736: hashicorp.waypoint.Waypoint.GetUser:output_type -> hashicorp.waypoint.GetUserResponse - 56, // 737: hashicorp.waypoint.Waypoint.ListUsers:output_type -> hashicorp.waypoint.ListUsersResponse - 58, // 738: hashicorp.waypoint.Waypoint.UpdateUser:output_type -> hashicorp.waypoint.UpdateUserResponse - 450, // 739: hashicorp.waypoint.Waypoint.DeleteUser:output_type -> google.protobuf.Empty - 63, // 740: hashicorp.waypoint.Waypoint.UpsertAuthMethod:output_type -> hashicorp.waypoint.UpsertAuthMethodResponse - 65, // 741: hashicorp.waypoint.Waypoint.GetAuthMethod:output_type -> hashicorp.waypoint.GetAuthMethodResponse - 67, // 742: hashicorp.waypoint.Waypoint.ListAuthMethods:output_type -> hashicorp.waypoint.ListAuthMethodsResponse - 450, // 743: hashicorp.waypoint.Waypoint.DeleteAuthMethod:output_type -> google.protobuf.Empty - 110, // 744: hashicorp.waypoint.Waypoint.ListWorkspaces:output_type -> hashicorp.waypoint.ListWorkspacesResponse - 112, // 745: hashicorp.waypoint.Waypoint.GetWorkspace:output_type -> hashicorp.waypoint.GetWorkspaceResponse - 114, // 746: hashicorp.waypoint.Waypoint.UpsertWorkspace:output_type -> hashicorp.waypoint.UpsertWorkspaceResponse - 116, // 747: hashicorp.waypoint.Waypoint.UpsertProject:output_type -> hashicorp.waypoint.UpsertProjectResponse - 118, // 748: hashicorp.waypoint.Waypoint.GetProject:output_type -> hashicorp.waypoint.GetProjectResponse - 119, // 749: hashicorp.waypoint.Waypoint.ListProjects:output_type -> hashicorp.waypoint.ListProjectsResponse - 450, // 750: hashicorp.waypoint.Waypoint.DestroyProject:output_type -> google.protobuf.Empty - 122, // 751: hashicorp.waypoint.Waypoint.GetApplication:output_type -> hashicorp.waypoint.GetApplicationResponse - 124, // 752: hashicorp.waypoint.Waypoint.UpsertApplication:output_type -> hashicorp.waypoint.UpsertApplicationResponse - 128, // 753: hashicorp.waypoint.Waypoint.ListBuilds:output_type -> hashicorp.waypoint.ListBuildsResponse - 131, // 754: hashicorp.waypoint.Waypoint.GetBuild:output_type -> hashicorp.waypoint.Build - 131, // 755: hashicorp.waypoint.Waypoint.GetLatestBuild:output_type -> hashicorp.waypoint.Build - 146, // 756: hashicorp.waypoint.Waypoint.ListPushedArtifacts:output_type -> hashicorp.waypoint.ListPushedArtifactsResponse - 147, // 757: hashicorp.waypoint.Waypoint.GetPushedArtifact:output_type -> hashicorp.waypoint.PushedArtifact - 147, // 758: hashicorp.waypoint.Waypoint.GetLatestPushedArtifact:output_type -> hashicorp.waypoint.PushedArtifact - 152, // 759: hashicorp.waypoint.Waypoint.ListDeployments:output_type -> hashicorp.waypoint.ListDeploymentsResponse - 153, // 760: hashicorp.waypoint.Waypoint.GetDeployment:output_type -> hashicorp.waypoint.Deployment - 156, // 761: hashicorp.waypoint.Waypoint.ListInstances:output_type -> hashicorp.waypoint.ListInstancesResponse - 162, // 762: hashicorp.waypoint.Waypoint.ListReleases:output_type -> hashicorp.waypoint.ListReleasesResponse - 164, // 763: hashicorp.waypoint.Waypoint.GetRelease:output_type -> hashicorp.waypoint.Release - 164, // 764: hashicorp.waypoint.Waypoint.GetLatestRelease:output_type -> hashicorp.waypoint.Release - 184, // 765: hashicorp.waypoint.Waypoint.GetStatusReport:output_type -> hashicorp.waypoint.StatusReport - 184, // 766: hashicorp.waypoint.Waypoint.GetLatestStatusReport:output_type -> hashicorp.waypoint.StatusReport - 180, // 767: hashicorp.waypoint.Waypoint.ListStatusReports:output_type -> hashicorp.waypoint.ListStatusReportsResponse - 183, // 768: hashicorp.waypoint.Waypoint.ExpediteStatusReport:output_type -> hashicorp.waypoint.ExpediteStatusReportResponse - 186, // 769: hashicorp.waypoint.Waypoint.GetLogStream:output_type -> hashicorp.waypoint.LogBatch - 197, // 770: hashicorp.waypoint.Waypoint.StartExecStream:output_type -> hashicorp.waypoint.ExecStreamResponse - 189, // 771: hashicorp.waypoint.Waypoint.SetConfig:output_type -> hashicorp.waypoint.ConfigSetResponse - 191, // 772: hashicorp.waypoint.Waypoint.GetConfig:output_type -> hashicorp.waypoint.ConfigGetResponse - 450, // 773: hashicorp.waypoint.Waypoint.SetConfigSource:output_type -> google.protobuf.Empty - 195, // 774: hashicorp.waypoint.Waypoint.GetConfigSource:output_type -> hashicorp.waypoint.GetConfigSourceResponse - 104, // 775: hashicorp.waypoint.Waypoint.CreateHostname:output_type -> hashicorp.waypoint.CreateHostnameResponse - 450, // 776: hashicorp.waypoint.Waypoint.DeleteHostname:output_type -> google.protobuf.Empty - 106, // 777: hashicorp.waypoint.Waypoint.ListHostnames:output_type -> hashicorp.waypoint.ListHostnamesResponse - 74, // 778: hashicorp.waypoint.Waypoint.QueueJob:output_type -> hashicorp.waypoint.QueueJobResponse - 450, // 779: hashicorp.waypoint.Waypoint.CancelJob:output_type -> google.protobuf.Empty - 78, // 780: hashicorp.waypoint.Waypoint.GetJob:output_type -> hashicorp.waypoint.Job - 82, // 781: hashicorp.waypoint.Waypoint.ListJobs:output_type -> hashicorp.waypoint.ListJobsResponse - 77, // 782: hashicorp.waypoint.Waypoint.ValidateJob:output_type -> hashicorp.waypoint.ValidateJobResponse - 84, // 783: hashicorp.waypoint.Waypoint.GetJobStream:output_type -> hashicorp.waypoint.GetJobStreamResponse - 85, // 784: hashicorp.waypoint.Waypoint.GetRunner:output_type -> hashicorp.waypoint.Runner - 97, // 785: hashicorp.waypoint.Waypoint.ListRunners:output_type -> hashicorp.waypoint.ListRunnersResponse - 450, // 786: hashicorp.waypoint.Waypoint.AdoptRunner:output_type -> google.protobuf.Empty - 450, // 787: hashicorp.waypoint.Waypoint.ForgetRunner:output_type -> google.protobuf.Empty - 101, // 788: hashicorp.waypoint.Waypoint.GetServerConfig:output_type -> hashicorp.waypoint.GetServerConfigResponse - 450, // 789: hashicorp.waypoint.Waypoint.SetServerConfig:output_type -> google.protobuf.Empty - 230, // 790: hashicorp.waypoint.Waypoint.CreateSnapshot:output_type -> hashicorp.waypoint.CreateSnapshotResponse - 450, // 791: hashicorp.waypoint.Waypoint.RestoreSnapshot:output_type -> google.protobuf.Empty - 228, // 792: hashicorp.waypoint.Waypoint.BootstrapToken:output_type -> hashicorp.waypoint.NewTokenResponse - 224, // 793: hashicorp.waypoint.Waypoint.DecodeToken:output_type -> hashicorp.waypoint.DecodeTokenResponse - 228, // 794: hashicorp.waypoint.Waypoint.GenerateInviteToken:output_type -> hashicorp.waypoint.NewTokenResponse - 228, // 795: hashicorp.waypoint.Waypoint.GenerateLoginToken:output_type -> hashicorp.waypoint.NewTokenResponse - 228, // 796: hashicorp.waypoint.Waypoint.GenerateRunnerToken:output_type -> hashicorp.waypoint.NewTokenResponse - 228, // 797: hashicorp.waypoint.Waypoint.ConvertInviteToken:output_type -> hashicorp.waypoint.NewTokenResponse - 87, // 798: hashicorp.waypoint.Waypoint.RunnerToken:output_type -> hashicorp.waypoint.RunnerTokenResponse - 89, // 799: hashicorp.waypoint.Waypoint.RunnerConfig:output_type -> hashicorp.waypoint.RunnerConfigResponse - 92, // 800: hashicorp.waypoint.Waypoint.RunnerJobStream:output_type -> hashicorp.waypoint.RunnerJobStreamResponse - 94, // 801: hashicorp.waypoint.Waypoint.RunnerGetDeploymentConfig:output_type -> hashicorp.waypoint.RunnerGetDeploymentConfigResponse - 199, // 802: hashicorp.waypoint.Waypoint.EntrypointConfig:output_type -> hashicorp.waypoint.EntrypointConfigResponse - 450, // 803: hashicorp.waypoint.Waypoint.EntrypointLogStream:output_type -> google.protobuf.Empty - 203, // 804: hashicorp.waypoint.Waypoint.EntrypointExecStream:output_type -> hashicorp.waypoint.EntrypointExecResponse - 235, // 805: hashicorp.waypoint.Waypoint.WaypointHclFmt:output_type -> hashicorp.waypoint.WaypointHclFmtResponse - 135, // 806: hashicorp.waypoint.Waypoint.UpsertOnDemandRunnerConfig:output_type -> hashicorp.waypoint.UpsertOnDemandRunnerConfigResponse - 137, // 807: hashicorp.waypoint.Waypoint.GetOnDemandRunnerConfig:output_type -> hashicorp.waypoint.GetOnDemandRunnerConfigResponse - 139, // 808: hashicorp.waypoint.Waypoint.DeleteOnDemandRunnerConfig:output_type -> hashicorp.waypoint.DeleteOnDemandRunnerConfigResponse - 140, // 809: hashicorp.waypoint.Waypoint.ListOnDemandRunnerConfigs:output_type -> hashicorp.waypoint.ListOnDemandRunnerConfigsResponse - 126, // 810: hashicorp.waypoint.Waypoint.UpsertBuild:output_type -> hashicorp.waypoint.UpsertBuildResponse - 142, // 811: hashicorp.waypoint.Waypoint.UpsertPushedArtifact:output_type -> hashicorp.waypoint.UpsertPushedArtifactResponse - 150, // 812: hashicorp.waypoint.Waypoint.UpsertDeployment:output_type -> hashicorp.waypoint.UpsertDeploymentResponse - 159, // 813: hashicorp.waypoint.Waypoint.UpsertRelease:output_type -> hashicorp.waypoint.UpsertReleaseResponse - 177, // 814: hashicorp.waypoint.Waypoint.UpsertStatusReport:output_type -> hashicorp.waypoint.UpsertStatusReportResponse - 48, // 815: hashicorp.waypoint.Waypoint.GetTask:output_type -> hashicorp.waypoint.GetTaskResponse - 51, // 816: hashicorp.waypoint.Waypoint.ListTask:output_type -> hashicorp.waypoint.ListTaskResponse - 450, // 817: hashicorp.waypoint.Waypoint.CancelTask:output_type -> google.protobuf.Empty - 168, // 818: hashicorp.waypoint.Waypoint.UpsertTrigger:output_type -> hashicorp.waypoint.UpsertTriggerResponse - 170, // 819: hashicorp.waypoint.Waypoint.GetTrigger:output_type -> hashicorp.waypoint.GetTriggerResponse - 450, // 820: hashicorp.waypoint.Waypoint.DeleteTrigger:output_type -> google.protobuf.Empty - 175, // 821: hashicorp.waypoint.Waypoint.ListTriggers:output_type -> hashicorp.waypoint.ListTriggerResponse - 173, // 822: hashicorp.waypoint.Waypoint.RunTrigger:output_type -> hashicorp.waypoint.RunTriggerResponse - 207, // 823: hashicorp.waypoint.Waypoint.UpsertPipeline:output_type -> hashicorp.waypoint.UpsertPipelineResponse - 211, // 824: hashicorp.waypoint.Waypoint.RunPipeline:output_type -> hashicorp.waypoint.RunPipelineResponse - 209, // 825: hashicorp.waypoint.Waypoint.GetPipeline:output_type -> hashicorp.waypoint.GetPipelineResponse - 217, // 826: hashicorp.waypoint.Waypoint.GetPipelineRun:output_type -> hashicorp.waypoint.GetPipelineRunResponse - 213, // 827: hashicorp.waypoint.Waypoint.ListPipelines:output_type -> hashicorp.waypoint.ListPipelinesResponse - 215, // 828: hashicorp.waypoint.Waypoint.ListPipelineRuns:output_type -> hashicorp.waypoint.ListPipelineRunsResponse - 219, // 829: hashicorp.waypoint.Waypoint.ConfigSyncPipeline:output_type -> hashicorp.waypoint.ConfigSyncPipelineResponse - 238, // 830: hashicorp.waypoint.Waypoint.UI_GetProject:output_type -> hashicorp.waypoint.UI.GetProjectResponse - 240, // 831: hashicorp.waypoint.Waypoint.UI_ListDeployments:output_type -> hashicorp.waypoint.UI.ListDeploymentsResponse - 242, // 832: hashicorp.waypoint.Waypoint.UI_GetDeployment:output_type -> hashicorp.waypoint.UI.GetDeploymentResponse - 245, // 833: hashicorp.waypoint.Waypoint.UI_ListReleases:output_type -> hashicorp.waypoint.UI.ListReleasesResponse - 731, // [731:834] is the sub-list for method output_type - 628, // [628:731] is the sub-list for method input_type + 208, // 724: hashicorp.waypoint.Waypoint.GetLatestPipelineRun:input_type -> hashicorp.waypoint.GetPipelineRequest + 212, // 725: hashicorp.waypoint.Waypoint.ListPipelines:input_type -> hashicorp.waypoint.ListPipelinesRequest + 214, // 726: hashicorp.waypoint.Waypoint.ListPipelineRuns:input_type -> hashicorp.waypoint.ListPipelineRunsRequest + 218, // 727: hashicorp.waypoint.Waypoint.ConfigSyncPipeline:input_type -> hashicorp.waypoint.ConfigSyncPipelineRequest + 237, // 728: hashicorp.waypoint.Waypoint.UI_GetProject:input_type -> hashicorp.waypoint.UI.GetProjectRequest + 239, // 729: hashicorp.waypoint.Waypoint.UI_ListDeployments:input_type -> hashicorp.waypoint.UI.ListDeploymentsRequest + 241, // 730: hashicorp.waypoint.Waypoint.UI_GetDeployment:input_type -> hashicorp.waypoint.UI.GetDeploymentRequest + 244, // 731: hashicorp.waypoint.Waypoint.UI_ListReleases:input_type -> hashicorp.waypoint.UI.ListReleasesRequest + 26, // 732: hashicorp.waypoint.Waypoint.GetVersionInfo:output_type -> hashicorp.waypoint.GetVersionInfoResponse + 68, // 733: hashicorp.waypoint.Waypoint.ListOIDCAuthMethods:output_type -> hashicorp.waypoint.ListOIDCAuthMethodsResponse + 70, // 734: hashicorp.waypoint.Waypoint.GetOIDCAuthURL:output_type -> hashicorp.waypoint.GetOIDCAuthURLResponse + 72, // 735: hashicorp.waypoint.Waypoint.CompleteOIDCAuth:output_type -> hashicorp.waypoint.CompleteOIDCAuthResponse + 173, // 736: hashicorp.waypoint.Waypoint.NoAuthRunTrigger:output_type -> hashicorp.waypoint.RunTriggerResponse + 55, // 737: hashicorp.waypoint.Waypoint.GetUser:output_type -> hashicorp.waypoint.GetUserResponse + 56, // 738: hashicorp.waypoint.Waypoint.ListUsers:output_type -> hashicorp.waypoint.ListUsersResponse + 58, // 739: hashicorp.waypoint.Waypoint.UpdateUser:output_type -> hashicorp.waypoint.UpdateUserResponse + 450, // 740: hashicorp.waypoint.Waypoint.DeleteUser:output_type -> google.protobuf.Empty + 63, // 741: hashicorp.waypoint.Waypoint.UpsertAuthMethod:output_type -> hashicorp.waypoint.UpsertAuthMethodResponse + 65, // 742: hashicorp.waypoint.Waypoint.GetAuthMethod:output_type -> hashicorp.waypoint.GetAuthMethodResponse + 67, // 743: hashicorp.waypoint.Waypoint.ListAuthMethods:output_type -> hashicorp.waypoint.ListAuthMethodsResponse + 450, // 744: hashicorp.waypoint.Waypoint.DeleteAuthMethod:output_type -> google.protobuf.Empty + 110, // 745: hashicorp.waypoint.Waypoint.ListWorkspaces:output_type -> hashicorp.waypoint.ListWorkspacesResponse + 112, // 746: hashicorp.waypoint.Waypoint.GetWorkspace:output_type -> hashicorp.waypoint.GetWorkspaceResponse + 114, // 747: hashicorp.waypoint.Waypoint.UpsertWorkspace:output_type -> hashicorp.waypoint.UpsertWorkspaceResponse + 116, // 748: hashicorp.waypoint.Waypoint.UpsertProject:output_type -> hashicorp.waypoint.UpsertProjectResponse + 118, // 749: hashicorp.waypoint.Waypoint.GetProject:output_type -> hashicorp.waypoint.GetProjectResponse + 119, // 750: hashicorp.waypoint.Waypoint.ListProjects:output_type -> hashicorp.waypoint.ListProjectsResponse + 450, // 751: hashicorp.waypoint.Waypoint.DestroyProject:output_type -> google.protobuf.Empty + 122, // 752: hashicorp.waypoint.Waypoint.GetApplication:output_type -> hashicorp.waypoint.GetApplicationResponse + 124, // 753: hashicorp.waypoint.Waypoint.UpsertApplication:output_type -> hashicorp.waypoint.UpsertApplicationResponse + 128, // 754: hashicorp.waypoint.Waypoint.ListBuilds:output_type -> hashicorp.waypoint.ListBuildsResponse + 131, // 755: hashicorp.waypoint.Waypoint.GetBuild:output_type -> hashicorp.waypoint.Build + 131, // 756: hashicorp.waypoint.Waypoint.GetLatestBuild:output_type -> hashicorp.waypoint.Build + 146, // 757: hashicorp.waypoint.Waypoint.ListPushedArtifacts:output_type -> hashicorp.waypoint.ListPushedArtifactsResponse + 147, // 758: hashicorp.waypoint.Waypoint.GetPushedArtifact:output_type -> hashicorp.waypoint.PushedArtifact + 147, // 759: hashicorp.waypoint.Waypoint.GetLatestPushedArtifact:output_type -> hashicorp.waypoint.PushedArtifact + 152, // 760: hashicorp.waypoint.Waypoint.ListDeployments:output_type -> hashicorp.waypoint.ListDeploymentsResponse + 153, // 761: hashicorp.waypoint.Waypoint.GetDeployment:output_type -> hashicorp.waypoint.Deployment + 156, // 762: hashicorp.waypoint.Waypoint.ListInstances:output_type -> hashicorp.waypoint.ListInstancesResponse + 162, // 763: hashicorp.waypoint.Waypoint.ListReleases:output_type -> hashicorp.waypoint.ListReleasesResponse + 164, // 764: hashicorp.waypoint.Waypoint.GetRelease:output_type -> hashicorp.waypoint.Release + 164, // 765: hashicorp.waypoint.Waypoint.GetLatestRelease:output_type -> hashicorp.waypoint.Release + 184, // 766: hashicorp.waypoint.Waypoint.GetStatusReport:output_type -> hashicorp.waypoint.StatusReport + 184, // 767: hashicorp.waypoint.Waypoint.GetLatestStatusReport:output_type -> hashicorp.waypoint.StatusReport + 180, // 768: hashicorp.waypoint.Waypoint.ListStatusReports:output_type -> hashicorp.waypoint.ListStatusReportsResponse + 183, // 769: hashicorp.waypoint.Waypoint.ExpediteStatusReport:output_type -> hashicorp.waypoint.ExpediteStatusReportResponse + 186, // 770: hashicorp.waypoint.Waypoint.GetLogStream:output_type -> hashicorp.waypoint.LogBatch + 197, // 771: hashicorp.waypoint.Waypoint.StartExecStream:output_type -> hashicorp.waypoint.ExecStreamResponse + 189, // 772: hashicorp.waypoint.Waypoint.SetConfig:output_type -> hashicorp.waypoint.ConfigSetResponse + 191, // 773: hashicorp.waypoint.Waypoint.GetConfig:output_type -> hashicorp.waypoint.ConfigGetResponse + 450, // 774: hashicorp.waypoint.Waypoint.SetConfigSource:output_type -> google.protobuf.Empty + 195, // 775: hashicorp.waypoint.Waypoint.GetConfigSource:output_type -> hashicorp.waypoint.GetConfigSourceResponse + 104, // 776: hashicorp.waypoint.Waypoint.CreateHostname:output_type -> hashicorp.waypoint.CreateHostnameResponse + 450, // 777: hashicorp.waypoint.Waypoint.DeleteHostname:output_type -> google.protobuf.Empty + 106, // 778: hashicorp.waypoint.Waypoint.ListHostnames:output_type -> hashicorp.waypoint.ListHostnamesResponse + 74, // 779: hashicorp.waypoint.Waypoint.QueueJob:output_type -> hashicorp.waypoint.QueueJobResponse + 450, // 780: hashicorp.waypoint.Waypoint.CancelJob:output_type -> google.protobuf.Empty + 78, // 781: hashicorp.waypoint.Waypoint.GetJob:output_type -> hashicorp.waypoint.Job + 82, // 782: hashicorp.waypoint.Waypoint.ListJobs:output_type -> hashicorp.waypoint.ListJobsResponse + 77, // 783: hashicorp.waypoint.Waypoint.ValidateJob:output_type -> hashicorp.waypoint.ValidateJobResponse + 84, // 784: hashicorp.waypoint.Waypoint.GetJobStream:output_type -> hashicorp.waypoint.GetJobStreamResponse + 85, // 785: hashicorp.waypoint.Waypoint.GetRunner:output_type -> hashicorp.waypoint.Runner + 97, // 786: hashicorp.waypoint.Waypoint.ListRunners:output_type -> hashicorp.waypoint.ListRunnersResponse + 450, // 787: hashicorp.waypoint.Waypoint.AdoptRunner:output_type -> google.protobuf.Empty + 450, // 788: hashicorp.waypoint.Waypoint.ForgetRunner:output_type -> google.protobuf.Empty + 101, // 789: hashicorp.waypoint.Waypoint.GetServerConfig:output_type -> hashicorp.waypoint.GetServerConfigResponse + 450, // 790: hashicorp.waypoint.Waypoint.SetServerConfig:output_type -> google.protobuf.Empty + 230, // 791: hashicorp.waypoint.Waypoint.CreateSnapshot:output_type -> hashicorp.waypoint.CreateSnapshotResponse + 450, // 792: hashicorp.waypoint.Waypoint.RestoreSnapshot:output_type -> google.protobuf.Empty + 228, // 793: hashicorp.waypoint.Waypoint.BootstrapToken:output_type -> hashicorp.waypoint.NewTokenResponse + 224, // 794: hashicorp.waypoint.Waypoint.DecodeToken:output_type -> hashicorp.waypoint.DecodeTokenResponse + 228, // 795: hashicorp.waypoint.Waypoint.GenerateInviteToken:output_type -> hashicorp.waypoint.NewTokenResponse + 228, // 796: hashicorp.waypoint.Waypoint.GenerateLoginToken:output_type -> hashicorp.waypoint.NewTokenResponse + 228, // 797: hashicorp.waypoint.Waypoint.GenerateRunnerToken:output_type -> hashicorp.waypoint.NewTokenResponse + 228, // 798: hashicorp.waypoint.Waypoint.ConvertInviteToken:output_type -> hashicorp.waypoint.NewTokenResponse + 87, // 799: hashicorp.waypoint.Waypoint.RunnerToken:output_type -> hashicorp.waypoint.RunnerTokenResponse + 89, // 800: hashicorp.waypoint.Waypoint.RunnerConfig:output_type -> hashicorp.waypoint.RunnerConfigResponse + 92, // 801: hashicorp.waypoint.Waypoint.RunnerJobStream:output_type -> hashicorp.waypoint.RunnerJobStreamResponse + 94, // 802: hashicorp.waypoint.Waypoint.RunnerGetDeploymentConfig:output_type -> hashicorp.waypoint.RunnerGetDeploymentConfigResponse + 199, // 803: hashicorp.waypoint.Waypoint.EntrypointConfig:output_type -> hashicorp.waypoint.EntrypointConfigResponse + 450, // 804: hashicorp.waypoint.Waypoint.EntrypointLogStream:output_type -> google.protobuf.Empty + 203, // 805: hashicorp.waypoint.Waypoint.EntrypointExecStream:output_type -> hashicorp.waypoint.EntrypointExecResponse + 235, // 806: hashicorp.waypoint.Waypoint.WaypointHclFmt:output_type -> hashicorp.waypoint.WaypointHclFmtResponse + 135, // 807: hashicorp.waypoint.Waypoint.UpsertOnDemandRunnerConfig:output_type -> hashicorp.waypoint.UpsertOnDemandRunnerConfigResponse + 137, // 808: hashicorp.waypoint.Waypoint.GetOnDemandRunnerConfig:output_type -> hashicorp.waypoint.GetOnDemandRunnerConfigResponse + 139, // 809: hashicorp.waypoint.Waypoint.DeleteOnDemandRunnerConfig:output_type -> hashicorp.waypoint.DeleteOnDemandRunnerConfigResponse + 140, // 810: hashicorp.waypoint.Waypoint.ListOnDemandRunnerConfigs:output_type -> hashicorp.waypoint.ListOnDemandRunnerConfigsResponse + 126, // 811: hashicorp.waypoint.Waypoint.UpsertBuild:output_type -> hashicorp.waypoint.UpsertBuildResponse + 142, // 812: hashicorp.waypoint.Waypoint.UpsertPushedArtifact:output_type -> hashicorp.waypoint.UpsertPushedArtifactResponse + 150, // 813: hashicorp.waypoint.Waypoint.UpsertDeployment:output_type -> hashicorp.waypoint.UpsertDeploymentResponse + 159, // 814: hashicorp.waypoint.Waypoint.UpsertRelease:output_type -> hashicorp.waypoint.UpsertReleaseResponse + 177, // 815: hashicorp.waypoint.Waypoint.UpsertStatusReport:output_type -> hashicorp.waypoint.UpsertStatusReportResponse + 48, // 816: hashicorp.waypoint.Waypoint.GetTask:output_type -> hashicorp.waypoint.GetTaskResponse + 51, // 817: hashicorp.waypoint.Waypoint.ListTask:output_type -> hashicorp.waypoint.ListTaskResponse + 450, // 818: hashicorp.waypoint.Waypoint.CancelTask:output_type -> google.protobuf.Empty + 168, // 819: hashicorp.waypoint.Waypoint.UpsertTrigger:output_type -> hashicorp.waypoint.UpsertTriggerResponse + 170, // 820: hashicorp.waypoint.Waypoint.GetTrigger:output_type -> hashicorp.waypoint.GetTriggerResponse + 450, // 821: hashicorp.waypoint.Waypoint.DeleteTrigger:output_type -> google.protobuf.Empty + 175, // 822: hashicorp.waypoint.Waypoint.ListTriggers:output_type -> hashicorp.waypoint.ListTriggerResponse + 173, // 823: hashicorp.waypoint.Waypoint.RunTrigger:output_type -> hashicorp.waypoint.RunTriggerResponse + 207, // 824: hashicorp.waypoint.Waypoint.UpsertPipeline:output_type -> hashicorp.waypoint.UpsertPipelineResponse + 211, // 825: hashicorp.waypoint.Waypoint.RunPipeline:output_type -> hashicorp.waypoint.RunPipelineResponse + 209, // 826: hashicorp.waypoint.Waypoint.GetPipeline:output_type -> hashicorp.waypoint.GetPipelineResponse + 217, // 827: hashicorp.waypoint.Waypoint.GetPipelineRun:output_type -> hashicorp.waypoint.GetPipelineRunResponse + 217, // 828: hashicorp.waypoint.Waypoint.GetLatestPipelineRun:output_type -> hashicorp.waypoint.GetPipelineRunResponse + 213, // 829: hashicorp.waypoint.Waypoint.ListPipelines:output_type -> hashicorp.waypoint.ListPipelinesResponse + 215, // 830: hashicorp.waypoint.Waypoint.ListPipelineRuns:output_type -> hashicorp.waypoint.ListPipelineRunsResponse + 219, // 831: hashicorp.waypoint.Waypoint.ConfigSyncPipeline:output_type -> hashicorp.waypoint.ConfigSyncPipelineResponse + 238, // 832: hashicorp.waypoint.Waypoint.UI_GetProject:output_type -> hashicorp.waypoint.UI.GetProjectResponse + 240, // 833: hashicorp.waypoint.Waypoint.UI_ListDeployments:output_type -> hashicorp.waypoint.UI.ListDeploymentsResponse + 242, // 834: hashicorp.waypoint.Waypoint.UI_GetDeployment:output_type -> hashicorp.waypoint.UI.GetDeploymentResponse + 245, // 835: hashicorp.waypoint.Waypoint.UI_ListReleases:output_type -> hashicorp.waypoint.UI.ListReleasesResponse + 732, // [732:836] is the sub-list for method output_type + 628, // [628:732] is the sub-list for method input_type 628, // [628:628] is the sub-list for extension type_name 628, // [628:628] is the sub-list for extension extendee 0, // [0:628] is the sub-list for field type_name diff --git a/pkg/server/gen/server_grpc.pb.go b/pkg/server/gen/server_grpc.pb.go index 95a423ab2a2..2320a6cc8ce 100644 --- a/pkg/server/gen/server_grpc.pb.go +++ b/pkg/server/gen/server_grpc.pb.go @@ -302,6 +302,8 @@ type WaypointClient interface { GetPipeline(ctx context.Context, in *GetPipelineRequest, opts ...grpc.CallOption) (*GetPipelineResponse, error) // GetPipelineRun returns a pipeline run proto by pipeline ref id and sequence GetPipelineRun(ctx context.Context, in *GetPipelineRunRequest, opts ...grpc.CallOption) (*GetPipelineRunResponse, error) + // GetLatestPipelineRun returns a pipeline run proto by pipeline ref id and sequence + GetLatestPipelineRun(ctx context.Context, in *GetPipelineRequest, opts ...grpc.CallOption) (*GetPipelineRunResponse, error) // ListPipelines takes a project and evaluates the projects config to get // a list of Pipeline protos to return in the response. These pipelines // are scoped to a single project from the request. It will return an @@ -1427,6 +1429,15 @@ func (c *waypointClient) GetPipelineRun(ctx context.Context, in *GetPipelineRunR return out, nil } +func (c *waypointClient) GetLatestPipelineRun(ctx context.Context, in *GetPipelineRequest, opts ...grpc.CallOption) (*GetPipelineRunResponse, error) { + out := new(GetPipelineRunResponse) + err := c.cc.Invoke(ctx, "/hashicorp.waypoint.Waypoint/GetLatestPipelineRun", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *waypointClient) ListPipelines(ctx context.Context, in *ListPipelinesRequest, opts ...grpc.CallOption) (*ListPipelinesResponse, error) { out := new(ListPipelinesResponse) err := c.cc.Invoke(ctx, "/hashicorp.waypoint.Waypoint/ListPipelines", in, out, opts...) @@ -1773,6 +1784,8 @@ type WaypointServer interface { GetPipeline(context.Context, *GetPipelineRequest) (*GetPipelineResponse, error) // GetPipelineRun returns a pipeline run proto by pipeline ref id and sequence GetPipelineRun(context.Context, *GetPipelineRunRequest) (*GetPipelineRunResponse, error) + // GetLatestPipelineRun returns a pipeline run proto by pipeline ref id and sequence + GetLatestPipelineRun(context.Context, *GetPipelineRequest) (*GetPipelineRunResponse, error) // ListPipelines takes a project and evaluates the projects config to get // a list of Pipeline protos to return in the response. These pipelines // are scoped to a single project from the request. It will return an @@ -2089,6 +2102,9 @@ func (UnimplementedWaypointServer) GetPipeline(context.Context, *GetPipelineRequ func (UnimplementedWaypointServer) GetPipelineRun(context.Context, *GetPipelineRunRequest) (*GetPipelineRunResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPipelineRun not implemented") } +func (UnimplementedWaypointServer) GetLatestPipelineRun(context.Context, *GetPipelineRequest) (*GetPipelineRunResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLatestPipelineRun not implemented") +} func (UnimplementedWaypointServer) ListPipelines(context.Context, *ListPipelinesRequest) (*ListPipelinesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListPipelines not implemented") } @@ -3911,6 +3927,24 @@ func _Waypoint_GetPipelineRun_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Waypoint_GetLatestPipelineRun_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaypointServer).GetLatestPipelineRun(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hashicorp.waypoint.Waypoint/GetLatestPipelineRun", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaypointServer).GetLatestPipelineRun(ctx, req.(*GetPipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Waypoint_ListPipelines_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListPipelinesRequest) if err := dec(in); err != nil { @@ -4388,6 +4422,10 @@ var Waypoint_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetPipelineRun", Handler: _Waypoint_GetPipelineRun_Handler, }, + { + MethodName: "GetLatestPipelineRun", + Handler: _Waypoint_GetLatestPipelineRun_Handler, + }, { MethodName: "ListPipelines", Handler: _Waypoint_ListPipelines_Handler, diff --git a/pkg/server/proto/server.proto b/pkg/server/proto/server.proto index 5cb67d774c6..9cab66b11db 100644 --- a/pkg/server/proto/server.proto +++ b/pkg/server/proto/server.proto @@ -436,6 +436,9 @@ service Waypoint { // GetPipelineRun returns a pipeline run proto by pipeline ref id and sequence rpc GetPipelineRun(GetPipelineRunRequest) returns (GetPipelineRunResponse); + // GetLatestPipelineRun returns a pipeline run proto by pipeline ref id and sequence + rpc GetLatestPipelineRun(GetPipelineRequest) returns (GetPipelineRunResponse); + // ListPipelines takes a project and evaluates the projects config to get // a list of Pipeline protos to return in the response. These pipelines // are scoped to a single project from the request. It will return an diff --git a/pkg/server/singleprocess/service_pipeline_run.go b/pkg/server/singleprocess/service_pipeline_run.go index c6b6a5320d9..b90530f4212 100644 --- a/pkg/server/singleprocess/service_pipeline_run.go +++ b/pkg/server/singleprocess/service_pipeline_run.go @@ -52,3 +52,34 @@ func (s *Service) GetPipelineRun( PipelineRun: result, }, nil } + +func (s *Service) GetLatestPipelineRun( + ctx context.Context, + req *pb.GetPipelineRequest, +) (*pb.GetPipelineRunResponse, error) { + if err := serverptypes.ValidateGetPipelineRequest(req); err != nil { + return nil, err + } + + pipeline, err := s.state(ctx).PipelineGet(req.Pipeline) + if err != nil { + return nil, hcerr.Externalize( + hclog.FromContext(ctx), + err, + "error getting pipeline", + ) + } + + latestPipelineRun, err := s.state(ctx).PipelineRunGetLatest(pipeline.Id) + if err != nil { + return nil, hcerr.Externalize( + hclog.FromContext(ctx), + err, + "failed to get latest pipeline run", + ) + } + + return &pb.GetPipelineRunResponse{ + PipelineRun: latestPipelineRun, + }, nil +} diff --git a/pkg/server/singleprocess/service_pipeline_run_test.go b/pkg/server/singleprocess/service_pipeline_run_test.go index 08b1756fb5c..893e7a859f8 100644 --- a/pkg/server/singleprocess/service_pipeline_run_test.go +++ b/pkg/server/singleprocess/service_pipeline_run_test.go @@ -90,4 +90,98 @@ func TestServicePipelineRun(t *testing.T) { require.Len(runs.PipelineRuns, 3) require.Equal(uint64(3), runs.PipelineRuns[len(runs.PipelineRuns)-1].Sequence) }) + + t.Run("get latest", func(t *testing.T) { + require := require.New(t) + ctx := context.Background() + + // Create our server + impl, err := New(WithDB(testDB(t))) + require.NoError(err) + client := server.TestServer(t, impl) + + // Initialize our app + TestApp(t, client, serverptypes.TestJobNew(t, nil).Application) + + // Create pipeline + p, err := client.UpsertPipeline(ctx, &pb.UpsertPipelineRequest{ + Pipeline: serverptypes.TestPipeline(t, nil), + }) + require.NoError(err) + require.NotNil(p) + require.NotEmpty(p.Pipeline.Id) + + pRef := &pb.Ref_Pipeline{ + Ref: &pb.Ref_Pipeline_Id{ + Id: p.Pipeline.Id, + }, + } + + // Run Pipeline once + jobTemplate := serverptypes.TestJobNew(t, nil) + resp, err := client.RunPipeline(ctx, &pb.RunPipelineRequest{ + Pipeline: pRef, + JobTemplate: jobTemplate, + }) + require.NoError(err) + require.NotNil(resp) + + // Get pipeline run + run, err := client.GetPipelineRun(ctx, &pb.GetPipelineRunRequest{ + Pipeline: pRef, + Sequence: 1, + }) + require.NoError(err) + require.Equal(p.Pipeline.Id, run.PipelineRun.Pipeline.Ref.(*pb.Ref_Pipeline_Id).Id) + require.Equal(len(run.PipelineRun.Jobs), len(resp.AllJobIds)) + require.Equal(resp.Sequence, run.PipelineRun.Sequence) + + // Run Pipeline again + resp, err = client.RunPipeline(ctx, &pb.RunPipelineRequest{ + Pipeline: pRef, + JobTemplate: jobTemplate, + }) + require.NoError(err) + require.NotNil(resp) + + // Two pipeline runs should exist + runs, err := client.ListPipelineRuns(ctx, &pb.ListPipelineRunsRequest{ + Pipeline: pRef, + }) + require.NoError(err) + require.NotEmpty(runs) + require.Len(runs.PipelineRuns, 2) + + // Get the latest run, should be sequence 2 + latest, err := client.GetLatestPipelineRun(ctx, &pb.GetPipelineRequest{ + Pipeline: pRef, + }) + require.NoError(err) + require.Equal(latest.PipelineRun.Sequence, runs.PipelineRuns[1].Sequence) + require.Equal(latest.PipelineRun.Sequence, uint64(2)) + + // Add another run + resp, err = client.RunPipeline(ctx, &pb.RunPipelineRequest{ + Pipeline: pRef, + JobTemplate: jobTemplate, + }) + require.NoError(err) + require.NotNil(resp) + + // Three pipeline runs should exist + runs, err = client.ListPipelineRuns(ctx, &pb.ListPipelineRunsRequest{ + Pipeline: pRef, + }) + require.NoError(err) + require.NotEmpty(runs) + require.Len(runs.PipelineRuns, 3) + + // Get the latest run, should be sequence 3 + latest, err = client.GetLatestPipelineRun(ctx, &pb.GetPipelineRequest{ + Pipeline: pRef, + }) + require.NoError(err) + require.Equal(latest.PipelineRun.Sequence, runs.PipelineRuns[2].Sequence) + require.Equal(latest.PipelineRun.Sequence, uint64(3)) + }) } diff --git a/pkg/serverstate/statetest/test_pipeline_run.go b/pkg/serverstate/statetest/test_pipeline_run.go index 755437920e4..819a01a4f85 100644 --- a/pkg/serverstate/statetest/test_pipeline_run.go +++ b/pkg/serverstate/statetest/test_pipeline_run.go @@ -1,6 +1,7 @@ package statetest import ( + "strconv" "testing" "github.com/stretchr/testify/require" @@ -40,6 +41,23 @@ func TestPipelineRun(t *testing.T, factory Factory, restartF RestartFactory) { err = s.PipelineRunPut(r) require.NoError(err) + // We manually add job ids to a PipelineRun over in RunPipeline, so this + // replicates how job ids are added to a run messasge + for i := 1; i < 4; i++ { + is := strconv.Itoa(i) + require.NoError(s.JobCreate(serverptypes.TestJobNew(t, &pb.Job{ + Id: is, + Pipeline: &pb.Ref_PipelineStep{ + PipelineId: p.Id, + RunSequence: r.Sequence, + }, + }))) + + r.Jobs = append(r.Jobs, &pb.Ref_Job{Id: string(is)}) + } + err = s.PipelineRunPut(r) + require.NoError(err) + // Get run by pipeline and sequence { resp, err := s.PipelineRunGet(pipeline, 1) @@ -48,6 +66,10 @@ func TestPipelineRun(t *testing.T, factory Factory, restartF RestartFactory) { require.Equal(r.Id, resp.Id) require.Equal(r.Sequence, resp.Sequence) require.Equal(pipeline.Ref.(*pb.Ref_Pipeline_Id).Id, resp.Pipeline.Ref.(*pb.Ref_Pipeline_Id).Id) + require.NotEmpty(resp.Jobs) + require.Equal("1", resp.Jobs[0].Id) + require.Equal("2", resp.Jobs[1].Id) + require.Equal("3", resp.Jobs[2].Id) } // Get run by Id diff --git a/website/content/commands/pipeline-run.mdx b/website/content/commands/pipeline-run.mdx index 1e6da18ae5c..444d0802760 100644 --- a/website/content/commands/pipeline-run.mdx +++ b/website/content/commands/pipeline-run.mdx @@ -17,10 +17,14 @@ Manually execute a pipeline by name. Usage: `waypoint pipeline run [options] ` -Run a pipeline by name. If run outside of a project dir, a '-project' flag is -required. Before running a requested pipeline, this command will sync -pipeline configs so it runs the most up to date configuration version for a -pipeline. + Run a pipeline by name. If run outside of a project dir, a '-project' flag is + required. Before running a requested pipeline, this command will sync + pipeline configs so it runs the most up to date configuration version for a + pipeline. + + If '-reattach' is supplied, the CLI will attempt to reattach to an existing + pipeline run. Defaults to latest, but if '-run' is specified, it will attach + to that specific run by sequence number. #### Global Options @@ -42,5 +46,7 @@ pipeline. #### Command Options - `-id=` - Run a pipeline by ID. +- `-reattach` - If set, will replay or reattach to an existing pipeline run. If '-run' is not specified, will attempt to read the latest run. The default is false. +- `-run=` - Replay or attach to a specific pipeline run by sequence number. @include "commands/pipeline-run_more.mdx"