Skip to content

Commit

Permalink
GRPC changes to enable a gradual migration from Runner v1 to v2 (#589)
Browse files Browse the repository at this point in the history
Intentionally leaving the service stubs unimplemented to allow changing
them later. Having the stubs in place will however make it easier to
have the extension temporarily support both Runner v1 & v2.
  • Loading branch information
sourishkrout authored May 24, 2024
1 parent 6d103ae commit 6e56cfa
Show file tree
Hide file tree
Showing 9 changed files with 1,522 additions and 358 deletions.
2 changes: 2 additions & 0 deletions internal/runner/client/client_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ func (r *RemoteRunner) RunTask(ctx context.Context, task project.Task) error {
SessionId: r.sessionID,
SessionStrategy: r.sessionStrategy,
Background: block.Background(),
KnownId: block.ID(),
KnownName: block.Name(),
StoreLastOutput: true,
Envs: r.envs,
CommandMode: commandModeGrpc,
Expand Down
16 changes: 13 additions & 3 deletions internal/runnerv2service/service_resolve_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func (r *runnerService) ResolveProgram(ctx context.Context, req *runnerv2alpha1.
ritem.Status = runnerv2alpha1.ResolveProgramResponse_STATUS_UNRESOLVED_WITH_MESSAGE
case command.ProgramResolverStatusUnresolvedWithPlaceholder:
ritem.Status = runnerv2alpha1.ResolveProgramResponse_STATUS_UNRESOLVED_WITH_PLACEHOLDER
case command.ProgramResolverStatusUnresolvedWithSecret:
ritem.Status = runnerv2alpha1.ResolveProgramResponse_STATUS_UNRESOLVED_WITH_SECRET
default:
ritem.Status = runnerv2alpha1.ResolveProgramResponse_STATUS_UNSPECIFIED
}
Expand Down Expand Up @@ -89,10 +91,18 @@ func (r *runnerService) getProgramResolverFromReq(req *runnerv2alpha1.ResolvePro
}
}

// Add session env as a source. If session is not found, it's not an error.
// todo(sebastian): bring back sensitive keys for owl store
// Add session env as a source and pass info about sensitive env vars.
sensitiveEnvKeys := []string{}
session, found, _ := r.getSessionFromRequest(req)
if found {
sources = append(sources, command.ProgramResolverSourceFunc(session.GetEnv()))
env := session.GetEnv()
sources = append(sources, command.ProgramResolverSourceFunc(env))

// sensitiveEnvKeys, err = session.SensitiveEnvKeys()
// if err != nil {
// return nil, err
// }
}

mode := command.ProgramResolverModeAuto
Expand All @@ -104,5 +114,5 @@ func (r *runnerService) getProgramResolverFromReq(req *runnerv2alpha1.ResolvePro
mode = command.ProgramResolverModeSkipAll
}

return command.NewProgramResolver(mode, []string{}, sources...), err
return command.NewProgramResolver(mode, sensitiveEnvKeys, sources...), err
}
Loading

0 comments on commit 6e56cfa

Please sign in to comment.