-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADXT-783] Made Runner interface for Remote and Local runners #1288
Conversation
161b08b
to
ab0b21a
Compare
// Only used for local commands | ||
LocalAssetPaths pulumi.StringArrayInput | ||
LocalDir pulumi.StringInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion
For this, you could have a LocalArguments
interface, that only a new struct LocalArgs
implement, and cast Args
to LocalArgs
here, failing if the cast fails.
This would be something like
type Args struct {
Create pulumi.StringInput
Update pulumi.StringInput
Delete pulumi.StringInput
Triggers pulumi.ArrayInput
Stdin pulumi.StringPtrInput
Environment pulumi.StringMap
RequirePasswordFromStdin bool
Sudo bool
}
type LocalArguments interface {
LocalAssetPaths() pulumi.StringArrayInput
LocalDir() pulumi.StringInput
}
type LocalArgs struct {
Args
LocalAssetPaths pulumi.StringArrayInput
LocalDir pulumi.StringInput
}
var _ LocalArgument = *LocalArgs{}
func (args *LocalArgs) LocalAssetPaths() pulumi.StringArrayInput {
return args.LocalAssetPaths
}
func (args *LocalArgs) LocalDir() pulumi.StringInput {
return args.LocalDir
}
func (args *Args) toLocalCommandArgs(config RunnerConfiguration, osCommand OSCommand) (*local.CommandArgs, error) {
if localArgs, ok := args.(LocalArgs); !ok {
return nil, fmt.Errorf("can convert only local args")
}
return &local.CommandArgs{
Create: osCommand.Build
Create: osCommand.BuildCommandString(args.Create, args.Environment, args.Sudo, args.RequirePasswordFromStdin, config.user),
Update: osCommand.BuildCommandString(args.Update, args.Environment, args.Sudo, args.RequirePasswordFromStdin, config.user),
Delete: osCommand.BuildCommandString(args.Delete, args.Environment, args.Sudo, args.RequirePasswordFromStdin, config.user),
Environment: args.Environment,
Triggers: args.Triggers,
Stdin: args.Stdin,
AssetPaths: localArgs.LocalAssetPaths,
Dir: localArgs.LocalDir,
}, nil
}
Don't know if you can possibly define toLocalCommandArgs
on LocalArgs
rather than on Args
, I think you showed me yesterday you could not
Passing all tests in datadog-agent DataDog/datadog-agent#32459 |
/merge |
Devflow running:
|
What does this PR do?
Did an interface that gathers remote and local runners.
Notes
'
were not escaping the file paths, changed to double quotesWhich scenarios this will impact?
Motivation
Additional Notes