Skip to content

Handle docker image removal failures gracefully in clp-package build script #1370

@coderabbitai

Description

@coderabbitai

Problem

In tools/docker-images/clp-package/build.sh, the remove_temp_file_and_prev_image function (called via EXIT trap) attempts to remove the previous image using docker image remove. This can fail with a non-zero exit code if a running container is still referencing the image.

Since the script uses set -eu, this failure causes the script to exit with an error code, which in turn causes subsequent commands in the caller (docker-images.yaml taskfile) to fail execution (e.g., copying the unique image ID file into build/clp-package).

Proposed Solutions

Either:

  1. Exit gracefully (with exit code 0) and print a warning message when image removal fails, or
  2. Have the caller (taskfile) gracefully handle the non-zero exit code

Context

Reported by @junhaoliao in PR #1335:
#1335 (comment)

Affected Files

  • tools/docker-images/clp-package/build.sh
  • docker-images.yaml (taskfile caller)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions