Skip to content

Conversation

Mpdreamz
Copy link
Member

No description provided.

@Mpdreamz Mpdreamz requested a review from a team as a code owner September 30, 2025 07:24
@Mpdreamz Mpdreamz requested a review from reakaleek September 30, 2025 07:24
@Mpdreamz Mpdreamz added the fix label Sep 30, 2025
@Mpdreamz Mpdreamz self-assigned this Sep 30, 2025
@Mpdreamz Mpdreamz requested a review from Copilot September 30, 2025 07:25
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

This PR adds comprehensive logging and timeout handling to CLI invocations in the documentation system, particularly for CI environments. The changes are designed to improve observability and prevent hanging processes during automated builds.

Key changes:

  • Added timeout configuration for external command execution in CI environments (10 minutes)
  • Enhanced logging throughout CLI operations with structured logging patterns
  • Refactored command execution methods to consolidate duplicate logic and improve error handling

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ExternalCommandExecutor.cs Core refactoring of command execution with timeout support, enhanced logging, and consolidated capture methods
GitFacade.cs Added logging factory and CI timeout configuration to git operations
RepositorySourcesFetcher.cs Updated git repository instantiation to include logging factory parameter
AwsCloudFrontKeyValueStoreProxy.cs Migrated from private logger to inherited Logger property and updated method signature
LocalGitRepositoryTracker.cs Added logging factory support and updated to use CaptureQuiet method
LocalChangesService.cs Updated constructor call to include logging factory parameter
Comments suppressed due to low confidence (1)

src/Elastic.Documentation/ExternalCommands/ExternalCommandExecutor.cs:1

  • The method signature changed from CaptureMultiple(false, 1, ...) to CaptureMultiple(1, ...), but the new overload defaults to muteExceptions = false. This maintains the same behavior, but the change appears to remove the explicit muteExceptions parameter that was previously set to false.
// Licensed to Elasticsearch B.V under one or more agreements.

Comment on lines 28 to 33
var arguments = new ExecArguments(binary, args)
{
WorkingDirectory = workingDirectory.FullName,
Environment = environmentVars
Environment = environmentVars,
Timeout = timeout
};
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

The timeout is only applied when environmentVars is provided, but not in the regular Exec methods without environment variables. This creates inconsistent timeout behavior across different execution paths.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is false timeout is always provided for ExecIn*

Comment on lines 82 to 86
var arguments = new StartArguments(binary, args)
{
WorkingDirectory = workingDirectory.FullName,
Timeout = TimeSpan.FromSeconds(3),
WaitForExit = TimeSpan.FromSeconds(3),
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

The hardcoded 3-second timeout in CaptureOutput conflicts with the configurable timeout parameter. Consider using the configurable timeout or a derived value to maintain consistency.

Suggested change
var arguments = new StartArguments(binary, args)
{
WorkingDirectory = workingDirectory.FullName,
Timeout = TimeSpan.FromSeconds(3),
WaitForExit = TimeSpan.FromSeconds(3),
var effectiveTimeout = timeout ?? TimeSpan.FromSeconds(3);
var arguments = new StartArguments(binary, args)
{
WorkingDirectory = workingDirectory.FullName,
Timeout = effectiveTimeout,
WaitForExit = effectiveTimeout,

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is by design, capturing is retried and is expected to run quickly.

@Mpdreamz Mpdreamz merged commit bec75ee into main Sep 30, 2025
20 checks passed
@Mpdreamz Mpdreamz deleted the fix/up-logging-of-cli-invocations branch September 30, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants