Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Add more logging, add note about latestRelease bug
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Jul 15, 2021
1 parent 4424606 commit 0257a2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 4 additions & 2 deletions internal/runner/operation_status_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ func (r *Runner) executeStatusReportOp(
panic("operation not expected type")
}

log = log.With("app", job.Application.Application)

log.Trace("generating status report")
var statusReportResult *pb.StatusReport

switch t := op.StatusReport.Target.(type) {
case *pb.Job_StatusReportOp_Deployment:
log.Trace("starting a status report against a deployment")
statusReportResult, err = app.DeploymentStatusReport(ctx, t.Deployment)
case *pb.Job_StatusReportOp_Release:
log.Trace("starting a status report against a release")
statusReportResult, err = app.ReleaseStatusReport(ctx, t.Release)
default:
err = fmt.Errorf("unknown status report target: %T", op.StatusReport.Target)
Expand Down Expand Up @@ -69,8 +73,6 @@ func (r *Runner) enableApplicationPoll(
log hclog.Logger,
appRef *pb.Ref_Application,
) error {
log = log.With("app", appRef.Application)

log.Trace("calling GetProject to determine app polling status")
resp, err := r.client.GetProject(ctx, &pb.GetProjectRequest{
Project: &pb.Ref_Project{
Expand Down
18 changes: 16 additions & 2 deletions internal/server/singleprocess/poll_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,27 @@ func (a *applicationPoll) PollJob(
StatusReport: &pb.Job_StatusReportOp{},
}

log.Trace("Determining which target to generate a status report on")

// Default to poll on the "latest" lifecycle operation, so if there's a
// release, queue up a status on release. If the latest is deploy, then queue that.
if latestRelease != nil {
if latestRelease != nil { // ignore me for now
//TODO(briancain): the issue right now is that waypoint always stores a release,
// even if the plugin didn't do one. We don't know if it's a real or fake release
// and we can't run a status report on a fake release especially if the plugin
// has not implemented a releaser.

// Returned latestRelease for a plugin that hasn't implemented a releaser
//panic: application:{application:"web" project:"nginx-project"} workspace:{workspace:"default"} sequence:1 id:"01FANWNRRVVCX9KKE0AV08X3HR" status:{state:SUCCESS start_time:{seconds:1626379838 nanos
//:234574394} complete_time:{seconds:1626379838 nanos:237627450}} state:CREATED component:{type:PLATFORM name:"docker"} deployment_id:"01FANWNPJHST0XQ7G8GC06PXN0" labels:{key:"waypoint/workspace" va
//lue:"default"} job_id:"01FANWNJY5NQWYQA00HQ2817P8" preload:{}

log.Trace("using latest release as a status report target")
statusReportJob.StatusReport.Target = &pb.Job_StatusReportOp_Release{
Release: latestRelease,
}
} else if latestDeployment != nil {
} else if latestDeployment.Deployment != nil {
log.Trace("using latest deployment as a status report target")
statusReportJob.StatusReport.Target = &pb.Job_StatusReportOp_Deployment{
Deployment: latestDeployment,
}
Expand Down

0 comments on commit 0257a2a

Please sign in to comment.