Skip to content

Conversation

jeniii
Copy link
Collaborator

@jeniii jeniii commented Aug 7, 2025

This pull request updates the Docker image inspection and logging logic to be more robust against errors, and modifies a test resource configuration. The main improvements are better error handling when inspecting Docker images, safer logging of image details, and a test update to use a different image.

Docker image inspection and error handling:

  • The inspectDockerImage function now returns an object with optional digest and version fields instead of always requiring them, allowing for cases where inspection fails.
  • If inspecting a Docker image fails, the function logs a warning with the error message and returns an empty object, instead of throwing an error.

Image version logging:

  • The logImageVersion function now checks for both digest and version before logging; if either is missing, it logs a warning instead of info.

Test configuration update:

  • The test configuration file test_config_file_src_only.json now uses the gerrit image instead of farosai/airbyte-example-source.

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 16:08
Copy link

github-actions bot commented Aug 7, 2025

⚠️ Version Update Reminder

If this PR introduces new features, bug fixes, or breaking changes in the NodeJs CLI, please consider updating the version number by running npm run bump patch in folder airbyte-local-cli-nodejs to bump up patch version.

This is an automated reminder. If no version update is needed, you can safely ignore this comment.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the Docker image inspection functionality to handle cases where Docker images may be missing standard labels or metadata. The changes prevent failures when Docker image inspection cannot retrieve version or digest information.

  • Modified inspectDockerImage to return optional digest and version fields instead of throwing errors
  • Updated logImageVersion to handle cases where image metadata is unavailable
  • Changed error handling from throwing exceptions to logging warnings when image inspection fails

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
airbyte-local-cli-nodejs/src/docker.ts Modified inspectDockerImage to return optional fields and handle errors gracefully
airbyte-local-cli-nodejs/src/utils.ts Updated logImageVersion to check for optional metadata before logging
airbyte-local-cli-nodejs/test/resources/test_config_file_src_only.json Changed test image from "farosai/airbyte-example-source" to "gerrit"

logger.error(`Failed to inspect docker image: ${image}`);
throw error;
logger.warn(`Failed to inspect docker image '${image}': ${error.message ?? JSON.stringify(error)}`);
return {};
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an empty object {} doesn't match the declared return type {digest?: string; version?: string}. Consider returning {digest: undefined, version: undefined} to be explicit about the optional fields.

Suggested change
return {};
return {digest: undefined, version: undefined};

Copilot uses AI. Check for mistakes.

Copy link

sonarqubecloud bot commented Aug 7, 2025

@jeniii jeniii merged commit 34952ab into main Aug 7, 2025
8 checks passed
@jeniii jeniii deleted the jg/image-inspect-warn branch August 7, 2025 16:19
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants