From 6fb219cd5fdf2432ccfb73c8a300b4f7b023ce59 Mon Sep 17 00:00:00 2001 From: ian <5948446+jorgemxm@users.noreply.github.com> Date: Wed, 28 Feb 2024 12:21:58 -0500 Subject: [PATCH] Bump docker/cli v23.0.10 --- coverage.txt | 226 ------------------ go.mod | 2 +- go.sum | 4 +- vendor/github.com/docker/cli/AUTHORS | 101 +++++++- .../docker/cli/cli/config/config.go | 20 +- .../docker/cli/cli/config/configfile/file.go | 90 ++----- .../cli/cli/config/configfile/file_unix.go | 2 +- .../cli/cli/config/credentials/file_store.go | 8 +- .../cli/config/credentials/native_store.go | 6 +- .../cli/connhelper/commandconn/commandconn.go | 22 +- .../docker/cli/cli/context/docker/load.go | 22 +- .../docker/cli/cli/context/store/doc.go | 42 ++-- .../cli/cli/context/store/metadatastore.go | 61 +++-- .../docker/cli/cli/context/store/store.go | 181 ++++++-------- .../cli/cli/context/store/storeconfig.go | 2 +- .../docker/cli/cli/context/store/tlsstore.go | 79 +++--- .../docker/cli/cli/context/tlsdata.go | 14 +- .../docker/docker/pkg/ioutils/buffer.go | 51 ++++ .../docker/docker/pkg/ioutils/bytespipe.go | 187 +++++++++++++++ .../docker/docker/pkg/ioutils/fswriters.go | 161 +++++++++++++ .../docker/docker/pkg/ioutils/readers.go | 172 +++++++++++++ .../docker/docker/pkg/ioutils/temp_unix.go | 11 + .../docker/docker/pkg/ioutils/temp_windows.go | 16 ++ .../docker/docker/pkg/ioutils/writeflusher.go | 92 +++++++ .../docker/docker/pkg/ioutils/writers.go | 74 ++++++ .../docker/docker/pkg/longpath/longpath.go | 26 ++ vendor/modules.txt | 4 +- 27 files changed, 1117 insertions(+), 559 deletions(-) create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/buffer.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/fswriters.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/readers.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/writeflusher.go create mode 100644 vendor/github.com/docker/docker/pkg/ioutils/writers.go create mode 100644 vendor/github.com/docker/docker/pkg/longpath/longpath.go diff --git a/coverage.txt b/coverage.txt index 924da815..291897bd 100644 --- a/coverage.txt +++ b/coverage.txt @@ -1,69 +1,6 @@ mode: atomic -github.com/jesseduffield/lazydocker/pkg/app/app.go:30.53,39.16 5 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:39.16,41.3 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:42.2,47.16 3 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:47.16,49.3 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:50.2,52.16 3 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:52.16,54.3 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:55.2,55.17 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:58.29,60.2 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:62.31,64.2 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:72.54,82.35 3 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:82.35,83.60 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:83.60,85.4 1 0 -github.com/jesseduffield/lazydocker/pkg/app/app.go:88.2,88.18 1 0 mode: atomic -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:31.17,33.2 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:35.32,37.16 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:37.16,38.13 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:41.2,41.46 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:41.46,47.17 5 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:47.17,48.14 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:51.3,59.29 4 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:63.45,65.16 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:65.16,67.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:70.39,72.2 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:74.49,76.2 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:78.58,81.59 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:81.59,82.32 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:82.32,83.12 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:86.3,87.21 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:87.21,89.4 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:91.3,102.77 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:105.2,105.24 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:108.106,109.31 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:109.31,111.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:113.2,113.42 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:113.42,114.29 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:114.29,117.4 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:120.2,125.41 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:128.78,131.42 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:131.42,134.44 3 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:134.44,136.4 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:137.3,137.24 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/generate.go:140.2,140.16 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:15.14,20.16 4 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:20.16,22.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:23.2,25.47 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:25.47,27.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:29.2,34.27 4 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:34.27,36.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:38.2,38.38 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:38.38,47.18 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:47.18,49.4 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:50.3,56.13 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:59.2,59.45 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:62.33,64.2 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:66.39,70.81 3 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:70.81,71.27 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:71.27,73.18 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:73.18,75.5 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:76.4,77.28 2 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:80.3,80.13 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:82.2,82.16 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:82.16,84.3 1 0 -github.com/jesseduffield/lazydocker/pkg/cheatsheet/validate.go:86.2,86.16 1 0 mode: atomic github.com/jesseduffield/lazydocker/pkg/commands/container.go:46.78,48.86 2 0 github.com/jesseduffield/lazydocker/pkg/commands/container.go:48.86,49.100 1 0 @@ -1659,173 +1596,10 @@ github.com/jesseduffield/lazydocker/pkg/gui/panels/side_list_panel.go:265.47,266 github.com/jesseduffield/lazydocker/pkg/gui/panels/side_list_panel.go:266.22,268.3 1 0 github.com/jesseduffield/lazydocker/pkg/gui/panels/side_list_panel.go:270.2,270.20 1 0 mode: atomic -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:20.111,22.9 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:22.9,24.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:26.2,28.34 3 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:28.34,30.17 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:30.17,32.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:33.3,33.78 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:36.2,41.16 5 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:41.16,43.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:45.2,53.22 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:57.99,63.46 4 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:63.46,65.17 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:65.17,67.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:68.3,69.17 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:69.17,71.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:73.3,73.23 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:76.2,77.24 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:77.24,79.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:81.2,82.24 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:82.24,84.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:86.2,87.21 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:87.21,89.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:91.2,105.8 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:109.49,113.25 3 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:114.15,115.16 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:116.15,117.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:118.13,119.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:120.13,121.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:122.11,123.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:124.14,125.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:126.14,127.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:128.12,129.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:130.14,131.35 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:132.10,135.40 3 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:135.40,138.4 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:138.9,138.48 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:138.48,142.4 3 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/container_stats.go:142.9,144.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:17.102,27.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:29.66,31.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:33.49,34.85 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:34.85,35.27 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:35.27,37.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:42.3,43.27 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:43.27,45.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:46.3,46.92 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:51.2,53.40 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:57.91,79.46 4 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:80.15,81.53 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:82.14,83.60 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:84.14,85.14 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:86.10,87.37 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:90.2,90.66 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:94.94,95.24 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:95.24,97.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:99.2,99.27 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:100.16,103.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:104.17,105.39 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:106.10,107.12 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:111.81,112.24 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:112.24,114.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:116.2,122.35 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:122.35,124.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:126.2,139.46 4 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:140.15,141.69 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:142.14,143.76 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:144.14,145.14 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:146.10,147.47 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:150.2,150.86 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:150.86,152.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:153.2,153.11 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:157.54,159.9 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:159.9,161.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:163.2,167.21 4 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:167.21,169.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:169.8,169.28 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:169.28,171.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:171.8,173.3 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:175.2,175.54 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:179.63,180.27 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:181.16,184.58 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:184.58,186.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:187.3,187.21 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:188.17,189.22 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:190.17,191.23 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:192.16,193.24 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:194.14,195.21 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:196.20,197.22 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:198.18,199.25 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/containers.go:200.10,201.23 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/images.go:8.61,14.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/menu_items.go:5.67,7.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/networks.go:5.67,7.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/projects.go:5.67,7.2 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:10.96,11.30 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:11.30,13.47 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:14.16,15.24 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:16.15,17.24 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:18.15,19.15 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:20.11,21.27 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:24.3,31.4 1 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/services.go:34.2,42.3 2 0 -github.com/jesseduffield/lazydocker/pkg/gui/presentation/volumes.go:5.64,7.2 1 0 mode: atomic mode: atomic -github.com/jesseduffield/lazydocker/pkg/i18n/chinese.go:3.34,136.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/dutch.go:3.32,98.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/english.go:133.34,267.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/french.go:3.33,120.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/german.go:3.33,97.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:19.101,20.30 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:20.30,23.3 2 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:25.2,25.40 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:25.40,26.28 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:26.28,28.4 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:31.2,31.90 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:34.76,39.65 3 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:39.65,40.48 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:40.48,42.4 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:45.2,45.17 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:49.53,61.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:64.65,65.49 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:65.49,67.3 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/i18n.go:69.2,69.12 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/polish.go:3.33,97.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/portuguese.go:3.37,137.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/spanish.go:3.34,129.2 1 0 -github.com/jesseduffield/lazydocker/pkg/i18n/turkish.go:3.34,97.2 1 0 mode: atomic -github.com/jesseduffield/lazydocker/pkg/log/log.go:14.76,16.50 2 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:16.50,18.3 1 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:18.8,20.3 1 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:24.2,31.4 2 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:34.33,37.16 3 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:37.16,39.3 1 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:40.2,40.14 1 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:43.68,47.16 4 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:47.16,50.3 2 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:51.2,52.12 2 0 -github.com/jesseduffield/lazydocker/pkg/log/log.go:55.43,60.2 4 0 mode: atomic -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:34.90,36.2 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:39.31,40.26 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:40.26,42.3 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:44.2,46.12 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:46.12,49.3 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:51.2,51.9 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:52.11,53.9 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:54.37,55.41 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:59.66,60.12 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:60.12,68.27 7 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:68.27,70.4 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:72.3,75.27 3 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:75.27,79.4 3 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:81.3,89.13 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:89.13,93.4 3 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:96.2,96.12 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:99.23,102.15 3 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:102.15,104.3 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:106.2,110.18 5 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:116.159,119.45 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:119.45,120.20 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:120.20,122.4 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:123.3,127.7 4 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:127.7,128.11 1 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:129.25,131.11 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:132.22,134.11 2 0 -github.com/jesseduffield/lazydocker/pkg/tasks/tasks.go:135.22,137.26 2 0 mode: atomic github.com/jesseduffield/lazydocker/pkg/utils/utils.go:30.50,32.54 2 3 github.com/jesseduffield/lazydocker/pkg/utils/utils.go:32.54,34.3 1 2 diff --git a/go.mod b/go.mod index 5e960cf4..7b064b07 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/OpenPeeDeeP/xdg v0.2.1-0.20190312153938-4ba9e1eb294c github.com/boz/go-throttle v0.0.0-20160922054636-fdc4eab740c1 github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 - github.com/docker/cli v20.10.15+incompatible + github.com/docker/cli v23.0.10-0.20240125104041-672b1497b973+incompatible github.com/docker/docker v23.0.10-0.20240216160024-548f37a132d9+incompatible github.com/fatih/color v1.10.0 github.com/go-errors/errors v1.4.2 diff --git a/go.sum b/go.sum index f098d13d..9f145999 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/cli v20.10.15+incompatible h1:HGO75iIgpyuG1m0hw0Kp7hY5o7XELmY1rsT9gIptOSU= -github.com/docker/cli v20.10.15+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v23.0.10-0.20240125104041-672b1497b973+incompatible h1:2be3Bu00Kwz9D7RNj2wwQWK+XAT9IYg9Ifvz/CDQ714= +github.com/docker/cli v23.0.10-0.20240125104041-672b1497b973+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v23.0.10-0.20240216160024-548f37a132d9+incompatible h1:C4b6PgP3QHSikEWaQ2Q8LFBfMHCEC9QiQ2hZ/If/Vrk= diff --git a/vendor/github.com/docker/cli/AUTHORS b/vendor/github.com/docker/cli/AUTHORS index 8990f85b..483743c9 100644 --- a/vendor/github.com/docker/cli/AUTHORS +++ b/vendor/github.com/docker/cli/AUTHORS @@ -1,9 +1,10 @@ -# This file lists all individuals having contributed content to the repository. -# For how it is generated, see `scripts/docs/generate-authors.sh`. +# File @generated by scripts/docs/generate-authors.sh. DO NOT EDIT. +# This file lists all contributors to the repository. +# See scripts/docs/generate-authors.sh to make modifications. Aanand Prasad Aaron L. Xu -Aaron Lehmann +Aaron Lehmann Aaron.L.Xu Abdur Rehman Abhinandan Prativadi @@ -24,22 +25,27 @@ Akihiro Suda Akim Demaille Alan Thompson Albert Callarisa +Alberto Roura Albin Kerouanton Aleksa Sarai Aleksander Piotrowski Alessandro Boch +Alex Couture-Beil Alex Mavrogiannis Alex Mayer Alexander Boyd Alexander Larsson -Alexander Morozov +Alexander Morozov Alexander Ryabov Alexandre González +Alexey Igrychev +Alexis Couvreur Alfred Landrum Alicia Lauerman Allen Sun Alvin Deng Amen Belayneh +Amey Shrivastava <72866602+AmeyShrivastava@users.noreply.github.com> Amir Goldstein Amit Krishnan Amit Shukla @@ -48,6 +54,8 @@ Anca Iordache Anda Xu Andrea Luzzardi Andreas Köhler +Andres G. Aragoneses +Andres Leon Rangel Andrew France Andrew Hsu Andrew Macpherson @@ -67,8 +75,9 @@ Antonis Kalipetis Anusha Ragunathan Ao Li Arash Deshmeh -Arko Dasgupta -Arnaud Porterie +Arko Dasgupta +Arnaud Porterie +Arnaud Rebillout Arthur Peka Ashwini Oruganti Azat Khuyiyakhmetov @@ -76,18 +85,23 @@ Bardia Keyoumarsi Barnaby Gray Bastiaan Bakker BastianHofmann +Ben Bodenmiller Ben Bonnefoy Ben Creasy Ben Firshman Benjamin Boudreau +Benjamin Böhmke +Benjamin Nater Benoit Sigoure Bhumika Bayani Bill Wang Bin Liu Bingshen Wang +Bishal Das Boaz Shuster Bogdan Anton Boris Pruessmann +Brad Baker Bradley Cicenas Brandon Mitchell Brandon Philips @@ -96,6 +110,7 @@ Bret Fisher Brian (bex) Exelbierd Brian Goff Brian Wieder +Bruno Sousa Bryan Bess Bryan Boreham Bryan Murphy @@ -114,15 +129,19 @@ Charles Chan Charles Law Charles Smith Charlie Drage +Charlotte Mach ChaYoung You +Chee Hau Lim Chen Chuanliang Chen Hanxiao Chen Mingjie Chen Qiu +Chris Couzens Chris Gavin Chris Gibson Chris McKinnel Chris Snow +Chris Vermilion Chris Weyl Christian Persson Christian Stefanescu @@ -131,6 +150,7 @@ Christophe Vidal Christopher Biscardi Christopher Crone Christopher Jones +Christopher Svensson Christy Norman Chun Chen Clinton Kitson @@ -139,8 +159,10 @@ Colin Hebert Collin Guarino Colm Hally Comical Derskeal <27731088+derskeal@users.noreply.github.com> +Conner Crosby Corey Farrell Corey Quon +Cory Bennet Craig Wilhite Cristian Staretu Daehyeok Mun @@ -170,11 +192,13 @@ Dattatraya Kumbhar Dave Goodchild Dave Henderson Dave Tucker +David Alvarez David Beitey David Calavera David Cramer David Dooling David Gageot +David Karlsson David Lechner David Scott David Sheets @@ -186,7 +210,8 @@ Denis Defreyne Denis Gladkikh Denis Ollier Dennis Docter -Derek McGowan +Derek McGowan +Des Preston Deshi Xiao Dharmit Shah Dhawal Yogesh Bhanushali @@ -196,12 +221,14 @@ Dimitry Andric Ding Fei Diogo Monica Djordje Lukic +Dmitriy Fishman Dmitry Gusev Dmitry Smirnov Dmitry V. Krivenok Dominik Braun Don Kjer Dong Chen +DongGeon Lee Doug Davis Drew Erny Ed Costello @@ -211,12 +238,14 @@ Eli Uriegas Elias Faxö Elliot Luo <956941328@qq.com> Eric Curtin +Eric Engestrom Eric G. Noriega Eric Rosenberg Eric Sage Eric-Olivier Lamey Erica Windisch Erik Hollensbe +Erik Humphrey Erik St. Martin Essam A. Hassan Ethan Haynes @@ -229,8 +258,10 @@ Evelyn Xu Everett Toews Fabio Falci Fabrizio Soppelsa +Felix Geyer Felix Hupfeld Felix Rabe +fezzik1620 Filip Jareš Flavio Crisciani Florian Klein @@ -242,6 +273,7 @@ Frederic Hemberger Frederick F. Kautz IV Frederik Nordahl Jul Sabroe Frieder Bluemle +Gabriel Gore Gabriel Nicolas Avellaneda Gaetan de Villele Gang Qiao @@ -251,13 +283,18 @@ George MacRorie George Xie Gianluca Borello Gildas Cuisinier +Gio d'Amelio +Gleb Stsenov Goksu Toprak Gou Rao +Govind Rai Grant Reaber Greg Pflaum +Gsealy Guilhem Lettron Guillaume J. Charmes Guillaume Le Floch +Guillaume Tardif gwx296173 Günther Jungbluth Hakan Özler @@ -278,6 +315,7 @@ Hugo Gabriel Eyherabide huqun Huu Nguyen Hyzhou Zhy +Iain Samuel McLean Elder Ian Campbell Ian Philpot Ignacio Capurro @@ -287,6 +325,7 @@ Ilya Sotkov Ioan Eugen Stan Isabel Jimenez Ivan Grcic +Ivan Grund Ivan Markin Jacob Atzen Jacob Tomlinson @@ -302,15 +341,18 @@ Jan-Jaap Driessen Jana Radhakrishnan Jared Hocutt Jasmine Hegman +Jason Hall Jason Heiss Jason Plum Jay Kamat +Jean Lecordier Jean Rouge Jean-Christophe Sirot Jean-Pierre Huynh Jeff Lindsay Jeff Nickoloff Jeff Silberman +Jennings Zhang Jeremy Chambers Jeremy Unruh Jeremy Yallop @@ -322,6 +364,7 @@ Jian Zhang Jie Luo Jilles Oldenbeuving Jim Galasyn +Jim Lin Jimmy Leger Jimmy Song jimmyxian @@ -338,6 +381,7 @@ Johannes 'fish' Ziemke John Feminella John Harris John Howard +John Howard John Laswell John Maguire John Mulhausen @@ -347,13 +391,16 @@ John Tims John V. Martinez John Willis Jon Johnson +Jon Zeolla Jonatas Baldin Jonathan Boulle Jonathan Lee Jonathan Lomas Jonathan McCrohan +Jonathan Warriss-Simmons Jonh Wendell Jordan Jennings +Jorge Vallecillo Jose J. Escobar <53836904+jescobar-docker@users.noreply.github.com> Joseph Kern Josh Bodah @@ -383,9 +430,11 @@ Katie McLaughlin Ke Xu Kei Ohmura Keith Hudgins +Kelton Bassingthwaite Ken Cochrane Ken ICHIKAWA Kenfe-Mickaël Laventure +Kevin Alvarez Kevin Burke Kevin Feyrer Kevin Kern @@ -401,6 +450,7 @@ Krasi Georgiev Kris-Mikael Krister Kun Zhang Kunal Kushwaha +Kyle Mitofsky Lachlan Cooper Lai Jiangshan Lars Kellogg-Stedman @@ -410,6 +460,7 @@ Lee Gaines Lei Jitang Lennie Leo Gallucci +Leonid Skorospelov Lewis Daly Li Yi Li Yi @@ -445,6 +496,7 @@ Manjunath A Kumatagi Mansi Nahar mapk0y Marc Bihlmaier +Marc Cornellà Marco Mariani Marco Vedovati Marcus Martins @@ -459,6 +511,7 @@ Mason Fish Mason Malone Mateusz Major Mathieu Champlon +Mathieu Rollet Matt Gucci Matt Robenolt Matteo Orefice @@ -467,11 +520,13 @@ Matthieu Hauglustaine Mauro Porras P Max Shytikov Maxime Petazzoni +Maximillian Fan Xavier Mei ChunTao +Metal <2466052+tedhexaflow@users.noreply.github.com> Micah Zoltu Michael A. Smith Michael Bridgen -Michael Crosby +Michael Crosby Michael Friis Michael Irwin Michael Käufl @@ -487,6 +542,7 @@ Mihai Borobocea Mihuleacc Sergiu Mike Brown Mike Casas +Mike Dalton Mike Danese Mike Dillon Mike Goelzer @@ -503,9 +559,12 @@ Mohini Anne Dsouza Moorthy RS Morgan Bauer Morten Hekkvang +Morten Linderud Moysés Borges +Mozi <29089388+pzhlkj6612@users.noreply.github.com> Mrunal Patel muicoder +Murukesh Mohanan Muthukumar R Máximo Cuadros Mårten Cassel @@ -521,6 +580,7 @@ Nathan LeClaire Nathan McCauley Neil Peterson Nick Adcock +Nick Santos Nico Stapelbroek Nicola Kabar Nicolas Borboën @@ -535,6 +595,8 @@ Noah Treuhaft O.S. Tezer Odin Ugedal ohmystack +OKA Naoya +Oliver Pomeroy Olle Jonsson Olli Janatuinen Oscar Wieman @@ -550,9 +612,12 @@ Paul Lietar Paul Mulders Paul Weaver Pavel Pospisil +Paweł Gronowski +Paweł Pokrywka Paweł Szczekutowicz Peeyush Gupta Per Lundberg +Peter Dave Hello Peter Edge Peter Hsu Peter Jaffe @@ -560,11 +625,13 @@ Peter Kehl Peter Nagy Peter Salvatore Peter Waller -Phil Estes +Phil Estes Philip Alexander Etling Philipp Gillé Philipp Schmied +Phong Tran pidster +Pieter E Smit pixelistik Pratik Karki Prayag Verma @@ -574,6 +641,7 @@ Qiang Huang Qinglan Peng qudongfang Raghavendra K T +Rahul Kadyan Rahul Zoldyck Ravi Shekhar Jethani Ray Tsang @@ -582,6 +650,7 @@ Remy Suen Renaud Gaubert Ricardo N Feliciano Rich Moyse +Richard Chen Zheng <58443436+rchenzheng@users.noreply.github.com> Richard Mathie Richard Scothern Rick Wieman @@ -591,6 +660,7 @@ Rob Gulewich Robert Wallis Robin Naundorf Robin Speekenbrink +Roch Feuillade Rodolfo Ortiz Rogelio Canedo Rohan Verma @@ -609,11 +679,13 @@ Sainath Grandhi Sakeven Jiang Sally O'Malley Sam Neirinck +Sam Thibault Samarth Shah Sambuddha Basu Sami Tabet Samuel Cochran Samuel Karp +Sandro Jäckel Santhosh Manohar Sargun Dhillon Saswat Bhattacharya @@ -643,7 +715,8 @@ Slava Semushin Solomon Hykes Song Gao Spencer Brown -squeegels <1674195+squeegels@users.noreply.github.com> +Spring Lee +squeegels Srini Brahmaroutu Stefan S. Stefan Scherer @@ -654,6 +727,7 @@ Stephen Rust Steve Durrheimer Steve Richards Steven Burgess +Stoica-Marcu Floris-Andrei Subhajit Ghosh Sun Jianbo Sune Keller @@ -665,7 +739,10 @@ Sébastien HOUZÉ T K Sourabh TAGOMORI Satoshi taiji-tech +Takeshi Koenuma +Takuya Noguchi Taylor Jones +Teiva Harsanyi Tejaswini Duggaraju Tengfei Wang Teppei Fukuda @@ -696,6 +773,7 @@ Tom Fotherby Tom Klingenberg Tom Milligan Tom X. Tobin +Tomas Bäckman Tomas Tomecek Tomasz Kopczynski Tomáš Hrčka @@ -711,6 +789,7 @@ Ulrich Bareth Ulysses Souza Umesh Yadav Valentin Lorentz +Vardan Pogosian Venkateswara Reddy Bukkasamudram Veres Lajos Victor Vieux @@ -757,6 +836,7 @@ Yunxiang Huang Zachary Romero Zander Mackie zebrilee +Zeel B Patel Zhang Kun Zhang Wei Zhang Wentao @@ -768,4 +848,5 @@ Zhu Guihua Álex González Álvaro Lázaro Átila Camurça Alves +Александр Менщиков <__Singleton__@hackerdom.ru> 徐俊杰 diff --git a/vendor/github.com/docker/cli/cli/config/config.go b/vendor/github.com/docker/cli/cli/config/config.go index 31ad117d..b7c05c3f 100644 --- a/vendor/github.com/docker/cli/cli/config/config.go +++ b/vendor/github.com/docker/cli/cli/config/config.go @@ -19,7 +19,7 @@ const ( // ConfigFileName is the name of config file ConfigFileName = "config.json" configFileDir = ".docker" - oldConfigfile = ".dockercfg" + oldConfigfile = ".dockercfg" // Deprecated: remove once we stop printing deprecation warning contextsDir = "contexts" ) @@ -84,16 +84,6 @@ func Path(p ...string) (string, error) { return path, nil } -// LegacyLoadFromReader is a convenience function that creates a ConfigFile object from -// a non-nested reader -func LegacyLoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { - configFile := configfile.ConfigFile{ - AuthConfigs: make(map[string]types.AuthConfig), - } - err := configFile.LegacyLoadFromReader(configData) - return &configFile, err -} - // LoadFromReader is a convenience function that creates a ConfigFile object from // a reader func LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { @@ -140,12 +130,8 @@ func load(configDir string) (*configfile.ConfigFile, bool, error) { // Can't find latest config file so check for the old one filename = filepath.Join(getHomeDir(), oldConfigfile) - if file, err := os.Open(filename); err == nil { + if _, err := os.Stat(filename); err == nil { printLegacyFileWarning = true - defer file.Close() - if err := configFile.LegacyLoadFromReader(file); err != nil { - return configFile, printLegacyFileWarning, errors.Wrap(err, filename) - } } return configFile, printLegacyFileWarning, nil } @@ -158,7 +144,7 @@ func LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile { fmt.Fprintf(stderr, "WARNING: Error loading config file: %v\n", err) } if printLegacyFileWarning { - _, _ = fmt.Fprintln(stderr, "WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release") + _, _ = fmt.Fprintln(stderr, "WARNING: Support for the legacy ~/.dockercfg configuration file and file-format has been removed and the configuration file will be ignored") } if !configFile.ContainsAuth() { configFile.CredentialsStore = credentials.DetectDefaultStore(configFile.CredentialsStore) diff --git a/vendor/github.com/docker/cli/cli/config/configfile/file.go b/vendor/github.com/docker/cli/cli/config/configfile/file.go index d6f71081..579154d7 100644 --- a/vendor/github.com/docker/cli/cli/config/configfile/file.go +++ b/vendor/github.com/docker/cli/cli/config/configfile/file.go @@ -3,9 +3,7 @@ package configfile import ( "encoding/base64" "encoding/json" - "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -16,13 +14,6 @@ import ( "github.com/sirupsen/logrus" ) -const ( - // This constant is only used for really old config files when the - // URL wasn't saved as part of the config file and it was just - // assumed to be this value. - defaultIndexServer = "https://index.docker.io/v1/" -) - // ConfigFile ~/.docker/config.json file info type ConfigFile struct { AuthConfigs map[string]types.AuthConfig `json:"auths"` @@ -46,8 +37,7 @@ type ConfigFile struct { PruneFilters []string `json:"pruneFilters,omitempty"` Proxies map[string]ProxyConfig `json:"proxies,omitempty"` Experimental string `json:"experimental,omitempty"` - StackOrchestrator string `json:"stackOrchestrator,omitempty"` - Kubernetes *KubernetesConfig `json:"kubernetes,omitempty"` + StackOrchestrator string `json:"stackOrchestrator,omitempty"` // Deprecated: swarm is now the default orchestrator, and this option is ignored. CurrentContext string `json:"currentContext,omitempty"` CLIPluginsExtraDirs []string `json:"cliPluginsExtraDirs,omitempty"` Plugins map[string]map[string]string `json:"plugins,omitempty"` @@ -60,11 +50,7 @@ type ProxyConfig struct { HTTPSProxy string `json:"httpsProxy,omitempty"` NoProxy string `json:"noProxy,omitempty"` FTPProxy string `json:"ftpProxy,omitempty"` -} - -// KubernetesConfig contains Kubernetes orchestrator settings -type KubernetesConfig struct { - AllNamespaces string `json:"allNamespaces,omitempty"` + AllProxy string `json:"allProxy,omitempty"` } // New initializes an empty configuration file for the given filename 'fn' @@ -78,44 +64,6 @@ func New(fn string) *ConfigFile { } } -// LegacyLoadFromReader reads the non-nested configuration data given and sets up the -// auth config information with given directory and populates the receiver object -func (configFile *ConfigFile) LegacyLoadFromReader(configData io.Reader) error { - b, err := ioutil.ReadAll(configData) - if err != nil { - return err - } - - if err := json.Unmarshal(b, &configFile.AuthConfigs); err != nil { - arr := strings.Split(string(b), "\n") - if len(arr) < 2 { - return errors.Errorf("The Auth config file is empty") - } - authConfig := types.AuthConfig{} - origAuth := strings.Split(arr[0], " = ") - if len(origAuth) != 2 { - return errors.Errorf("Invalid Auth config file") - } - authConfig.Username, authConfig.Password, err = decodeAuth(origAuth[1]) - if err != nil { - return err - } - authConfig.ServerAddress = defaultIndexServer - configFile.AuthConfigs[defaultIndexServer] = authConfig - } else { - for k, authConfig := range configFile.AuthConfigs { - authConfig.Username, authConfig.Password, err = decodeAuth(authConfig.Auth) - if err != nil { - return err - } - authConfig.Auth = "" - authConfig.ServerAddress = k - configFile.AuthConfigs[k] = authConfig - } - } - return nil -} - // LoadFromReader reads the configuration data given and sets up the auth config // information with given directory and populates the receiver object func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error { @@ -134,7 +82,7 @@ func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error { ac.ServerAddress = addr configFile.AuthConfigs[addr] = ac } - return checkKubernetesConfiguration(configFile.Kubernetes) + return nil } // ContainsAuth returns whether there is authentication configured @@ -147,6 +95,9 @@ func (configFile *ConfigFile) ContainsAuth() bool { // GetAuthConfigs returns the mapping of repo to auth configuration func (configFile *ConfigFile) GetAuthConfigs() map[string]types.AuthConfig { + if configFile.AuthConfigs == nil { + configFile.AuthConfigs = make(map[string]types.AuthConfig) + } return configFile.AuthConfigs } @@ -191,10 +142,10 @@ func (configFile *ConfigFile) Save() (retErr error) { } dir := filepath.Dir(configFile.Filename) - if err := os.MkdirAll(dir, 0700); err != nil { + if err := os.MkdirAll(dir, 0o700); err != nil { return err } - temp, err := ioutil.TempFile(dir, filepath.Base(configFile.Filename)) + temp, err := os.CreateTemp(dir, filepath.Base(configFile.Filename)) if err != nil { return err } @@ -244,6 +195,7 @@ func (configFile *ConfigFile) ParseProxyConfig(host string, runOpts map[string]* "HTTPS_PROXY": &config.HTTPSProxy, "NO_PROXY": &config.NoProxy, "FTP_PROXY": &config.FTPProxy, + "ALL_PROXY": &config.AllProxy, } m := runOpts if m == nil { @@ -292,12 +244,11 @@ func decodeAuth(authStr string) (string, string, error) { if n > decLen { return "", "", errors.Errorf("Something went wrong decoding auth config") } - arr := strings.SplitN(string(decoded), ":", 2) - if len(arr) != 2 { + userName, password, ok := strings.Cut(string(decoded), ":") + if !ok || userName == "" { return "", "", errors.Errorf("Invalid auth configuration file") } - password := strings.Trim(arr[1], "\x00") - return arr[0], password, nil + return userName, strings.Trim(password, "\x00"), nil } // GetCredentialsStore returns a new credentials store from the settings in the @@ -352,7 +303,8 @@ func (configFile *ConfigFile) GetAllCredentials() (map[string]types.AuthConfig, for registryHostname := range configFile.CredentialHelpers { newAuth, err := configFile.GetAuthConfig(registryHostname) if err != nil { - return nil, err + logrus.WithError(err).Warnf("Failed to get credentials for registry: %s", registryHostname) + continue } auths[registryHostname] = newAuth } @@ -399,17 +351,3 @@ func (configFile *ConfigFile) SetPluginConfig(pluginname, option, value string) delete(configFile.Plugins, pluginname) } } - -func checkKubernetesConfiguration(kubeConfig *KubernetesConfig) error { - if kubeConfig == nil { - return nil - } - switch kubeConfig.AllNamespaces { - case "": - case "enabled": - case "disabled": - default: - return fmt.Errorf("invalid 'kubernetes.allNamespaces' value, should be 'enabled' or 'disabled': %s", kubeConfig.AllNamespaces) - } - return nil -} diff --git a/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go b/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go index 6af67181..35388754 100644 --- a/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go +++ b/vendor/github.com/docker/cli/cli/config/configfile/file_unix.go @@ -12,7 +12,7 @@ import ( // ignoring any error during the process. func copyFilePermissions(src, dst string) { var ( - mode os.FileMode = 0600 + mode os.FileMode = 0o600 uid, gid int ) diff --git a/vendor/github.com/docker/cli/cli/config/credentials/file_store.go b/vendor/github.com/docker/cli/cli/config/credentials/file_store.go index e509820b..ea30fc30 100644 --- a/vendor/github.com/docker/cli/cli/config/credentials/file_store.go +++ b/vendor/github.com/docker/cli/cli/config/credentials/file_store.go @@ -52,7 +52,8 @@ func (c *fileStore) GetAll() (map[string]types.AuthConfig, error) { // Store saves the given credentials in the file store. func (c *fileStore) Store(authConfig types.AuthConfig) error { - c.file.GetAuthConfigs()[authConfig.ServerAddress] = authConfig + authConfigs := c.file.GetAuthConfigs() + authConfigs[authConfig.ServerAddress] = authConfig return c.file.Save() } @@ -75,7 +76,6 @@ func ConvertToHostname(url string) string { stripped = strings.TrimPrefix(url, "https://") } - nameParts := strings.SplitN(stripped, "/", 2) - - return nameParts[0] + hostName, _, _ := strings.Cut(stripped, "/") + return hostName } diff --git a/vendor/github.com/docker/cli/cli/config/credentials/native_store.go b/vendor/github.com/docker/cli/cli/config/credentials/native_store.go index afe542cc..b9af145b 100644 --- a/vendor/github.com/docker/cli/cli/config/credentials/native_store.go +++ b/vendor/github.com/docker/cli/cli/config/credentials/native_store.go @@ -7,7 +7,7 @@ import ( ) const ( - remoteCredentialsPrefix = "docker-credential-" + remoteCredentialsPrefix = "docker-credential-" //nolint:gosec // ignore G101: Potential hardcoded credentials tokenUsername = "" ) @@ -51,6 +51,7 @@ func (c *nativeStore) Get(serverAddress string) (types.AuthConfig, error) { auth.Username = creds.Username auth.IdentityToken = creds.IdentityToken auth.Password = creds.Password + auth.ServerAddress = creds.ServerAddress return auth, nil } @@ -76,6 +77,9 @@ func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) { ac.Username = creds.Username ac.Password = creds.Password ac.IdentityToken = creds.IdentityToken + if ac.ServerAddress == "" { + ac.ServerAddress = creds.ServerAddress + } authConfigs[registry] = ac } diff --git a/vendor/github.com/docker/cli/cli/connhelper/commandconn/commandconn.go b/vendor/github.com/docker/cli/cli/connhelper/commandconn/commandconn.go index 128da447..202ddb84 100644 --- a/vendor/github.com/docker/cli/cli/connhelper/commandconn/commandconn.go +++ b/vendor/github.com/docker/cli/cli/connhelper/commandconn/commandconn.go @@ -4,13 +4,13 @@ // For example, to provide an http.Client that can connect to a Docker daemon // running in a Docker container ("DIND"): // -// httpClient := &http.Client{ -// Transport: &http.Transport{ -// DialContext: func(ctx context.Context, _network, _addr string) (net.Conn, error) { -// return commandconn.New(ctx, "docker", "exec", "-it", containerID, "docker", "system", "dial-stdio") -// }, -// }, -// } +// httpClient := &http.Client{ +// Transport: &http.Transport{ +// DialContext: func(ctx context.Context, _network, _addr string) (net.Conn, error) { +// return commandconn.New(ctx, "docker", "exec", "-it", containerID, "docker", "system", "dial-stdio") +// }, +// }, +// } package commandconn import ( @@ -32,12 +32,12 @@ import ( ) // New returns net.Conn -func New(ctx context.Context, cmd string, args ...string) (net.Conn, error) { +func New(_ context.Context, cmd string, args ...string) (net.Conn, error) { var ( c commandConn err error ) - c.cmd = exec.CommandContext(ctx, cmd, args...) + c.cmd = exec.Command(cmd, args...) // we assume that args never contains sensitive information logrus.Debugf("commandconn: starting %s with %v", cmd, args) c.cmd.Env = os.Environ() @@ -236,17 +236,21 @@ func (c *commandConn) Close() error { func (c *commandConn) LocalAddr() net.Addr { return c.localAddr } + func (c *commandConn) RemoteAddr() net.Addr { return c.remoteAddr } + func (c *commandConn) SetDeadline(t time.Time) error { logrus.Debugf("unimplemented call: SetDeadline(%v)", t) return nil } + func (c *commandConn) SetReadDeadline(t time.Time) error { logrus.Debugf("unimplemented call: SetReadDeadline(%v)", t) return nil } + func (c *commandConn) SetWriteDeadline(t time.Time) error { logrus.Debugf("unimplemented call: SetWriteDeadline(%v)", t) return nil diff --git a/vendor/github.com/docker/cli/cli/context/docker/load.go b/vendor/github.com/docker/cli/cli/context/docker/load.go index ccfee02d..09ec4050 100644 --- a/vendor/github.com/docker/cli/cli/context/docker/load.go +++ b/vendor/github.com/docker/cli/cli/context/docker/load.go @@ -4,10 +4,8 @@ import ( "crypto/tls" "crypto/x509" "encoding/pem" - "fmt" "net" "net/http" - "os" "time" "github.com/docker/cli/cli/connhelper" @@ -67,17 +65,10 @@ func (c *Endpoint) tlsConfig() (*tls.Config, error) { keyBytes := c.TLSData.Key pemBlock, _ := pem.Decode(keyBytes) if pemBlock == nil { - return nil, fmt.Errorf("no valid private key found") + return nil, errors.New("no valid private key found") } - - var err error - // TODO should we follow Golang, and deprecate RFC 1423 encryption, and produce a warning (or just error)? see https://github.com/docker/cli/issues/3212 - if x509.IsEncryptedPEMBlock(pemBlock) { //nolint: staticcheck // SA1019: x509.IsEncryptedPEMBlock is deprecated, and insecure by design - keyBytes, err = x509.DecryptPEMBlock(pemBlock, []byte(c.TLSPassword)) //nolint: staticcheck // SA1019: x509.IsEncryptedPEMBlock is deprecated, and insecure by design - if err != nil { - return nil, errors.Wrap(err, "private key is encrypted, but could not decrypt it") - } - keyBytes = pem.EncodeToMemory(&pem.Block{Type: pemBlock.Type, Bytes: keyBytes}) + if x509.IsEncryptedPEMBlock(pemBlock) { //nolint:staticcheck // SA1019: x509.IsEncryptedPEMBlock is deprecated, and insecure by design + return nil, errors.New("private key is encrypted - support for encrypted private keys has been removed, see https://docs.docker.com/go/deprecated/") } x509cert, err := tls.X509KeyPair(c.TLSData.Cert, keyBytes) @@ -130,12 +121,7 @@ func (c *Endpoint) ClientOpts() ([]client.Opt, error) { } } - version := os.Getenv("DOCKER_API_VERSION") - if version != "" { - result = append(result, client.WithVersion(version)) - } else { - result = append(result, client.WithAPIVersionNegotiation()) - } + result = append(result, client.WithVersionFromEnv(), client.WithAPIVersionNegotiation()) return result, nil } diff --git a/vendor/github.com/docker/cli/cli/context/store/doc.go b/vendor/github.com/docker/cli/cli/context/store/doc.go index 5626a64d..705982ae 100644 --- a/vendor/github.com/docker/cli/cli/context/store/doc.go +++ b/vendor/github.com/docker/cli/cli/context/store/doc.go @@ -1,22 +1,32 @@ -// Package store provides a generic way to store credentials to connect to virtually any kind of remote system. -// The term `context` comes from the similar feature in Kubernetes kubectl config files. +// Package store provides a generic way to store credentials to connect to +// virtually any kind of remote system. +// The term `context` comes from the similar feature in Kubernetes kubectl +// config files. // -// Conceptually, a context is a set of metadata and TLS data, that can be used to connect to various endpoints -// of a remote system. TLS data and metadata are stored separately, so that in the future, we will be able to store sensitive -// information in a more secure way, depending on the os we are running on (e.g.: on Windows we could use the user Certificate Store, on Mac OS the user Keychain...). +// Conceptually, a context is a set of metadata and TLS data, that can be used +// to connect to various endpoints of a remote system. TLS data and metadata +// are stored separately, so that in the future, we will be able to store +// sensitive information in a more secure way, depending on the os we are running +// on (e.g.: on Windows we could use the user Certificate Store, on macOS the +// user Keychain...). // // Current implementation is purely file based with the following structure: -// ${CONTEXT_ROOT} -// - meta/ -// - /meta.json: contains context medata (key/value pairs) as well as a list of endpoints (themselves containing key/value pair metadata) -// - tls/ -// - /endpoint1/: directory containing TLS data for the endpoint1 in the corresponding context // -// The context store itself has absolutely no knowledge about what a docker or a kubernetes endpoint should contain in term of metadata or TLS config. -// Client code is responsible for generating and parsing endpoint metadata and TLS files. -// The multi-endpoints approach of this package allows to combine many different endpoints in the same "context" (e.g., the Docker CLI -// is able for a single context to define both a docker endpoint and a Kubernetes endpoint for the same cluster, and also specify which -// orchestrator to use by default when deploying a compose stack on this cluster). +// ${CONTEXT_ROOT} +// meta/ +// /meta.json: contains context medata (key/value pairs) as +// well as a list of endpoints (themselves containing +// key/value pair metadata). +// tls/ +// /endpoint1/: directory containing TLS data for the endpoint1 +// in the corresponding context. // -// Context IDs are actually SHA256 hashes of the context name, and are there only to avoid dealing with special characters in context names. +// The context store itself has absolutely no knowledge about what a docker +// endpoint should contain in term of metadata or TLS config. Client code is +// responsible for generating and parsing endpoint metadata and TLS files. The +// multi-endpoints approach of this package allows to combine many different +// endpoints in the same "context". +// +// Context IDs are actually SHA256 hashes of the context name, and are there +// only to avoid dealing with special characters in context names. package store diff --git a/vendor/github.com/docker/cli/cli/context/store/metadatastore.go b/vendor/github.com/docker/cli/cli/context/store/metadatastore.go index 0e9bc888..62c3f82a 100644 --- a/vendor/github.com/docker/cli/cli/context/store/metadatastore.go +++ b/vendor/github.com/docker/cli/cli/context/store/metadatastore.go @@ -3,13 +3,15 @@ package store import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "reflect" "sort" + "github.com/docker/docker/errdefs" + "github.com/docker/docker/pkg/ioutils" "github.com/fvbommel/sortorder" + "github.com/pkg/errors" ) const ( @@ -28,14 +30,14 @@ func (s *metadataStore) contextDir(id contextdir) string { func (s *metadataStore) createOrUpdate(meta Metadata) error { contextDir := s.contextDir(contextdirOf(meta.Name)) - if err := os.MkdirAll(contextDir, 0755); err != nil { + if err := os.MkdirAll(contextDir, 0o755); err != nil { return err } bytes, err := json.Marshal(&meta) if err != nil { return err } - return ioutil.WriteFile(filepath.Join(contextDir, metaFile), bytes, 0644) + return ioutils.AtomicWriteFile(filepath.Join(contextDir, metaFile), bytes, 0o644) } func parseTypedOrMap(payload []byte, getter TypeGetter) (interface{}, error) { @@ -56,49 +58,65 @@ func parseTypedOrMap(payload []byte, getter TypeGetter) (interface{}, error) { return reflect.ValueOf(typed).Elem().Interface(), nil } -func (s *metadataStore) get(id contextdir) (Metadata, error) { - contextDir := s.contextDir(id) - bytes, err := ioutil.ReadFile(filepath.Join(contextDir, metaFile)) +func (s *metadataStore) get(name string) (Metadata, error) { + m, err := s.getByID(contextdirOf(name)) if err != nil { - return Metadata{}, convertContextDoesNotExist(err) + return m, errors.Wrapf(err, "context %q", name) + } + return m, nil +} + +func (s *metadataStore) getByID(id contextdir) (Metadata, error) { + fileName := filepath.Join(s.contextDir(id), metaFile) + bytes, err := os.ReadFile(fileName) + if err != nil { + if errors.Is(err, os.ErrNotExist) { + return Metadata{}, errdefs.NotFound(errors.Wrap(err, "context not found")) + } + return Metadata{}, err } var untyped untypedContextMetadata r := Metadata{ Endpoints: make(map[string]interface{}), } if err := json.Unmarshal(bytes, &untyped); err != nil { - return Metadata{}, err + return Metadata{}, fmt.Errorf("parsing %s: %v", fileName, err) } r.Name = untyped.Name if r.Metadata, err = parseTypedOrMap(untyped.Metadata, s.config.contextType); err != nil { - return Metadata{}, err + return Metadata{}, fmt.Errorf("parsing %s: %v", fileName, err) } for k, v := range untyped.Endpoints { if r.Endpoints[k], err = parseTypedOrMap(v, s.config.endpointTypes[k]); err != nil { - return Metadata{}, err + return Metadata{}, fmt.Errorf("parsing %s: %v", fileName, err) } } return r, err } -func (s *metadataStore) remove(id contextdir) error { - contextDir := s.contextDir(id) - return os.RemoveAll(contextDir) +func (s *metadataStore) remove(name string) error { + if err := os.RemoveAll(s.contextDir(contextdirOf(name))); err != nil { + return errors.Wrapf(err, "failed to remove metadata") + } + return nil } func (s *metadataStore) list() ([]Metadata, error) { ctxDirs, err := listRecursivelyMetadataDirs(s.root) if err != nil { - if os.IsNotExist(err) { + if errors.Is(err, os.ErrNotExist) { return nil, nil } return nil, err } var res []Metadata for _, dir := range ctxDirs { - c, err := s.get(contextdir(dir)) + c, err := s.getByID(contextdir(dir)) if err != nil { - return nil, err + if errors.Is(err, os.ErrNotExist) { + continue + } + return nil, errors.Wrap(err, "failed to read metadata") } res = append(res, c) } @@ -117,7 +135,7 @@ func isContextDir(path string) bool { } func listRecursivelyMetadataDirs(root string) ([]string, error) { - fis, err := ioutil.ReadDir(root) + fis, err := os.ReadDir(root) if err != nil { return nil, err } @@ -132,20 +150,13 @@ func listRecursivelyMetadataDirs(root string) ([]string, error) { return nil, err } for _, s := range subs { - result = append(result, fmt.Sprintf("%s/%s", fi.Name(), s)) + result = append(result, filepath.Join(fi.Name(), s)) } } } return result, nil } -func convertContextDoesNotExist(err error) error { - if os.IsNotExist(err) { - return &contextDoesNotExistError{} - } - return err -} - type untypedContextMetadata struct { Metadata json.RawMessage `json:"metadata,omitempty"` Endpoints map[string]json.RawMessage `json:"endpoints,omitempty"` diff --git a/vendor/github.com/docker/cli/cli/context/store/store.go b/vendor/github.com/docker/cli/cli/context/store/store.go index 71220e9a..037464bb 100644 --- a/vendor/github.com/docker/cli/cli/context/store/store.go +++ b/vendor/github.com/docker/cli/cli/context/store/store.go @@ -7,9 +7,7 @@ import ( "bytes" _ "crypto/sha256" // ensure ids can be computed "encoding/json" - "fmt" "io" - "io/ioutil" "net/http" "path" "path/filepath" @@ -17,7 +15,7 @@ import ( "strings" "github.com/docker/docker/errdefs" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) @@ -95,11 +93,11 @@ type ContextTLSData struct { // New creates a store from a given directory. // If the directory does not exist or is empty, initialize it -func New(dir string, cfg Config) Store { +func New(dir string, cfg Config) *ContextStore { metaRoot := filepath.Join(dir, metadataDir) tlsRoot := filepath.Join(dir, tlsDir) - return &store{ + return &ContextStore{ meta: &metadataStore{ root: metaRoot, config: cfg, @@ -110,82 +108,106 @@ func New(dir string, cfg Config) Store { } } -type store struct { +// ContextStore implements Store. +type ContextStore struct { meta *metadataStore tls *tlsStore } -func (s *store) List() ([]Metadata, error) { +// List return all contexts. +func (s *ContextStore) List() ([]Metadata, error) { return s.meta.list() } -func (s *store) CreateOrUpdate(meta Metadata) error { +// Names return Metadata names for a Lister +func Names(s Lister) ([]string, error) { + list, err := s.List() + if err != nil { + return nil, err + } + var names []string + for _, item := range list { + names = append(names, item.Name) + } + return names, nil +} + +// CreateOrUpdate creates or updates metadata for the context. +func (s *ContextStore) CreateOrUpdate(meta Metadata) error { return s.meta.createOrUpdate(meta) } -func (s *store) Remove(name string) error { - id := contextdirOf(name) - if err := s.meta.remove(id); err != nil { - return patchErrContextName(err, name) +// Remove deletes the context with the given name, if found. +func (s *ContextStore) Remove(name string) error { + if err := s.meta.remove(name); err != nil { + return errors.Wrapf(err, "failed to remove context %s", name) } - return patchErrContextName(s.tls.removeAllContextData(id), name) + if err := s.tls.remove(name); err != nil { + return errors.Wrapf(err, "failed to remove context %s", name) + } + return nil } -func (s *store) GetMetadata(name string) (Metadata, error) { - res, err := s.meta.get(contextdirOf(name)) - patchErrContextName(err, name) - return res, err +// GetMetadata returns the metadata for the context with the given name. +// It returns an errdefs.ErrNotFound if the context was not found. +func (s *ContextStore) GetMetadata(name string) (Metadata, error) { + return s.meta.get(name) } -func (s *store) ResetTLSMaterial(name string, data *ContextTLSData) error { - id := contextdirOf(name) - if err := s.tls.removeAllContextData(id); err != nil { - return patchErrContextName(err, name) +// ResetTLSMaterial removes TLS data for all endpoints in the context and replaces +// it with the new data. +func (s *ContextStore) ResetTLSMaterial(name string, data *ContextTLSData) error { + if err := s.tls.remove(name); err != nil { + return err } if data == nil { return nil } for ep, files := range data.Endpoints { for fileName, data := range files.Files { - if err := s.tls.createOrUpdate(id, ep, fileName, data); err != nil { - return patchErrContextName(err, name) + if err := s.tls.createOrUpdate(name, ep, fileName, data); err != nil { + return err } } } return nil } -func (s *store) ResetEndpointTLSMaterial(contextName string, endpointName string, data *EndpointTLSData) error { - id := contextdirOf(contextName) - if err := s.tls.removeAllEndpointData(id, endpointName); err != nil { - return patchErrContextName(err, contextName) +// ResetEndpointTLSMaterial removes TLS data for the given context and endpoint, +// and replaces it with the new data. +func (s *ContextStore) ResetEndpointTLSMaterial(contextName string, endpointName string, data *EndpointTLSData) error { + if err := s.tls.removeEndpoint(contextName, endpointName); err != nil { + return err } if data == nil { return nil } for fileName, data := range data.Files { - if err := s.tls.createOrUpdate(id, endpointName, fileName, data); err != nil { - return patchErrContextName(err, contextName) + if err := s.tls.createOrUpdate(contextName, endpointName, fileName, data); err != nil { + return err } } return nil } -func (s *store) ListTLSFiles(name string) (map[string]EndpointFiles, error) { - res, err := s.tls.listContextData(contextdirOf(name)) - return res, patchErrContextName(err, name) +// ListTLSFiles returns the list of TLS files present for each endpoint in the +// context. +func (s *ContextStore) ListTLSFiles(name string) (map[string]EndpointFiles, error) { + return s.tls.listContextData(name) } -func (s *store) GetTLSData(contextName, endpointName, fileName string) ([]byte, error) { - res, err := s.tls.getData(contextdirOf(contextName), endpointName, fileName) - return res, patchErrContextName(err, contextName) +// GetTLSData reads, and returns the content of the given fileName for an endpoint. +// It returns an errdefs.ErrNotFound if the file was not found. +func (s *ContextStore) GetTLSData(contextName, endpointName, fileName string) ([]byte, error) { + return s.tls.getData(contextName, endpointName, fileName) } -func (s *store) GetStorageInfo(contextName string) StorageInfo { - dir := contextdirOf(contextName) +// GetStorageInfo returns the paths where the Metadata and TLS data are stored +// for the context. +func (s *ContextStore) GetStorageInfo(contextName string) StorageInfo { return StorageInfo{ - MetadataPath: s.meta.contextDir(dir), - TLSPath: s.tls.contextDir(dir), + MetadataPath: s.meta.contextDir(contextdirOf(contextName)), + TLSPath: s.tls.contextDir(contextName), } } @@ -198,7 +220,7 @@ func ValidateContextName(name string) error { return errors.New(`"default" is a reserved context name`) } if !restrictedNameRegEx.MatchString(name) { - return fmt.Errorf("context name %q is invalid, names are validated against regexp %q", name, restrictedNamePattern) + return errors.Errorf("context name %q is invalid, names are validated against regexp %q", name, restrictedNamePattern) } return nil } @@ -224,7 +246,7 @@ func Export(name string, s Reader) io.ReadCloser { } if err = tw.WriteHeader(&tar.Header{ Name: metaFile, - Mode: 0644, + Mode: 0o644, Size: int64(len(metaBytes)), }); err != nil { writer.CloseWithError(err) @@ -241,7 +263,7 @@ func Export(name string, s Reader) io.ReadCloser { } if err = tw.WriteHeader(&tar.Header{ Name: "tls", - Mode: 0700, + Mode: 0o700, Size: 0, Typeflag: tar.TypeDir, }); err != nil { @@ -251,7 +273,7 @@ func Export(name string, s Reader) io.ReadCloser { for endpointName, endpointFiles := range tlsFiles { if err = tw.WriteHeader(&tar.Header{ Name: path.Join("tls", endpointName), - Mode: 0700, + Mode: 0o700, Size: 0, Typeflag: tar.TypeDir, }); err != nil { @@ -266,7 +288,7 @@ func Export(name string, s Reader) io.ReadCloser { } if err = tw.WriteHeader(&tar.Header{ Name: path.Join("tls", endpointName, fileName), - Mode: 0600, + Mode: 0o600, Size: int64(len(data)), }); err != nil { writer.CloseWithError(err) @@ -349,7 +371,7 @@ func importTar(name string, s Writer, reader io.Reader) error { return errors.Wrap(err, hdr.Name) } if hdr.Name == metaFile { - data, err := ioutil.ReadAll(tr) + data, err := io.ReadAll(tr) if err != nil { return err } @@ -362,7 +384,7 @@ func importTar(name string, s Writer, reader io.Reader) error { } importedMetaFile = true } else if strings.HasPrefix(hdr.Name, "tls/") { - data, err := ioutil.ReadAll(tr) + data, err := io.ReadAll(tr) if err != nil { return err } @@ -378,7 +400,7 @@ func importTar(name string, s Writer, reader io.Reader) error { } func importZip(name string, s Writer, reader io.Reader) error { - body, err := ioutil.ReadAll(&LimitedReader{R: reader, N: maxAllowedFileSizeToImport}) + body, err := io.ReadAll(&LimitedReader{R: reader, N: maxAllowedFileSizeToImport}) if err != nil { return err } @@ -406,7 +428,7 @@ func importZip(name string, s Writer, reader io.Reader) error { return err } - data, err := ioutil.ReadAll(&LimitedReader{R: f, N: maxAllowedFileSizeToImport}) + data, err := io.ReadAll(&LimitedReader{R: f, N: maxAllowedFileSizeToImport}) defer f.Close() if err != nil { return err @@ -424,7 +446,7 @@ func importZip(name string, s Writer, reader io.Reader) error { if err != nil { return err } - data, err := ioutil.ReadAll(f) + data, err := io.ReadAll(f) defer f.Close() if err != nil { return err @@ -472,58 +494,18 @@ func importEndpointTLS(tlsData *ContextTLSData, path string, data []byte) error return nil } -type setContextName interface { - setContext(name string) -} - -type contextDoesNotExistError struct { - name string -} - -func (e *contextDoesNotExistError) Error() string { - return fmt.Sprintf("context %q does not exist", e.name) -} - -func (e *contextDoesNotExistError) setContext(name string) { - e.name = name -} - -// NotFound satisfies interface github.com/docker/docker/errdefs.ErrNotFound -func (e *contextDoesNotExistError) NotFound() {} - -type tlsDataDoesNotExist interface { - errdefs.ErrNotFound - IsTLSDataDoesNotExist() -} - -type tlsDataDoesNotExistError struct { - context, endpoint, file string -} - -func (e *tlsDataDoesNotExistError) Error() string { - return fmt.Sprintf("tls data for %s/%s/%s does not exist", e.context, e.endpoint, e.file) -} - -func (e *tlsDataDoesNotExistError) setContext(name string) { - e.context = name -} - -// NotFound satisfies interface github.com/docker/docker/errdefs.ErrNotFound -func (e *tlsDataDoesNotExistError) NotFound() {} - -// IsTLSDataDoesNotExist satisfies tlsDataDoesNotExist -func (e *tlsDataDoesNotExistError) IsTLSDataDoesNotExist() {} - -// IsErrContextDoesNotExist checks if the given error is a "context does not exist" condition +// IsErrContextDoesNotExist checks if the given error is a "context does not exist" condition. +// +// Deprecated: use github.com/docker/docker/errdefs.IsNotFound() func IsErrContextDoesNotExist(err error) bool { - _, ok := err.(*contextDoesNotExistError) - return ok + return errdefs.IsNotFound(err) } // IsErrTLSDataDoesNotExist checks if the given error is a "context does not exist" condition +// +// Deprecated: use github.com/docker/docker/errdefs.IsNotFound() func IsErrTLSDataDoesNotExist(err error) bool { - _, ok := err.(tlsDataDoesNotExist) - return ok + return errdefs.IsNotFound(err) } type contextdir string @@ -531,10 +513,3 @@ type contextdir string func contextdirOf(name string) contextdir { return contextdir(digest.FromString(name).Encoded()) } - -func patchErrContextName(err error, name string) error { - if typed, ok := err.(setContextName); ok { - typed.setContext(name) - } - return err -} diff --git a/vendor/github.com/docker/cli/cli/context/store/storeconfig.go b/vendor/github.com/docker/cli/cli/context/store/storeconfig.go index 2a4bc57c..9c93ecba 100644 --- a/vendor/github.com/docker/cli/cli/context/store/storeconfig.go +++ b/vendor/github.com/docker/cli/cli/context/store/storeconfig.go @@ -19,7 +19,7 @@ func EndpointTypeGetter(name string, getter TypeGetter) NamedTypeGetter { } } -// Config is used to configure the metadata marshaler of the context store +// Config is used to configure the metadata marshaler of the context ContextStore type Config struct { contextType TypeGetter endpointTypes map[string]TypeGetter diff --git a/vendor/github.com/docker/cli/cli/context/store/tlsstore.go b/vendor/github.com/docker/cli/cli/context/store/tlsstore.go index 1188ce2d..ffbbde7c 100644 --- a/vendor/github.com/docker/cli/cli/context/store/tlsstore.go +++ b/vendor/github.com/docker/cli/cli/context/store/tlsstore.go @@ -1,9 +1,12 @@ package store import ( - "io/ioutil" "os" "path/filepath" + + "github.com/docker/docker/errdefs" + "github.com/docker/docker/pkg/ioutils" + "github.com/pkg/errors" ) const tlsDir = "tls" @@ -12,69 +15,70 @@ type tlsStore struct { root string } -func (s *tlsStore) contextDir(id contextdir) string { - return filepath.Join(s.root, string(id)) +func (s *tlsStore) contextDir(name string) string { + return filepath.Join(s.root, string(contextdirOf(name))) } -func (s *tlsStore) endpointDir(contextID contextdir, name string) string { - return filepath.Join(s.root, string(contextID), name) +func (s *tlsStore) endpointDir(name, endpointName string) string { + return filepath.Join(s.contextDir(name), endpointName) } -func (s *tlsStore) filePath(contextID contextdir, endpointName, filename string) string { - return filepath.Join(s.root, string(contextID), endpointName, filename) -} - -func (s *tlsStore) createOrUpdate(contextID contextdir, endpointName, filename string, data []byte) error { - epdir := s.endpointDir(contextID, endpointName) +func (s *tlsStore) createOrUpdate(name, endpointName, filename string, data []byte) error { parentOfRoot := filepath.Dir(s.root) - if err := os.MkdirAll(parentOfRoot, 0755); err != nil { + if err := os.MkdirAll(parentOfRoot, 0o755); err != nil { return err } - if err := os.MkdirAll(epdir, 0700); err != nil { + endpointDir := s.endpointDir(name, endpointName) + if err := os.MkdirAll(endpointDir, 0o700); err != nil { return err } - return ioutil.WriteFile(s.filePath(contextID, endpointName, filename), data, 0600) + return ioutils.AtomicWriteFile(filepath.Join(endpointDir, filename), data, 0o600) } -func (s *tlsStore) getData(contextID contextdir, endpointName, filename string) ([]byte, error) { - data, err := ioutil.ReadFile(s.filePath(contextID, endpointName, filename)) +func (s *tlsStore) getData(name, endpointName, filename string) ([]byte, error) { + data, err := os.ReadFile(filepath.Join(s.endpointDir(name, endpointName), filename)) if err != nil { - return nil, convertTLSDataDoesNotExist(endpointName, filename, err) + if os.IsNotExist(err) { + return nil, errdefs.NotFound(errors.Errorf("TLS data for %s/%s/%s does not exist", name, endpointName, filename)) + } + return nil, errors.Wrapf(err, "failed to read TLS data for endpoint %s", endpointName) } return data, nil } -func (s *tlsStore) remove(contextID contextdir, endpointName, filename string) error { - err := os.Remove(s.filePath(contextID, endpointName, filename)) - if os.IsNotExist(err) { - return nil +// remove deletes all TLS data for the given context. +func (s *tlsStore) remove(name string) error { + if err := os.RemoveAll(s.contextDir(name)); err != nil { + return errors.Wrapf(err, "failed to remove TLS data") } - return err + return nil } -func (s *tlsStore) removeAllEndpointData(contextID contextdir, endpointName string) error { - return os.RemoveAll(s.endpointDir(contextID, endpointName)) +func (s *tlsStore) removeEndpoint(name, endpointName string) error { + if err := os.RemoveAll(s.endpointDir(name, endpointName)); err != nil { + return errors.Wrapf(err, "failed to remove TLS data for endpoint %s", endpointName) + } + return nil } -func (s *tlsStore) removeAllContextData(contextID contextdir) error { - return os.RemoveAll(s.contextDir(contextID)) -} - -func (s *tlsStore) listContextData(contextID contextdir) (map[string]EndpointFiles, error) { - epFSs, err := ioutil.ReadDir(s.contextDir(contextID)) +func (s *tlsStore) listContextData(name string) (map[string]EndpointFiles, error) { + contextDir := s.contextDir(name) + epFSs, err := os.ReadDir(contextDir) if err != nil { if os.IsNotExist(err) { return map[string]EndpointFiles{}, nil } - return nil, err + return nil, errors.Wrapf(err, "failed to list TLS files for context %s", name) } r := make(map[string]EndpointFiles) for _, epFS := range epFSs { if epFS.IsDir() { - epDir := s.endpointDir(contextID, epFS.Name()) - fss, err := ioutil.ReadDir(epDir) + fss, err := os.ReadDir(filepath.Join(contextDir, epFS.Name())) + if os.IsNotExist(err) { + continue + } if err != nil { - return nil, err + return nil, errors.Wrapf(err, "failed to list TLS files for endpoint %s", epFS.Name()) } var files EndpointFiles for _, fs := range fss { @@ -90,10 +94,3 @@ func (s *tlsStore) listContextData(contextID contextdir) (map[string]EndpointFil // EndpointFiles is a slice of strings representing file names type EndpointFiles []string - -func convertTLSDataDoesNotExist(endpoint, file string, err error) error { - if os.IsNotExist(err) { - return &tlsDataDoesNotExistError{endpoint: endpoint, file: file} - } - return err -} diff --git a/vendor/github.com/docker/cli/cli/context/tlsdata.go b/vendor/github.com/docker/cli/cli/context/tlsdata.go index 124d98ba..c758612a 100644 --- a/vendor/github.com/docker/cli/cli/context/tlsdata.go +++ b/vendor/github.com/docker/cli/cli/context/tlsdata.go @@ -1,7 +1,7 @@ package context import ( - "io/ioutil" + "os" "github.com/docker/cli/cli/context/store" "github.com/pkg/errors" @@ -45,14 +45,14 @@ func (data *TLSData) ToStoreTLSData() *store.EndpointTLSData { func LoadTLSData(s store.Reader, contextName, endpointName string) (*TLSData, error) { tlsFiles, err := s.ListTLSFiles(contextName) if err != nil { - return nil, errors.Wrapf(err, "failed to retrieve context tls files for context %q", contextName) + return nil, errors.Wrapf(err, "failed to retrieve TLS files for context %q", contextName) } if epTLSFiles, ok := tlsFiles[endpointName]; ok { var tlsData TLSData for _, f := range epTLSFiles { data, err := s.GetTLSData(contextName, endpointName, f) if err != nil { - return nil, errors.Wrapf(err, "failed to retrieve context tls data for file %q of context %q", f, contextName) + return nil, errors.Wrapf(err, "failed to retrieve TLS data (%s) for context %q", f, contextName) } switch f { case caKey: @@ -62,7 +62,7 @@ func LoadTLSData(s store.Reader, contextName, endpointName string) (*TLSData, er case keyKey: tlsData.Key = data default: - logrus.Warnf("unknown file %s in context %s tls bundle", f, contextName) + logrus.Warnf("unknown file in context %s TLS bundle: %s", contextName, f) } } return &tlsData, nil @@ -77,17 +77,17 @@ func TLSDataFromFiles(caPath, certPath, keyPath string) (*TLSData, error) { err error ) if caPath != "" { - if ca, err = ioutil.ReadFile(caPath); err != nil { + if ca, err = os.ReadFile(caPath); err != nil { return nil, err } } if certPath != "" { - if cert, err = ioutil.ReadFile(certPath); err != nil { + if cert, err = os.ReadFile(certPath); err != nil { return nil, err } } if keyPath != "" { - if key, err = ioutil.ReadFile(keyPath); err != nil { + if key, err = os.ReadFile(keyPath); err != nil { return nil, err } } diff --git a/vendor/github.com/docker/docker/pkg/ioutils/buffer.go b/vendor/github.com/docker/docker/pkg/ioutils/buffer.go new file mode 100644 index 00000000..466f7929 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/buffer.go @@ -0,0 +1,51 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "errors" + "io" +) + +var errBufferFull = errors.New("buffer is full") + +type fixedBuffer struct { + buf []byte + pos int + lastRead int +} + +func (b *fixedBuffer) Write(p []byte) (int, error) { + n := copy(b.buf[b.pos:cap(b.buf)], p) + b.pos += n + + if n < len(p) { + if b.pos == cap(b.buf) { + return n, errBufferFull + } + return n, io.ErrShortWrite + } + return n, nil +} + +func (b *fixedBuffer) Read(p []byte) (int, error) { + n := copy(p, b.buf[b.lastRead:b.pos]) + b.lastRead += n + return n, nil +} + +func (b *fixedBuffer) Len() int { + return b.pos - b.lastRead +} + +func (b *fixedBuffer) Cap() int { + return cap(b.buf) +} + +func (b *fixedBuffer) Reset() { + b.pos = 0 + b.lastRead = 0 + b.buf = b.buf[:0] +} + +func (b *fixedBuffer) String() string { + return string(b.buf[b.lastRead:b.pos]) +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go b/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go new file mode 100644 index 00000000..c1cfa62f --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go @@ -0,0 +1,187 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "errors" + "io" + "sync" +) + +// maxCap is the highest capacity to use in byte slices that buffer data. +const maxCap = 1e6 + +// minCap is the lowest capacity to use in byte slices that buffer data +const minCap = 64 + +// blockThreshold is the minimum number of bytes in the buffer which will cause +// a write to BytesPipe to block when allocating a new slice. +const blockThreshold = 1e6 + +var ( + // ErrClosed is returned when Write is called on a closed BytesPipe. + ErrClosed = errors.New("write to closed BytesPipe") + + bufPools = make(map[int]*sync.Pool) + bufPoolsLock sync.Mutex +) + +// BytesPipe is io.ReadWriteCloser which works similarly to pipe(queue). +// All written data may be read at most once. Also, BytesPipe allocates +// and releases new byte slices to adjust to current needs, so the buffer +// won't be overgrown after peak loads. +type BytesPipe struct { + mu sync.Mutex + wait *sync.Cond + buf []*fixedBuffer + bufLen int + closeErr error // error to return from next Read. set to nil if not closed. + readBlock bool // check read BytesPipe is Wait() or not +} + +// NewBytesPipe creates new BytesPipe, initialized by specified slice. +// If buf is nil, then it will be initialized with slice which cap is 64. +// buf will be adjusted in a way that len(buf) == 0, cap(buf) == cap(buf). +func NewBytesPipe() *BytesPipe { + bp := &BytesPipe{} + bp.buf = append(bp.buf, getBuffer(minCap)) + bp.wait = sync.NewCond(&bp.mu) + return bp +} + +// Write writes p to BytesPipe. +// It can allocate new []byte slices in a process of writing. +func (bp *BytesPipe) Write(p []byte) (int, error) { + bp.mu.Lock() + defer bp.mu.Unlock() + + written := 0 +loop0: + for { + if bp.closeErr != nil { + return written, ErrClosed + } + + if len(bp.buf) == 0 { + bp.buf = append(bp.buf, getBuffer(64)) + } + // get the last buffer + b := bp.buf[len(bp.buf)-1] + + n, err := b.Write(p) + written += n + bp.bufLen += n + + // errBufferFull is an error we expect to get if the buffer is full + if err != nil && err != errBufferFull { + bp.wait.Broadcast() + return written, err + } + + // if there was enough room to write all then break + if len(p) == n { + break + } + + // more data: write to the next slice + p = p[n:] + + // make sure the buffer doesn't grow too big from this write + for bp.bufLen >= blockThreshold { + if bp.readBlock { + bp.wait.Broadcast() + } + bp.wait.Wait() + if bp.closeErr != nil { + continue loop0 + } + } + + // add new byte slice to the buffers slice and continue writing + nextCap := b.Cap() * 2 + if nextCap > maxCap { + nextCap = maxCap + } + bp.buf = append(bp.buf, getBuffer(nextCap)) + } + bp.wait.Broadcast() + return written, nil +} + +// CloseWithError causes further reads from a BytesPipe to return immediately. +func (bp *BytesPipe) CloseWithError(err error) error { + bp.mu.Lock() + if err != nil { + bp.closeErr = err + } else { + bp.closeErr = io.EOF + } + bp.wait.Broadcast() + bp.mu.Unlock() + return nil +} + +// Close causes further reads from a BytesPipe to return immediately. +func (bp *BytesPipe) Close() error { + return bp.CloseWithError(nil) +} + +// Read reads bytes from BytesPipe. +// Data could be read only once. +func (bp *BytesPipe) Read(p []byte) (n int, err error) { + bp.mu.Lock() + defer bp.mu.Unlock() + if bp.bufLen == 0 { + if bp.closeErr != nil { + return 0, bp.closeErr + } + bp.readBlock = true + bp.wait.Wait() + bp.readBlock = false + if bp.bufLen == 0 && bp.closeErr != nil { + return 0, bp.closeErr + } + } + + for bp.bufLen > 0 { + b := bp.buf[0] + read, _ := b.Read(p) // ignore error since fixedBuffer doesn't really return an error + n += read + bp.bufLen -= read + + if b.Len() == 0 { + // it's empty so return it to the pool and move to the next one + returnBuffer(b) + bp.buf[0] = nil + bp.buf = bp.buf[1:] + } + + if len(p) == read { + break + } + + p = p[read:] + } + + bp.wait.Broadcast() + return +} + +func returnBuffer(b *fixedBuffer) { + b.Reset() + bufPoolsLock.Lock() + pool := bufPools[b.Cap()] + bufPoolsLock.Unlock() + if pool != nil { + pool.Put(b) + } +} + +func getBuffer(size int) *fixedBuffer { + bufPoolsLock.Lock() + pool, ok := bufPools[size] + if !ok { + pool = &sync.Pool{New: func() interface{} { return &fixedBuffer{buf: make([]byte, 0, size)} }} + bufPools[size] = pool + } + bufPoolsLock.Unlock() + return pool.Get().(*fixedBuffer) +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go b/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go new file mode 100644 index 00000000..82671d8c --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go @@ -0,0 +1,161 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "io" + "os" + "path/filepath" +) + +// NewAtomicFileWriter returns WriteCloser so that writing to it writes to a +// temporary file and closing it atomically changes the temporary file to +// destination path. Writing and closing concurrently is not allowed. +func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, error) { + f, err := os.CreateTemp(filepath.Dir(filename), ".tmp-"+filepath.Base(filename)) + if err != nil { + return nil, err + } + + abspath, err := filepath.Abs(filename) + if err != nil { + return nil, err + } + return &atomicFileWriter{ + f: f, + fn: abspath, + perm: perm, + }, nil +} + +// AtomicWriteFile atomically writes data to a file named by filename. +func AtomicWriteFile(filename string, data []byte, perm os.FileMode) error { + f, err := NewAtomicFileWriter(filename, perm) + if err != nil { + return err + } + n, err := f.Write(data) + if err == nil && n < len(data) { + err = io.ErrShortWrite + f.(*atomicFileWriter).writeErr = err + } + if err1 := f.Close(); err == nil { + err = err1 + } + return err +} + +type atomicFileWriter struct { + f *os.File + fn string + writeErr error + perm os.FileMode +} + +func (w *atomicFileWriter) Write(dt []byte) (int, error) { + n, err := w.f.Write(dt) + if err != nil { + w.writeErr = err + } + return n, err +} + +func (w *atomicFileWriter) Close() (retErr error) { + defer func() { + if retErr != nil || w.writeErr != nil { + os.Remove(w.f.Name()) + } + }() + if err := w.f.Sync(); err != nil { + w.f.Close() + return err + } + if err := w.f.Close(); err != nil { + return err + } + if err := os.Chmod(w.f.Name(), w.perm); err != nil { + return err + } + if w.writeErr == nil { + return os.Rename(w.f.Name(), w.fn) + } + return nil +} + +// AtomicWriteSet is used to atomically write a set +// of files and ensure they are visible at the same time. +// Must be committed to a new directory. +type AtomicWriteSet struct { + root string +} + +// NewAtomicWriteSet creates a new atomic write set to +// atomically create a set of files. The given directory +// is used as the base directory for storing files before +// commit. If no temporary directory is given the system +// default is used. +func NewAtomicWriteSet(tmpDir string) (*AtomicWriteSet, error) { + td, err := os.MkdirTemp(tmpDir, "write-set-") + if err != nil { + return nil, err + } + + return &AtomicWriteSet{ + root: td, + }, nil +} + +// WriteFile writes a file to the set, guaranteeing the file +// has been synced. +func (ws *AtomicWriteSet) WriteFile(filename string, data []byte, perm os.FileMode) error { + f, err := ws.FileWriter(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm) + if err != nil { + return err + } + n, err := f.Write(data) + if err == nil && n < len(data) { + err = io.ErrShortWrite + } + if err1 := f.Close(); err == nil { + err = err1 + } + return err +} + +type syncFileCloser struct { + *os.File +} + +func (w syncFileCloser) Close() error { + err := w.File.Sync() + if err1 := w.File.Close(); err == nil { + err = err1 + } + return err +} + +// FileWriter opens a file writer inside the set. The file +// should be synced and closed before calling commit. +func (ws *AtomicWriteSet) FileWriter(name string, flag int, perm os.FileMode) (io.WriteCloser, error) { + f, err := os.OpenFile(filepath.Join(ws.root, name), flag, perm) + if err != nil { + return nil, err + } + return syncFileCloser{f}, nil +} + +// Cancel cancels the set and removes all temporary data +// created in the set. +func (ws *AtomicWriteSet) Cancel() error { + return os.RemoveAll(ws.root) +} + +// Commit moves all created files to the target directory. The +// target directory must not exist and the parent of the target +// directory must exist. +func (ws *AtomicWriteSet) Commit(target string) error { + return os.Rename(ws.root, target) +} + +// String returns the location the set is writing to. +func (ws *AtomicWriteSet) String() string { + return ws.root +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/readers.go b/vendor/github.com/docker/docker/pkg/ioutils/readers.go new file mode 100644 index 00000000..d82ae930 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/readers.go @@ -0,0 +1,172 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "context" + "io" + "runtime/debug" + "sync/atomic" + + // make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered + // TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged. + _ "crypto/sha256" + _ "crypto/sha512" + + "github.com/sirupsen/logrus" +) + +// ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser +// It calls the given callback function when closed. It should be constructed +// with NewReadCloserWrapper +type ReadCloserWrapper struct { + io.Reader + closer func() error + closed atomic.Bool +} + +// Close calls back the passed closer function +func (r *ReadCloserWrapper) Close() error { + if !r.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("ReadCloserWrapper") + return nil + } + return r.closer() +} + +// NewReadCloserWrapper returns a new io.ReadCloser. +func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser { + return &ReadCloserWrapper{ + Reader: r, + closer: closer, + } +} + +type readerErrWrapper struct { + reader io.Reader + closer func() +} + +func (r *readerErrWrapper) Read(p []byte) (int, error) { + n, err := r.reader.Read(p) + if err != nil { + r.closer() + } + return n, err +} + +// NewReaderErrWrapper returns a new io.Reader. +func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader { + return &readerErrWrapper{ + reader: r, + closer: closer, + } +} + +// OnEOFReader wraps an io.ReadCloser and a function +// the function will run at the end of file or close the file. +type OnEOFReader struct { + Rc io.ReadCloser + Fn func() +} + +func (r *OnEOFReader) Read(p []byte) (n int, err error) { + n, err = r.Rc.Read(p) + if err == io.EOF { + r.runFunc() + } + return +} + +// Close closes the file and run the function. +func (r *OnEOFReader) Close() error { + err := r.Rc.Close() + r.runFunc() + return err +} + +func (r *OnEOFReader) runFunc() { + if fn := r.Fn; fn != nil { + fn() + r.Fn = nil + } +} + +// cancelReadCloser wraps an io.ReadCloser with a context for cancelling read +// operations. +type cancelReadCloser struct { + cancel func() + pR *io.PipeReader // Stream to read from + pW *io.PipeWriter + closed atomic.Bool +} + +// NewCancelReadCloser creates a wrapper that closes the ReadCloser when the +// context is cancelled. The returned io.ReadCloser must be closed when it is +// no longer needed. +func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser { + pR, pW := io.Pipe() + + // Create a context used to signal when the pipe is closed + doneCtx, cancel := context.WithCancel(context.Background()) + + p := &cancelReadCloser{ + cancel: cancel, + pR: pR, + pW: pW, + } + + go func() { + _, err := io.Copy(pW, in) + select { + case <-ctx.Done(): + // If the context was closed, p.closeWithError + // was already called. Calling it again would + // change the error that Read returns. + default: + p.closeWithError(err) + } + in.Close() + }() + go func() { + for { + select { + case <-ctx.Done(): + p.closeWithError(ctx.Err()) + case <-doneCtx.Done(): + return + } + } + }() + + return p +} + +// Read wraps the Read method of the pipe that provides data from the wrapped +// ReadCloser. +func (p *cancelReadCloser) Read(buf []byte) (n int, err error) { + return p.pR.Read(buf) +} + +// closeWithError closes the wrapper and its underlying reader. It will +// cause future calls to Read to return err. +func (p *cancelReadCloser) closeWithError(err error) { + p.pW.CloseWithError(err) + p.cancel() +} + +// Close closes the wrapper its underlying reader. It will cause +// future calls to Read to return io.EOF. +func (p *cancelReadCloser) Close() error { + if !p.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("cancelReadCloser") + return nil + } + p.closeWithError(io.EOF) + return nil +} + +func subsequentCloseWarn(name string) { + logrus.Error("subsequent attempt to close " + name) + if logrus.GetLevel() >= logrus.DebugLevel { + logrus.Errorf("stack trace: %s", string(debug.Stack())) + } +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go b/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go new file mode 100644 index 00000000..74891223 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go @@ -0,0 +1,11 @@ +//go:build !windows +// +build !windows + +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import "os" + +// TempDir on Unix systems is equivalent to os.MkdirTemp. +func TempDir(dir, prefix string) (string, error) { + return os.MkdirTemp(dir, prefix) +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go b/vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go new file mode 100644 index 00000000..a57fd9af --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go @@ -0,0 +1,16 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "os" + + "github.com/docker/docker/pkg/longpath" +) + +// TempDir is the equivalent of os.MkdirTemp, except that the result is in Windows longpath format. +func TempDir(dir, prefix string) (string, error) { + tempDir, err := os.MkdirTemp(dir, prefix) + if err != nil { + return "", err + } + return longpath.AddPrefix(tempDir), nil +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/writeflusher.go b/vendor/github.com/docker/docker/pkg/ioutils/writeflusher.go new file mode 100644 index 00000000..91b8d182 --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/writeflusher.go @@ -0,0 +1,92 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "io" + "sync" +) + +// WriteFlusher wraps the Write and Flush operation ensuring that every write +// is a flush. In addition, the Close method can be called to intercept +// Read/Write calls if the targets lifecycle has already ended. +type WriteFlusher struct { + w io.Writer + flusher flusher + flushed chan struct{} + flushedOnce sync.Once + closed chan struct{} + closeLock sync.Mutex +} + +type flusher interface { + Flush() +} + +var errWriteFlusherClosed = io.EOF + +func (wf *WriteFlusher) Write(b []byte) (n int, err error) { + select { + case <-wf.closed: + return 0, errWriteFlusherClosed + default: + } + + n, err = wf.w.Write(b) + wf.Flush() // every write is a flush. + return n, err +} + +// Flush the stream immediately. +func (wf *WriteFlusher) Flush() { + select { + case <-wf.closed: + return + default: + } + + wf.flushedOnce.Do(func() { + close(wf.flushed) + }) + wf.flusher.Flush() +} + +// Flushed returns the state of flushed. +// If it's flushed, return true, or else it return false. +func (wf *WriteFlusher) Flushed() bool { + // BUG(stevvooe): Remove this method. Its use is inherently racy. Seems to + // be used to detect whether or a response code has been issued or not. + // Another hook should be used instead. + var flushed bool + select { + case <-wf.flushed: + flushed = true + default: + } + return flushed +} + +// Close closes the write flusher, disallowing any further writes to the +// target. After the flusher is closed, all calls to write or flush will +// result in an error. +func (wf *WriteFlusher) Close() error { + wf.closeLock.Lock() + defer wf.closeLock.Unlock() + + select { + case <-wf.closed: + return errWriteFlusherClosed + default: + close(wf.closed) + } + return nil +} + +// NewWriteFlusher returns a new WriteFlusher. +func NewWriteFlusher(w io.Writer) *WriteFlusher { + var fl flusher + if f, ok := w.(flusher); ok { + fl = f + } else { + fl = &NopFlusher{} + } + return &WriteFlusher{w: w, flusher: fl, closed: make(chan struct{}), flushed: make(chan struct{})} +} diff --git a/vendor/github.com/docker/docker/pkg/ioutils/writers.go b/vendor/github.com/docker/docker/pkg/ioutils/writers.go new file mode 100644 index 00000000..1f50602f --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/ioutils/writers.go @@ -0,0 +1,74 @@ +package ioutils // import "github.com/docker/docker/pkg/ioutils" + +import ( + "io" + "sync/atomic" +) + +// NopWriter represents a type which write operation is nop. +type NopWriter struct{} + +func (*NopWriter) Write(buf []byte) (int, error) { + return len(buf), nil +} + +type nopWriteCloser struct { + io.Writer +} + +func (w *nopWriteCloser) Close() error { return nil } + +// NopWriteCloser returns a nopWriteCloser. +func NopWriteCloser(w io.Writer) io.WriteCloser { + return &nopWriteCloser{w} +} + +// NopFlusher represents a type which flush operation is nop. +type NopFlusher struct{} + +// Flush is a nop operation. +func (f *NopFlusher) Flush() {} + +type writeCloserWrapper struct { + io.Writer + closer func() error + closed atomic.Bool +} + +func (r *writeCloserWrapper) Close() error { + if !r.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("WriteCloserWrapper") + return nil + } + return r.closer() +} + +// NewWriteCloserWrapper returns a new io.WriteCloser. +func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser { + return &writeCloserWrapper{ + Writer: r, + closer: closer, + } +} + +// WriteCounter wraps a concrete io.Writer and hold a count of the number +// of bytes written to the writer during a "session". +// This can be convenient when write return is masked +// (e.g., json.Encoder.Encode()) +type WriteCounter struct { + Count int64 + Writer io.Writer +} + +// NewWriteCounter returns a new WriteCounter. +func NewWriteCounter(w io.Writer) *WriteCounter { + return &WriteCounter{ + Writer: w, + } +} + +func (wc *WriteCounter) Write(p []byte) (count int, err error) { + count, err = wc.Writer.Write(p) + wc.Count += int64(count) + return +} diff --git a/vendor/github.com/docker/docker/pkg/longpath/longpath.go b/vendor/github.com/docker/docker/pkg/longpath/longpath.go new file mode 100644 index 00000000..4177affb --- /dev/null +++ b/vendor/github.com/docker/docker/pkg/longpath/longpath.go @@ -0,0 +1,26 @@ +// longpath introduces some constants and helper functions for handling long paths +// in Windows, which are expected to be prepended with `\\?\` and followed by either +// a drive letter, a UNC server\share, or a volume identifier. + +package longpath // import "github.com/docker/docker/pkg/longpath" + +import ( + "strings" +) + +// Prefix is the longpath prefix for Windows file paths. +const Prefix = `\\?\` + +// AddPrefix will add the Windows long path prefix to the path provided if +// it does not already have it. +func AddPrefix(path string) string { + if !strings.HasPrefix(path, Prefix) { + if strings.HasPrefix(path, `\\`) { + // This is a UNC path, so we need to add 'UNC' to the path as well. + path = Prefix + `UNC` + path[1:] + } else { + path = Prefix + path + } + } + return path +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0b46f22f..25d3608b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -14,7 +14,7 @@ github.com/cloudfoundry/jibber_jabber # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/docker/cli v20.10.15+incompatible +# github.com/docker/cli v23.0.10-0.20240125104041-672b1497b973+incompatible ## explicit github.com/docker/cli/cli/config github.com/docker/cli/cli/config/configfile @@ -51,6 +51,8 @@ github.com/docker/docker/api/types/volume github.com/docker/docker/client github.com/docker/docker/errdefs github.com/docker/docker/pkg/homedir +github.com/docker/docker/pkg/ioutils +github.com/docker/docker/pkg/longpath github.com/docker/docker/pkg/stdcopy # github.com/docker/docker-credential-helpers v0.8.0 ## explicit; go 1.19