Regenerate Go

This commit is contained in:
Bryce Lampe
2024-03-26 17:06:19 -07:00
parent cbf957533e
commit 91c652a702
10 changed files with 88 additions and 90 deletions

View File

@@ -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) {

View File

@@ -29,7 +29,7 @@ import (
var _dockerfile = "Dockerfile"
func TestContextValidate(t *testing.T) {
func TestValidateContext(t *testing.T) {
t.Parallel()
tests := []struct {
name string

View File

@@ -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

View File

@@ -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 {

View File

@@ -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
}