Skip to content

Comments

Implement scan timeout and soft fail configuration#73

Open
fabiano-amaral wants to merge 2 commits intoPaloAltoNetworks:mainfrom
fabiano-amaral:main
Open

Implement scan timeout and soft fail configuration#73
fabiano-amaral wants to merge 2 commits intoPaloAltoNetworks:mainfrom
fabiano-amaral:main

Conversation

@fabiano-amaral
Copy link

Description

This PR introduces timeout management for the Prisma Cloud Scan action. It adds two new optional inputs:

  • timeout: Specifies the maximum execution time for the scan in seconds.
  • on_timeout: Determines the action behavior when a timeout occurs. Accepts fail (default) or success.
    The implementation uses Promise.race to enforce the time limit on the twistcli execution. If on_timeout is set to success, the action will log a warning and exit gracefully without generating result files, ensuring the pipeline continues even if the scan takes too long.

##Motivation and Context

In some CI/CD environments, scan operations might hang or take unexpectedly long, causing pipelines to stall. This change allows users to:

  1. Enforce a hard time limit to prevent stuck builds.
  2. Choose between a strict failure (blocking the pipeline) or a soft failure (warning only) when that limit is reached.
    How Has This Been Tested?
  • Updated the codebase and successfully ran npm run build to generate the distribution file.
  • Verified that the new inputs are correctly defined in action.yml.
  • Verified that the logic correctly races the scan process against the defined timeout duration.

Screenshots (if appropriate)

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@fabiano-amaral
Copy link
Author

Hey @sgordon46 , Could you review this pull request? I couldn’t find a clear contribution guide in the repository, but if there’s any adjustment that needs to be made, just let me know and I’ll take care of it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant