Skip to content
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

Remove unused parameters from ActionArguments struct #3333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pkg/cnab/provider/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/cnabio/cnab-go/driver"
"github.com/hashicorp/go-multierror"
"go.opentelemetry.io/otel/attribute"
"go.uber.org/zap/zapcore"
)

type HostVolumeMountSpec struct {
Expand All @@ -38,10 +37,6 @@ type ActionArguments struct {
// Target Path => File Contents
Files map[string]string

// Params is the fully resolved set of parameters.
// TODO(PEP003): This should be removed in https://github.com/getporter/porter/issues/2699
Params map[string]interface{}

// Driver is the CNAB-compliant driver used to run bundle actions.
Driver string

Expand Down Expand Up @@ -107,10 +102,6 @@ func (r *Runtime) AddEnvironment(args ActionArguments) cnabaction.OperationConfi
// Pass the verbosity from porter's local config into the bundle
op.Environment[verbosityEnv] = r.Config.GetVerbosity().Level().String()

// When a bundle is run in debug mode, the verbosity is automatically set to debug
if debugMode, _ := args.Params["porter-debug"].(bool); debugMode {
op.Environment[verbosityEnv] = zapcore.DebugLevel.String()
}
return nil
}
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/porter/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ func (e *dependencyExecutioner) prepareDependency(ctx context.Context, dep *queu
dep.Parameters = make(map[string]string, 1)
}
dep.Parameters[paramName] = value
delete(e.parentArgs.Params, key)
}
}

Expand Down Expand Up @@ -426,7 +425,6 @@ func (e *dependencyExecutioner) getActionArgs(ctx context.Context,
Run: depRun,
Driver: e.parentArgs.Driver,
AllowDockerHostAccess: e.parentOpts.AllowDockerHostAccess,
Params: finalParams,
PersistLogs: e.parentArgs.PersistLogs,
}
return nil
Expand Down
1 change: 0 additions & 1 deletion pkg/porter/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ func (p *Porter) BuildActionArgs(ctx context.Context, installation storage.Insta
Run: run,
Installation: installation,
BundleReference: bundleRef,
Params: opts.GetParameters(),
Driver: opts.Driver,
AllowDockerHostAccess: opts.AllowDockerHostAccess,
HostVolumeMounts: opts.GetHostVolumeMounts(),
Expand Down
8 changes: 0 additions & 8 deletions pkg/porter/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,8 @@ func TestPorter_BuildActionArgs(t *testing.T) {
args, err := p.BuildActionArgs(ctx, existingInstall, opts)
require.NoError(t, err, "BuildActionArgs failed")

expectedParams := map[string]interface{}{
"my-first-param": 1,
"my-second-param": "VALUE2",
"porter-debug": true,
"porter-state": nil,
}

assert.Equal(t, opts.AllowDockerHostAccess, args.AllowDockerHostAccess, "AllowDockerHostAccess not populated correctly")
assert.Equal(t, opts.Driver, args.Driver, "Driver not populated correctly")
assert.EqualValues(t, expectedParams, args.Params, "Params not populated correctly")
assert.NotEmpty(t, args.Installation, "Installation not populated")
wantReloMap := relocation.ImageRelocationMap{"gabrtv/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687": "my.registry/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687"}
assert.Equal(t, wantReloMap, args.BundleReference.RelocationMap, "RelocationMapping not populated correctly")
Expand Down
Loading