Regenerate Go
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:generate go run go.uber.org/mock/mockgen -typed -package internal -source client.go -destination mockcli_test.go --self_package github.com/pulumi/pulumi-dockerbuild/provider/internal
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
@@ -58,6 +60,11 @@ type cli struct {
|
||||
done chan struct{} // signaled when all logs have been forwarded to the engine.
|
||||
}
|
||||
|
||||
// Cli wraps the Docker interface for mock generation.
|
||||
type Cli interface {
|
||||
command.Cli
|
||||
}
|
||||
|
||||
// wrap creates a new cli client with auth configs layered on top of our host's
|
||||
// auth.
|
||||
func wrap(host *host, registries ...Registry) (*cli, error) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
var _dockerfile = "Dockerfile"
|
||||
|
||||
func TestContextValidate(t *testing.T) {
|
||||
func TestValidateContext(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestDockerfileValidate(t *testing.T) {
|
||||
func TestValidateDockerfile(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
|
||||
"github.com/distribution/reference"
|
||||
controllerapi "github.com/docker/buildx/controller/pb"
|
||||
"github.com/docker/buildx/util/buildflags"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
"github.com/moby/buildkit/session"
|
||||
@@ -617,15 +616,12 @@ func (ia *ImageArgs) validate(preview bool) (controllerapi.BuildOptions, error)
|
||||
|
||||
ssh := []*controllerapi.SSH{}
|
||||
for idx, s := range normalized.SSH {
|
||||
parsed, err := buildflags.ParseSSHSpecs([]string{s.String()})
|
||||
ss, err := s.validate()
|
||||
if err != nil {
|
||||
multierr = errors.Join(multierr, newCheckFailure(err, "ssh[%d]", idx))
|
||||
continue
|
||||
}
|
||||
if len(parsed) == 0 {
|
||||
continue
|
||||
}
|
||||
ssh = append(ssh, parsed[0])
|
||||
ssh = append(ssh, ss)
|
||||
}
|
||||
|
||||
for idx, t := range normalized.Tags {
|
||||
|
||||
@@ -17,6 +17,9 @@ package internal
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/buildx/controller/pb"
|
||||
controllerapi "github.com/docker/buildx/controller/pb"
|
||||
"github.com/docker/buildx/util/buildflags"
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
)
|
||||
|
||||
@@ -61,3 +64,16 @@ func (s SSH) String() string {
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (s SSH) validate() (*controllerapi.SSH, error) {
|
||||
parsed, err := buildflags.ParseSSHSpecs([]string{s.String()})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(parsed) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
_, err = controllerapi.CreateSSH([]*pb.SSH{{ID: s.ID, Paths: s.Paths}})
|
||||
return parsed[0], err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user