Skip to content

Commit

Permalink
chore: removed deprecated types (#2378)
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vašek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Jun 20, 2024
1 parent 398610d commit f249714
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions hack/update-builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/buildpacks/pack/buildpackage"
pack "github.com/buildpacks/pack/pkg/client"
"github.com/buildpacks/pack/pkg/dist"
"github.com/buildpacks/pack/pkg/image"
"github.com/docker/docker/api/types"
bpimage "github.com/buildpacks/pack/pkg/image"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
docker "github.com/docker/docker/client"
"github.com/docker/docker/pkg/jsonmessage"
Expand Down Expand Up @@ -138,7 +138,7 @@ func buildBuilderImage(ctx context.Context, variant string) error {
BuilderName: newBuilderImageTagged,
Config: builderConfig,
Publish: false,
PullPolicy: image.PullIfNotPresent,
PullPolicy: bpimage.PullIfNotPresent,
Labels: map[string]string{
"org.opencontainers.image.description": "Paketo Jammy builder enriched with Rust and Func-Go buildpacks.",
"org.opencontainers.image.source": "https://github.com/knative/func",
Expand Down Expand Up @@ -170,7 +170,7 @@ func buildBuilderImage(ctx context.Context, variant string) error {
if err != nil {
return fmt.Errorf("cannot marshal credentials: %w", err)
}
imagePushOptions := types.ImagePushOptions{
imagePushOptions := image.PushOptions{
All: false,
RegistryAuth: base64.StdEncoding.EncodeToString(bs),
}
Expand Down Expand Up @@ -326,7 +326,7 @@ func buildBuildpackImage(ctx context.Context, bp buildpack) error {
Format: pack.FormatImage,
Config: cfg,
Publish: false,
PullPolicy: image.PullIfNotPresent,
PullPolicy: bpimage.PullIfNotPresent,
Registry: "",
Flatten: false,
FlattenExclude: nil,
Expand Down
6 changes: 3 additions & 3 deletions pkg/docker/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

fn "knative.dev/func/pkg/functions"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/jsonmessage"
Expand Down Expand Up @@ -43,7 +43,7 @@ type CredentialsProvider func(ctx context.Context, image string) (Credentials, e
// PusherDockerClient is sub-interface of client.CommonAPIClient required by pusher.
type PusherDockerClient interface {
daemon.Client
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
Close() error
}

Expand Down Expand Up @@ -225,7 +225,7 @@ func (n *Pusher) daemonPush(ctx context.Context, f fn.Function, credentials Cred
return "", err
}

opts := types.ImagePushOptions{RegistryAuth: base64.StdEncoding.EncodeToString(b)}
opts := image.PushOptions{RegistryAuth: base64.StdEncoding.EncodeToString(b)}

r, err := cli.ImagePush(ctx, f.Build.Image, opts)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/docker/pusher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestPush(t *testing.T) {

dockerClient := newMockPusherDockerClient()

pushReachable := func(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
pushReachable := func(ctx context.Context, ref string, options api.PushOptions) (io.ReadCloser, error) {
if ref != functionImageRemote {
return nil, fmt.Errorf("unexpected ref")
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestPush(t *testing.T) {
`)), nil
}

pushUnreachable := func(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
pushUnreachable := func(ctx context.Context, ref string, options api.PushOptions) (io.ReadCloser, error) {
return io.NopCloser(strings.NewReader(`{"errorDetail": {"message": "...no such host..."}}`)), nil
}

Expand Down Expand Up @@ -270,7 +270,7 @@ func TestPush(t *testing.T) {

func newMockPusherDockerClient() *mockPusherDockerClient {
return &mockPusherDockerClient{
imagePush: func(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
imagePush: func(ctx context.Context, ref string, options api.PushOptions) (io.ReadCloser, error) {
return nil, fmt.Errorf(" imagePush not implemented")
},
imageSave: func(ctx context.Context, strings []string) (io.ReadCloser, error) {
Expand All @@ -286,7 +286,7 @@ func newMockPusherDockerClient() *mockPusherDockerClient {

type mockPusherDockerClient struct {
negotiateAPIVersion func(ctx context.Context)
imagePush func(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
imagePush func(ctx context.Context, ref string, options api.PushOptions) (io.ReadCloser, error)
imageSave func(ctx context.Context, strings []string) (io.ReadCloser, error)
imageInspect func(ctx context.Context, s string) (types.ImageInspect, []byte, error)
close func() error
Expand All @@ -312,7 +312,7 @@ func (m *mockPusherDockerClient) ImageInspectWithRaw(ctx context.Context, s stri
return m.imageInspect(ctx, s)
}

func (m *mockPusherDockerClient) ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
func (m *mockPusherDockerClient) ImagePush(ctx context.Context, ref string, options api.PushOptions) (io.ReadCloser, error) {
return m.imagePush(ctx, ref, options)
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/docker/zz_close_guarding_client_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ func (c *closeGuardingClient) ImageBuild(arg0 context.Context, arg1 io.Reader, a
return c.pimpl.ImageBuild(arg0, arg1, arg2)
}

func (c *closeGuardingClient) ImageCreate(arg0 context.Context, arg1 string, arg2 types.ImageCreateOptions) (io.ReadCloser, error) {
func (c *closeGuardingClient) ImageCreate(arg0 context.Context, arg1 string, arg2 image.CreateOptions) (io.ReadCloser, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand All @@ -469,7 +469,7 @@ func (c *closeGuardingClient) ImageHistory(arg0 context.Context, arg1 string) ([
return c.pimpl.ImageHistory(arg0, arg1)
}

func (c *closeGuardingClient) ImageImport(arg0 context.Context, arg1 types.ImageImportSource, arg2 string, arg3 types.ImageImportOptions) (io.ReadCloser, error) {
func (c *closeGuardingClient) ImageImport(arg0 context.Context, arg1 types.ImageImportSource, arg2 string, arg3 image.ImportOptions) (io.ReadCloser, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand All @@ -487,7 +487,7 @@ func (c *closeGuardingClient) ImageInspectWithRaw(arg0 context.Context, arg1 str
return c.pimpl.ImageInspectWithRaw(arg0, arg1)
}

func (c *closeGuardingClient) ImageList(arg0 context.Context, arg1 types.ImageListOptions) ([]image.Summary, error) {
func (c *closeGuardingClient) ImageList(arg0 context.Context, arg1 image.ListOptions) ([]image.Summary, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand All @@ -505,7 +505,7 @@ func (c *closeGuardingClient) ImageLoad(arg0 context.Context, arg1 io.Reader, ar
return c.pimpl.ImageLoad(arg0, arg1, arg2)
}

func (c *closeGuardingClient) ImagePull(arg0 context.Context, arg1 string, arg2 types.ImagePullOptions) (io.ReadCloser, error) {
func (c *closeGuardingClient) ImagePull(arg0 context.Context, arg1 string, arg2 image.PullOptions) (io.ReadCloser, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand All @@ -514,7 +514,7 @@ func (c *closeGuardingClient) ImagePull(arg0 context.Context, arg1 string, arg2
return c.pimpl.ImagePull(arg0, arg1, arg2)
}

func (c *closeGuardingClient) ImagePush(arg0 context.Context, arg1 string, arg2 types.ImagePushOptions) (io.ReadCloser, error) {
func (c *closeGuardingClient) ImagePush(arg0 context.Context, arg1 string, arg2 image.PushOptions) (io.ReadCloser, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand All @@ -523,7 +523,7 @@ func (c *closeGuardingClient) ImagePush(arg0 context.Context, arg1 string, arg2
return c.pimpl.ImagePush(arg0, arg1, arg2)
}

func (c *closeGuardingClient) ImageRemove(arg0 context.Context, arg1 string, arg2 types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
func (c *closeGuardingClient) ImageRemove(arg0 context.Context, arg1 string, arg2 image.RemoveOptions) ([]image.DeleteResponse, error) {
c.m.RLock()
defer c.m.RUnlock()
if c.closed {
Expand Down

0 comments on commit f249714

Please sign in to comment.