Skip to content

Commit

Permalink
have flag struct include bkOpts struct
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Thakur <[email protected]>
  • Loading branch information
RealHarshThakur committed Sep 15, 2023
1 parent 2f453b3 commit e2ae0ba
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions pkg/patch/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ import (
)

type patchArgs struct {
appImage string
reportFile string
patchedTag string
workingFolder string
buildkitAddr string
buildkitCACertPath string
buildkitClientCertPath string
buildkitClientKeyPath string
timeout time.Duration
ignoreError bool
format string
output string
appImage string
reportFile string
patchedTag string
workingFolder string
timeout time.Duration
ignoreError bool
format string
output string
bkOpts buildkit.Opts
}

func NewPatchCmd() *cobra.Command {
Expand All @@ -43,10 +40,10 @@ func NewPatchCmd() *cobra.Command {
Example: "copa patch -i images/python:3.7-alpine -r trivy.json -t 3.7-alpine-patched",
RunE: func(cmd *cobra.Command, args []string) error {
bkopts := buildkit.Opts{
Addr: ua.buildkitAddr,
CACertPath: ua.buildkitCACertPath,
CertPath: ua.buildkitClientCertPath,
KeyPath: ua.buildkitClientKeyPath,
Addr: ua.bkOpts.Addr,
CACertPath: ua.bkOpts.CACertPath,
CertPath: ua.bkOpts.CertPath,
KeyPath: ua.bkOpts.KeyPath,
}

Check warning on line 47 in pkg/patch/cmd.go

View check run for this annotation

Codecov / codecov/patch

pkg/patch/cmd.go#L42-L47

Added lines #L42 - L47 were not covered by tests
return Patch(context.Background(),
ua.timeout,
Expand All @@ -65,10 +62,10 @@ func NewPatchCmd() *cobra.Command {
flags.StringVarP(&ua.reportFile, "report", "r", "", "Vulnerability report file path")
flags.StringVarP(&ua.patchedTag, "tag", "t", "", "Tag for the patched image")
flags.StringVarP(&ua.workingFolder, "working-folder", "w", "", "Working folder, defaults to system temp folder")
flags.StringVarP(&ua.buildkitAddr, "addr", "a", "", "Address of buildkitd service, defaults to local docker daemon with fallback to "+buildkit.DefaultAddr)
flags.StringVarP(&ua.buildkitCACertPath, "cacert", "", "", "Absolute path to buildkitd CA certificate")
flags.StringVarP(&ua.buildkitClientCertPath, "cert", "", "", "Absolute path to buildkit client certificate")
flags.StringVarP(&ua.buildkitClientKeyPath, "key", "", "", "Absolute path to buildkit client key")
flags.StringVarP(&ua.bkOpts.Addr, "addr", "a", "", "Address of buildkitd service, defaults to local docker daemon with fallback to "+buildkit.DefaultAddr)
flags.StringVarP(&ua.bkOpts.CACertPath, "cacert", "", "", "Absolute path to buildkitd CA certificate")
flags.StringVarP(&ua.bkOpts.CertPath, "cert", "", "", "Absolute path to buildkit client certificate")
flags.StringVarP(&ua.bkOpts.KeyPath, "key", "", "", "Absolute path to buildkit client key")
flags.DurationVar(&ua.timeout, "timeout", 5*time.Minute, "Timeout for the operation, defaults to '5m'")
flags.BoolVar(&ua.ignoreError, "ignore-errors", false, "Ignore errors and continue patching")
flags.StringVarP(&ua.format, "format", "f", "openvex", "Output format, defaults to 'openvex'")
Expand Down

0 comments on commit e2ae0ba

Please sign in to comment.