From fd8617dcf015220a8dd629991e685e52dfc47158 Mon Sep 17 00:00:00 2001 From: Adam Babik Date: Thu, 1 Feb 2024 22:44:23 +0100 Subject: [PATCH] Fix go_package in runnerv2alpha1 It also contains typo fixes and additional tests. --- internal/api/runme/runner/v1/runner.proto | 2 +- internal/api/runme/runner/v2alpha1/config.proto | 2 +- internal/api/runme/runner/v2alpha1/runner.proto | 4 ++-- internal/command/command_unix.go | 7 ------- internal/command/env_resolver.go | 2 +- .../gen/proto/go/runme/runner/v1/runner_grpc.pb.go | 4 ++-- .../gen/proto/go/runme/runner/v2alpha1/config.pb.go | 10 +++++----- .../gen/proto/go/runme/runner/v2alpha1/runner.pb.go | 9 +++++---- .../proto/go/runme/runner/v2alpha1/runner_grpc.pb.go | 6 +++--- .../proto/ts/runme/runner/v1/runner_pb.client.d.ts | 4 ++-- .../gen/proto/ts/runme/runner/v1/runner_pb.client.js | 2 +- .../ts/runme/runner/v2alpha1/runner_pb.client.d.ts | 4 ++-- .../ts/runme/runner/v2alpha1/runner_pb.client.js | 2 +- internal/runnerv2service/service_resolve_env_test.go | 11 +++++++++++ 14 files changed, 37 insertions(+), 32 deletions(-) diff --git a/internal/api/runme/runner/v1/runner.proto b/internal/api/runme/runner/v1/runner.proto index 3f7c6a17f..793795ee6 100644 --- a/internal/api/runme/runner/v1/runner.proto +++ b/internal/api/runme/runner/v1/runner.proto @@ -259,6 +259,6 @@ service RunnerService { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. rpc ResolveEnv(ResolveEnvRequest) returns (ResolveEnvResponse) {} } diff --git a/internal/api/runme/runner/v2alpha1/config.proto b/internal/api/runme/runner/v2alpha1/config.proto index fba0f8953..d3634a17d 100644 --- a/internal/api/runme/runner/v2alpha1/config.proto +++ b/internal/api/runme/runner/v2alpha1/config.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package runme.runner.v2alpha1; -option go_package = "github.com/stateful/runme/internal/gen/proto/go/runme/runner/v1;runnerv1"; +option go_package = "github.com/stateful/runme/internal/gen/proto/go/runme/runner/v2alpha1;runnerv2alpha1"; enum CommandMode { COMMAND_MODE_UNSPECIFIED = 0; diff --git a/internal/api/runme/runner/v2alpha1/runner.proto b/internal/api/runme/runner/v2alpha1/runner.proto index 7dca07bf4..e7cf94bc3 100644 --- a/internal/api/runme/runner/v2alpha1/runner.proto +++ b/internal/api/runme/runner/v2alpha1/runner.proto @@ -5,7 +5,7 @@ package runme.runner.v2alpha1; import "google/protobuf/wrappers.proto"; import "runme/runner/v2alpha1/config.proto"; -option go_package = "github.com/stateful/runme/internal/gen/proto/go/runme/runner/v1;runnerv1"; +option go_package = "github.com/stateful/runme/internal/gen/proto/go/runme/runner/v2alpha1;runnerv2alpha1"; message Project { // root is a root directory of the project. @@ -232,6 +232,6 @@ service RunnerService { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. rpc ResolveEnv(ResolveEnvRequest) returns (ResolveEnvResponse) {} } diff --git a/internal/command/command_unix.go b/internal/command/command_unix.go index b8be2ded9..6a3f846a1 100644 --- a/internal/command/command_unix.go +++ b/internal/command/command_unix.go @@ -42,13 +42,6 @@ func closeOnExec(fd uintptr) { syscall.CloseOnExec(int(fd)) } -// func setSysProcAttrPgid(cmd *exec.Cmd) { -// if cmd.SysProcAttr == nil { -// cmd.SysProcAttr = &syscall.SysProcAttr{} -// } -// cmd.SysProcAttr.Setpgid = true -// } - func signalPgid(pid int, sig os.Signal) error { pgid, err := syscall.Getpgid(pid) if err != nil { diff --git a/internal/command/env_resolver.go b/internal/command/env_resolver.go index ada63e4a2..92d65ebd6 100644 --- a/internal/command/env_resolver.go +++ b/internal/command/env_resolver.go @@ -18,7 +18,7 @@ func EnvResolverSourceFunc(env []string) EnvResolverSource { // EnvResolver uses a list of EnvResolverSource to resolve environment variables // found in a shell program. The result contains all found environment variables. -// If the env is in any source, it is considered resolved. Otherwise, it is makred +// If the env is in any source, it is considered resolved. Otherwise, it is marked // as unresolved. type EnvResolver struct { sources []EnvResolverSource diff --git a/internal/gen/proto/go/runme/runner/v1/runner_grpc.pb.go b/internal/gen/proto/go/runme/runner/v1/runner_grpc.pb.go index 413194c8e..4b1cb8036 100644 --- a/internal/gen/proto/go/runme/runner/v1/runner_grpc.pb.go +++ b/internal/gen/proto/go/runme/runner/v1/runner_grpc.pb.go @@ -47,7 +47,7 @@ type RunnerServiceClient interface { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. ResolveEnv(ctx context.Context, in *ResolveEnvRequest, opts ...grpc.CallOption) (*ResolveEnvResponse, error) } @@ -155,7 +155,7 @@ type RunnerServiceServer interface { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. ResolveEnv(context.Context, *ResolveEnvRequest) (*ResolveEnvResponse, error) mustEmbedUnimplementedRunnerServiceServer() } diff --git a/internal/gen/proto/go/runme/runner/v2alpha1/config.pb.go b/internal/gen/proto/go/runme/runner/v2alpha1/config.pb.go index 21e82ca8b..05cbff21a 100644 --- a/internal/gen/proto/go/runme/runner/v2alpha1/config.pb.go +++ b/internal/gen/proto/go/runme/runner/v2alpha1/config.pb.go @@ -4,7 +4,7 @@ // protoc (unknown) // source: runme/runner/v2alpha1/config.proto -package runnerv1 +package runnerv2alpha1 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -301,13 +301,13 @@ var file_runme_runner_v2alpha1_config_proto_rawDesc = []byte{ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4d, 0x4d, 0x41, - 0x4e, 0x44, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x02, 0x42, 0x4a, - 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x61, + 0x4e, 0x44, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x02, 0x42, 0x56, + 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2f, 0x76, - 0x31, 0x3b, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x76, 0x32, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/proto/go/runme/runner/v2alpha1/runner.pb.go b/internal/gen/proto/go/runme/runner/v2alpha1/runner.pb.go index d33cbb437..ace28f4e4 100644 --- a/internal/gen/proto/go/runme/runner/v2alpha1/runner.pb.go +++ b/internal/gen/proto/go/runme/runner/v2alpha1/runner.pb.go @@ -4,7 +4,7 @@ // protoc (unknown) // source: runme/runner/v2alpha1/runner.proto -package runnerv1 +package runnerv2alpha1 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -1539,12 +1539,13 @@ var file_runme_runner_v2alpha1_runner_proto_rawDesc = []byte{ 0x76, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x45, 0x6e, 0x76, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x56, 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x72, - 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x76, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2f, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/proto/go/runme/runner/v2alpha1/runner_grpc.pb.go b/internal/gen/proto/go/runme/runner/v2alpha1/runner_grpc.pb.go index ea4d26ee9..32b2fac63 100644 --- a/internal/gen/proto/go/runme/runner/v2alpha1/runner_grpc.pb.go +++ b/internal/gen/proto/go/runme/runner/v2alpha1/runner_grpc.pb.go @@ -4,7 +4,7 @@ // - protoc (unknown) // source: runme/runner/v2alpha1/runner.proto -package runnerv1 +package runnerv2alpha1 import ( context "context" @@ -49,7 +49,7 @@ type RunnerServiceClient interface { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. ResolveEnv(ctx context.Context, in *ResolveEnvRequest, opts ...grpc.CallOption) (*ResolveEnvResponse, error) } @@ -167,7 +167,7 @@ type RunnerServiceServer interface { // using the provided sources, which can be a list of environment variables, // a session, or a project. // The result contains all found environment variables. If the env is in any source, - // it is considered resolved. Otherwise, it is makred as unresolved. + // it is considered resolved. Otherwise, it is marked as unresolved. ResolveEnv(context.Context, *ResolveEnvRequest) (*ResolveEnvResponse, error) mustEmbedUnimplementedRunnerServiceServer() } diff --git a/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.d.ts b/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.d.ts index 05e5d599e..1148b7a7c 100644 --- a/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.d.ts +++ b/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.d.ts @@ -57,7 +57,7 @@ export interface IRunnerServiceClient { * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v1.ResolveEnvRequest) returns (runme.runner.v1.ResolveEnvResponse); */ @@ -105,7 +105,7 @@ export declare class RunnerServiceClient implements IRunnerServiceClient, Servic * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v1.ResolveEnvRequest) returns (runme.runner.v1.ResolveEnvResponse); */ diff --git a/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.js b/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.js index f81a2b14d..06b6e5c13 100644 --- a/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.js +++ b/internal/gen/proto/ts/runme/runner/v1/runner_pb.client.js @@ -63,7 +63,7 @@ export class RunnerServiceClient { * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v1.ResolveEnvRequest) returns (runme.runner.v1.ResolveEnvResponse); */ diff --git a/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.d.ts b/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.d.ts index e33e950d8..92197ba7f 100644 --- a/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.d.ts +++ b/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.d.ts @@ -63,7 +63,7 @@ export interface IRunnerServiceClient { * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v2alpha1.ResolveEnvRequest) returns (runme.runner.v2alpha1.ResolveEnvResponse); */ @@ -115,7 +115,7 @@ export declare class RunnerServiceClient implements IRunnerServiceClient, Servic * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v2alpha1.ResolveEnvRequest) returns (runme.runner.v2alpha1.ResolveEnvResponse); */ diff --git a/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.js b/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.js index 19d37c180..853e9901b 100644 --- a/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.js +++ b/internal/gen/proto/ts/runme/runner/v2alpha1/runner_pb.client.js @@ -70,7 +70,7 @@ export class RunnerServiceClient { * using the provided sources, which can be a list of environment variables, * a session, or a project. * The result contains all found environment variables. If the env is in any source, - * it is considered resolved. Otherwise, it is makred as unresolved. + * it is considered resolved. Otherwise, it is marked as unresolved. * * @generated from protobuf rpc: ResolveEnv(runme.runner.v2alpha1.ResolveEnvRequest) returns (runme.runner.v2alpha1.ResolveEnvResponse); */ diff --git a/internal/runnerv2service/service_resolve_env_test.go b/internal/runnerv2service/service_resolve_env_test.go index 8094051c8..fd6600b4e 100644 --- a/internal/runnerv2service/service_resolve_env_test.go +++ b/internal/runnerv2service/service_resolve_env_test.go @@ -40,6 +40,17 @@ func TestRunnerServiceResolveEnv(t *testing.T) { }, }, }, + { + name: "WithAdditionalEnv", + request: &runnerv2alpha1.ResolveEnvRequest{ + Env: []string{"TEST_RESOLVED=value", "TEST_EXTRA=value"}, + Source: &runnerv2alpha1.ResolveEnvRequest_Commands{ + Commands: &runnerv2alpha1.ResolveEnvRequest_CommandList{ + Items: []string{"export TEST_RESOLVED=default", "export TEST_UNRESOLVED"}, + }, + }, + }, + }, } for _, tc := range testCases {