Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply pullTimeout for k3s:image to allow long running imports. #245

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/io/kokuwa/maven/k3s/mojo/ImageMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private boolean tar(Map<String, Map<String, ?>> existingImages, Path tarFile) {
var outputPattern = Pattern.compile("^unpacking (?<image>.*) \\(sha256:[0-9a-f]{64}\\).*$");

getDocker().copyToContainer(tarFile, destination);
for (var output : getDocker().exec("ctr", "image", "import", destination.toString())) {
for (var output : getDocker().exec(pullTimeout, "ctr", "image", "import", destination.toString())) {
var matcher = outputPattern.matcher(output);
if (matcher.matches()) {
getDocker().exec("ctr", "image", "label", matcher.group("image"), labelPath + "=" + tarFile);
Expand Down Expand Up @@ -234,7 +234,7 @@ private boolean docker(Map<String, Map<String, ?>> existingImages, String image)
try {
getDocker().saveImage(image, source);
getDocker().copyToContainer(source, destination);
getDocker().exec("ctr", "image", "import", destination.toString());
getDocker().exec(pullTimeout, "ctr", "image", "import", destination.toString());
getDocker().exec("ctr", "image", "label", normalizedImage, label + "=" + digest);
} catch (MojoExecutionException e) {
getLog().error("Failed to import tar " + source, e);
Expand Down