Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successfully exit upon path not existing #2

Conversation

minupalaniappan
Copy link

Love this tool; my hunch is that we can gracefully exit upon finding out that a path does not exist.

@@ -32,7 +32,7 @@ if [ ! -d "$INPUT_REPOSITORY_PATH" ]
then
echo "🐛 The given path is not a directory: ${INPUT_REPOSITORY_PATH}"
echo "🧰 To resolve this issue, set the 'repository-path' parameter to the directory that contains the local git clone of your repository."
exit 1
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

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

If the workflow instructs the action to look for the repository at a specific path using the repository-path input, and there is no directory at that location, that's almost certainly an error that the user would want to know about. I think we should continue to exit with a nonzero exit code here.

exit 1
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm understanding the motivation correctly, you're hoping to gracefully handle the scenario where someone specifies multiple paths and some of those paths don't exist (as seen here).

But, there's no official support for specifying multiple paths. The path input is expected to contain exactly one path:

### `path`
**Required** The path to the XML file(s) for the test results. Can be a directory (e.g., `test/reports`), a single file (e.g., `reports/junit.xml`), or a glob (e.g., `app/*/results/*.xml`).

As seen in the error message in this build, the action terminated after discovering that the first path was nonexistent. It sounds like the user wants the action to continue on to process the remaining paths. If that is indeed the case, then changing the exit code here won't satisfy that goal. Instead, we'd need to enhance this action to explicitly support multiple paths.

To do that, we have a few options:

  • Option 1: Iterate over the list of paths specified in the path input. For each path that exists on disk, invoke the buildpulse-test-reporter CLI with that path.
  • Option 2: Copy all of the paths into a new shared location (e.g., /tmp/buildpulse-uploadables) and then invoke the buildpulse-test-reporter CLI with that single path.
  • Option 3: Enhance the buildpulse-test-reporter to accept a list of paths instead of a single path.

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

Successfully merging this pull request may close these issues.

2 participants