Skip to content

Commit

Permalink
Only support docker file in docker, local and ssh connections.
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev committed May 7, 2024
1 parent d0027c1 commit 88c44a0
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ import (
"go.mondoo.com/cnquery/v11/llx"
"go.mondoo.com/cnquery/v11/providers-sdk/v1/plugin"
"go.mondoo.com/cnquery/v11/providers/os/connection/docker"
"go.mondoo.com/cnquery/v11/providers/os/connection/local"
"go.mondoo.com/cnquery/v11/providers/os/connection/ssh"
"go.mondoo.com/cnquery/v11/types"
"go.mondoo.com/cnquery/v11/utils/multierr"
)

func initDockerFile(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) {
// the dockerfile connection is a wrapper around the local one
// NOTE: we might have to extend this in the future if we start supporting docker files from other connections (e.g. tar)
_, isDockerConn := runtime.Connection.(*docker.DockerfileConnection)
_, isSshConn := runtime.Connection.(*ssh.Connection)
_, isLocalConn := runtime.Connection.(*local.LocalConnection)
// if neither, we set the file to nil.
if !isDockerConn && !isSshConn && !isLocalConn {
return args, nil, nil
}

// if users supply a file, we don't have to run any fancy initialization,
// since most of this function deals with trying to find the dockerfile
if _, ok := args["file"]; ok {
Expand Down

0 comments on commit 88c44a0

Please sign in to comment.