Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ services:
- docker

go:
- "1.23.12"
- "1.25.5"

before_install:
- docker pull mirror.gcr.io/alpine
- docker pull mirror.gcr.io/busybox
- docker pull public.ecr.aws/docker/library/centos:7
- docker pull mirror.gcr.io/debian
- docker pull registry.fedoraproject.org/fedora-minimal
- docker pull registry.fedoraproject.org/fedora-minimal:42-x86_64
- docker pull registry.fedoraproject.org/fedora-minimal:42-aarch64
- docker pull mirror.gcr.io/golang:1.24
- docker pull registry.fedoraproject.org/fedora-minimal:44-x86_64
- docker pull registry.fedoraproject.org/fedora-minimal:44-aarch64
- docker pull mirror.gcr.io/golang:1.25
- chmod -R go-w ./dockerclient/testdata

script:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ docker rmi mirror.gcr.io/busybox; docker pull mirror.gcr.io/busybox
docker rmi public.ecr.aws/docker/library/centos:7; docker pull public.ecr.aws/docker/library/centos:7
docker rmi mirror.gcr.io/debian; docker pull mirror.gcr.io/debian
docker rmi registry.fedoraproject.org/fedora-minimal; docker pull registry.fedoraproject.org/fedora-minimal
docker rmi registry.fedoraproject.org/fedora-minimal:42-x86_64; docker pull registry.fedoraproject.org/fedora-minimal:42-x86_64
docker rmi registry.fedoraproject.org/fedora-minimal:42-aarch64; docker pull registry.fedoraproject.org/fedora-minimal:42-aarch64
docker rmi mirror.gcr.io/golang:1.24; docker pull mirror.gcr.io/golang:1.24
docker rmi registry.fedoraproject.org/fedora-minimal:44-x86_64; docker pull registry.fedoraproject.org/fedora-minimal:44-x86_64
docker rmi registry.fedoraproject.org/fedora-minimal:44-aarch64; docker pull registry.fedoraproject.org/fedora-minimal:44-aarch64
docker rmi mirror.gcr.io/golang:1.25; docker pull mirror.gcr.io/golang:1.25
docker rmi mirror.gcr.io/nginx; docker pull mirror.gcr.io/nginx
chmod -R go-w ./dockerclient/testdata
env DOCKER_API_VERSION=1.44 go test ./dockerclient -tags conformance -timeout 30m
Expand Down
3 changes: 1 addition & 2 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -829,7 +828,7 @@ func ParseIgnoreReader(r io.Reader) ([]string, error) {
func ParseIgnore(path string) ([]string, error) {
var excludes []string

ignores, err := ioutil.ReadFile(path)
ignores, err := os.ReadFile(path)
if err != nil {
return excludes, err
}
Expand Down
13 changes: 6 additions & 7 deletions builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -391,7 +390,7 @@ func TestMultiStageParseHeadingArg(t *testing.T) {
t.Fatalf("expected 3 stages, got %d", len(stages))
}

fromImages := []string{"mirror.gcr.io/golang:1.24", "mirror.gcr.io/busybox:latest", "mirror.gcr.io/golang:1.24"}
fromImages := []string{"mirror.gcr.io/golang:1.25", "mirror.gcr.io/busybox:latest", "mirror.gcr.io/golang:1.25"}
for i, stage := range stages {
from, err := stage.Builder.From(stage.Node)
if err != nil {
Expand Down Expand Up @@ -779,7 +778,7 @@ func TestRun(t *testing.T) {
}
}
t.Logf("config: %#v", b.Config())
t.Logf(node.Dump())
t.Log(node.Dump())
}

type testExecutor struct {
Expand Down Expand Up @@ -1084,7 +1083,7 @@ func TestBuilder(t *testing.T) {
}
for i, test := range testCases {
t.Run(fmt.Sprintf("%s %d", test.Dockerfile, i), func(t *testing.T) {
data, err := ioutil.ReadFile(test.Dockerfile)
data, err := os.ReadFile(test.Dockerfile)
if err != nil {
t.Fatalf("%d: %v", i, err)
}
Expand Down Expand Up @@ -1194,7 +1193,7 @@ func TestRunWithEnvArgConflict(t *testing.T) {
}

t.Logf("config: %#v", b.Config())
t.Logf(node.Dump())
t.Log(node.Dump())
}

func TestRunWithMultiArg(t *testing.T) {
Expand Down Expand Up @@ -1230,11 +1229,11 @@ func TestRunWithMultiArg(t *testing.T) {
}

t.Logf("config: %#v", b.Config())
t.Logf(node.Dump())
t.Log(node.Dump())
}

func TestParseDockerignore(t *testing.T) {
dir, err := ioutil.TempDir("", "dockerignore*")
dir, err := os.MkdirTemp("", "dockerignore*")
if err != nil {
t.Fatal(err)
}
Expand Down
13 changes: 8 additions & 5 deletions cmd/imagebuilder/imagebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"syscall"

"github.com/distribution/reference"
dockerregistrytypes "github.com/docker/docker/api/types/registry"
docker "github.com/fsouza/go-dockerclient"
dockerregistrytypes "github.com/moby/moby/api/types/registry"
"k8s.io/klog"

"github.com/openshift/imagebuilder"
Expand All @@ -34,7 +34,7 @@ func main() {
var version bool
var mountSpecs stringSliceFlag

VERSION := "1.2.21-dev"
VERSION := "1.2.22-dev"
arguments := stringMapFlag{}

flag.Var(&tags, "t", "The name to assign this image, if any. May be specified multiple times.")
Expand Down Expand Up @@ -109,8 +109,9 @@ func main() {
return []dockerregistrytypes.AuthConfig{{
Username: authConfig.Username,
Password: authConfig.Password,
Email: authConfig.Email,
ServerAddress: authConfig.ServerAddress,
IdentityToken: authConfig.IdentityToken,
RegistryToken: authConfig.RegistryToken,
}}, true
}
if named, err := reference.ParseNormalizedNamed(name); err == nil {
Expand All @@ -120,8 +121,9 @@ func main() {
return []dockerregistrytypes.AuthConfig{{
Username: authConfig.Username,
Password: authConfig.Password,
Email: authConfig.Email,
ServerAddress: authConfig.ServerAddress,
IdentityToken: authConfig.IdentityToken,
RegistryToken: authConfig.RegistryToken,
}}, true
}
if domain == "docker.io" || strings.HasSuffix(domain, ".docker.io") {
Expand All @@ -135,8 +137,9 @@ func main() {
auths = append(auths, dockerregistrytypes.AuthConfig{
Username: authConfig.Username,
Password: authConfig.Password,
Email: authConfig.Email,
ServerAddress: authConfig.ServerAddress,
IdentityToken: authConfig.IdentityToken,
RegistryToken: authConfig.RegistryToken,
})
}
}
Expand Down
18 changes: 9 additions & 9 deletions dockerclient/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strings"

"github.com/moby/patternmatcher"
"go.podman.io/storage/pkg/archive"
"go.podman.io/storage/pkg/fileutils"
"go.podman.io/storage/pkg/idtools"
Expand Down Expand Up @@ -137,7 +137,7 @@ func archiveFromURL(src, dst, tempDir string, check DirectoryCheck) (io.Reader,
}
r := resp.Body
if resp.ContentLength == -1 {
f, err := ioutil.TempFile(tempDir, "url")
f, err := os.CreateTemp(tempDir, "url")
if err != nil {
return nil, nil, false, fmt.Errorf("unable to create temporary file for source URL: %v", err)
}
Expand Down Expand Up @@ -605,7 +605,7 @@ func (m *archiveMapper) Filter(h *tar.Header, r io.Reader) ([]byte, bool, bool,
pr.Close()
return nil, false, true, fmt.Errorf("needed to create %q as a hard link to %q, but got error refetching %q: %v", h.Name, h.Linkname, h.Linkname, err)
}
buf, err := ioutil.ReadAll(pr)
buf, err := io.ReadAll(pr)
pr.Close()
if err != nil {
return nil, false, true, fmt.Errorf("needed to create %q as a hard link to %q, but got error refetching contents of %q: %v", h.Name, h.Linkname, h.Linkname, err)
Expand Down Expand Up @@ -652,14 +652,14 @@ func archiveOptionsFor(directory string, infos []CopyInfo, dst string, excludes
ChownOpts: &idtools.IDPair{UID: 0, GID: 0},
}

pm, err := fileutils.NewPatternMatcher(excludes)
pm, err := patternmatcher.New(excludes)
if err != nil {
return options, nil
}

if !dstIsDir {
for _, info := range infos {
if ok, _ := pm.Matches(info.Path); ok {
if ok, _ := pm.MatchesOrParentMatches(info.Path); ok {
continue
}
infoPath := info.Path
Expand All @@ -674,7 +674,7 @@ func archiveOptionsFor(directory string, infos []CopyInfo, dst string, excludes
}

for _, info := range infos {
if ok, _ := pm.Matches(info.Path); ok {
if ok, _ := pm.MatchesOrParentMatches(info.Path); ok {
continue
}

Expand Down Expand Up @@ -728,7 +728,7 @@ func sourceToDestinationName(src, dst string, forceDir bool) string {
// error occurs the remainder of the pipe is read to prevent blocking.
func logArchiveOutput(r io.Reader, prefix string) {
pr, pw := io.Pipe()
r = ioutil.NopCloser(io.TeeReader(r, pw))
r = io.NopCloser(io.TeeReader(r, pw))
go func() {
err := func() error {
tr := tar.NewReader(pr)
Expand All @@ -738,14 +738,14 @@ func logArchiveOutput(r io.Reader, prefix string) {
return err
}
klog.Infof("%s %s (%d %s)", prefix, h.Name, h.Size, h.FileInfo().Mode())
if _, err := io.Copy(ioutil.Discard, tr); err != nil {
if _, err := io.Copy(io.Discard, tr); err != nil {
return err
}
}
}()
if err != io.EOF {
klog.Infof("%s: unable to log archive output: %v", prefix, err)
io.Copy(ioutil.Discard, pr)
io.Copy(io.Discard, pr)
}
}()
}
Expand Down
3 changes: 1 addition & 2 deletions dockerclient/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -98,7 +97,7 @@ func (g *archiveGenerator) Reader() io.Reader {
}

func Test_archiveFromFile(t *testing.T) {
f, err := ioutil.TempFile("", "test-tar")
f, err := os.CreateTemp("", "test-tar")
if err != nil {
t.Fatal(err)
}
Expand Down
11 changes: 5 additions & 6 deletions dockerclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"

dockerregistrytypes "github.com/docker/docker/api/types/registry"
docker "github.com/fsouza/go-dockerclient"
dockerregistrytypes "github.com/moby/moby/api/types/registry"
"k8s.io/klog"

"github.com/openshift/imagebuilder"
Expand Down Expand Up @@ -747,7 +746,7 @@ func (e *ClientExecutor) createOrReplaceContainerPathWithOwner(path string, uid,
}
err := e.Client.DownloadFromContainer(e.Container.ID, docker.DownloadFromContainerOptions{
Path: dest,
OutputStream: ioutil.Discard,
OutputStream: io.Discard,
})
return err
}
Expand Down Expand Up @@ -1293,7 +1292,7 @@ func (e *ClientExecutor) isContainerGlobMultiple(client *docker.Client, from, gl

// take the remainder of the input and discard it
go func() {
n, err := io.Copy(ioutil.Discard, reader)
n, err := io.Copy(io.Discard, reader)
if n > 0 || err != nil {
klog.V(6).Infof("Discarded %d bytes from end of from glob check, and got error: %v", n, err)
}
Expand Down Expand Up @@ -1437,7 +1436,7 @@ func filterTarPipe(w *tar.Writer, r *tar.Reader, fn func(*tar.Header) bool) erro
return err
}
} else {
if _, err := io.Copy(ioutil.Discard, r); err != nil {
if _, err := io.Copy(io.Discard, r); err != nil {
return err
}
}
Expand All @@ -1447,7 +1446,7 @@ func filterTarPipe(w *tar.Writer, r *tar.Reader, fn func(*tar.Header) bool) erro
// snapshotPath preserves the contents of path in container containerID as a temporary
// archive, returning either an error or the path of the archived file.
func snapshotPath(path, containerID, tempDir string, client *docker.Client) (string, error) {
f, err := ioutil.TempFile(tempDir, "archived-path")
f, err := os.CreateTemp(tempDir, "archived-path")
if err != nil {
return "", err
}
Expand Down
Loading