Collect SAST analyzer container logs even if it has timed out

Summary

Currently, when analyzer container hangs (like in SAST job is timing out), container logs are not copied to the Stderr of the running SAST process (likely because of the connection timeout while trying to get logs). Such logs can still be useful for debugging of similar analyzer hanging issues.

Improvements

The extended handling of context.DeadlineExceeded when running an analyzer container: try stopping the analyzer container before getting the logs.

Risks

An unhandled failure when stopping an analyzer container will cause the entire orchestrator to fail. We need to handle the situation when stopping container results in an error, log that error and just return afterward (don't try collecting the analyzer logs). Also, unit tests should be added to cover such a case.

Involved components

  • analyzer.go
Edited Jun 05, 2019 by Victor Zagorodny
Assignee Loading
Time tracking Loading