Skip to content

Commit ffea2a2

Browse files
Merge pull request linuxkit#3575 from deitch/bump-manifest-list
bump manifest-tool to latest
2 parents 0af595e + 9fe09db commit ffea2a2

File tree

820 files changed

+184231
-39374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

820 files changed

+184231
-39374
lines changed

src/cmd/linuxkit/moby/docker.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/docker/cli/cli/config"
1919
"github.com/docker/cli/cli/config/configfile"
2020
distref "github.com/docker/distribution/reference"
21-
"github.com/docker/docker/api/types"
21+
dockertypes "github.com/docker/docker/api/types"
2222
"github.com/docker/docker/api/types/container"
2323
"github.com/docker/docker/api/types/filters"
2424
"github.com/docker/docker/client"
@@ -112,7 +112,7 @@ func dockerRm(container string) error {
112112
if err != nil {
113113
return errors.New("could not initialize Docker API client: " + err.Error())
114114
}
115-
if err = cli.ContainerRemove(context.Background(), container, types.ContainerRemoveOptions{}); err != nil {
115+
if err = cli.ContainerRemove(context.Background(), container, dockertypes.ContainerRemoveOptions{}); err != nil {
116116
return err
117117
}
118118
log.Debugf("docker rm: %s...Done", container)
@@ -151,14 +151,14 @@ func dockerPull(ref *reference.Spec, forcePull, trustedPull bool) error {
151151

152152
imageSearchArg := filters.NewArgs()
153153
imageSearchArg.Add("reference", trustedImg.String())
154-
if _, err := cli.ImageList(context.Background(), types.ImageListOptions{Filters: imageSearchArg}); err == nil && !forcePull {
154+
if _, err := cli.ImageList(context.Background(), dockertypes.ImageListOptions{Filters: imageSearchArg}); err == nil && !forcePull {
155155
log.Debugf("docker pull: trusted image %s already cached...Done", trustedImg.String())
156156
return nil
157157
}
158158
}
159159

160160
log.Infof("Pull image: %s", ref)
161-
pullOptions := types.ImagePullOptions{RegistryAuth: getAuth(cli, ref.String())}
161+
pullOptions := dockertypes.ImagePullOptions{RegistryAuth: getAuth(cli, ref.String())}
162162
r, err := cli.ImagePull(context.Background(), ref.String(), pullOptions)
163163
if err != nil {
164164
return err
@@ -182,22 +182,22 @@ func dockerClient() (*client.Client, error) {
182182
return client.NewEnvClient()
183183
}
184184

185-
func dockerInspectImage(cli *client.Client, ref *reference.Spec, trustedPull bool) (types.ImageInspect, error) {
185+
func dockerInspectImage(cli *client.Client, ref *reference.Spec, trustedPull bool) (dockertypes.ImageInspect, error) {
186186
log.Debugf("docker inspect image: %s", ref)
187187

188188
inspect, _, err := cli.ImageInspectWithRaw(context.Background(), ref.String())
189189
if err != nil {
190190
if client.IsErrNotFound(err) {
191191
pullErr := dockerPull(ref, true, trustedPull)
192192
if pullErr != nil {
193-
return types.ImageInspect{}, pullErr
193+
return dockertypes.ImageInspect{}, pullErr
194194
}
195195
inspect, _, err = cli.ImageInspectWithRaw(context.Background(), ref.String())
196196
if err != nil {
197-
return types.ImageInspect{}, err
197+
return dockertypes.ImageInspect{}, err
198198
}
199199
} else {
200-
return types.ImageInspect{}, err
200+
return dockertypes.ImageInspect{}, err
201201
}
202202
}
203203

@@ -243,7 +243,7 @@ func getAuth(cli *client.Client, refStr string) string {
243243
}
244244
log.Debugf("Looked up credentials for %s", hostname)
245245

246-
encodedAuth, err := command.EncodeAuthToBase64(authConfig)
246+
encodedAuth, err := command.EncodeAuthToBase64(dockertypes.AuthConfig(authConfig))
247247
if err != nil {
248248
return ""
249249
}

src/cmd/linuxkit/pkglib/docker.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@ import (
1515
"strings"
1616

1717
"github.com/docker/cli/cli/config"
18-
"github.com/docker/distribution/manifest/manifestlist"
1918
dockertypes "github.com/docker/docker/api/types"
20-
"github.com/estesp/manifest-tool/docker"
21-
"github.com/estesp/manifest-tool/types"
19+
"github.com/estesp/manifest-tool/pkg/types"
20+
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2221
log "github.com/sirupsen/logrus"
2322
"golang.org/x/sync/errgroup"
2423
)
2524

2625
const (
2726
dctEnableEnv = "DOCKER_CONTENT_TRUST=1"
28-
registry = "https://index.docker.io/v1/"
27+
registryServer = "https://index.docker.io/v1/"
2928
notaryServer = "https://notary.docker.io"
3029
notaryDelegationPassphraseEnvVar = "NOTARY_DELEGATION_PASSPHRASE"
3130
notaryAuthEnvVar = "NOTARY_AUTH"
@@ -215,7 +214,8 @@ func (dr dockerRunner) save(tgt string, refs ...string) error {
215214

216215
func getDockerAuth() (dockertypes.AuthConfig, error) {
217216
cfgFile := config.LoadDefaultConfigFile(os.Stderr)
218-
return cfgFile.GetAuthConfig(registry)
217+
authconfig, err := cfgFile.GetAuthConfig(registryServer)
218+
return dockertypes.AuthConfig(authconfig), err
219219
}
220220

221221
func manifestPush(img string, auth dockertypes.AuthConfig) (hash string, length int, err error) {
@@ -233,7 +233,7 @@ func manifestPush(img string, auth dockertypes.AuthConfig) (hash string, length
233233
}
234234
srcImages = append(srcImages, types.ManifestEntry{
235235
Image: fmt.Sprintf("%s-%s", img, arch),
236-
Platform: manifestlist.PlatformSpec{
236+
Platform: ocispec.Platform{
237237
OS: os,
238238
Architecture: arch,
239239
Variant: variant,
@@ -246,13 +246,8 @@ func manifestPush(img string, auth dockertypes.AuthConfig) (hash string, length
246246
Manifests: srcImages,
247247
}
248248

249-
a := types.AuthInfo{
250-
Username: auth.Username,
251-
Password: auth.Password,
252-
}
253-
254249
// push the manifest list with the auth as given, ignore missing, do not allow insecure
255-
return docker.PutManifestList(&a, yamlInput, true, false)
250+
return pushManifestList(auth, yamlInput, true, false, false, "")
256251
}
257252

258253
func signManifest(img, digest string, length int, auth dockertypes.AuthConfig) error {

0 commit comments

Comments
 (0)