build-image icon indicating copy to clipboard operation
build-image copied to clipboard

When the build.ignore command or script is not found, log this to the build logs.

Open overlordofmu opened this issue 5 years ago • 0 comments

Description

If you reference a build.ignore which is invalid or doesn't exist the failure is silently ignored and the build continues.

I was testing with a bash script named exit-zero.sh:

#!/bin/bash

exit 0

If I reference this in build.ignore as ./exit-zero.sh the script runs, exits with zero and the build is cancelled:

11:59:22 PM: Canceled build due to no content change
11:59:22 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: './exit-zero.sh'
11:59:22 PM: User-specified ignore command returned exit code 0. Returning early from build.

However, if I don't reference this from the current directory it isn't in the shell's path so cannot be run at all. However, the logging makes it look no different than any other non-zero exit:

12:57:42 AM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'exit-zero.sh'
12:57:42 AM: No build command found, continuing to publishing
12:57:42 AM: Starting to deploy site from '/'

Solution I would like

Ideally, the build would still continue (as this should be the default I believe) but we would log the missing command or script. For example:

12:57:42 AM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'exit-zero.sh'
12:57:42 AM: exit-zero.sh: command not found
12:57:42 AM: No build command found, continuing to publishing
12:57:42 AM: Starting to deploy site from '/'

Other notes

This could be a simple as filtering for "command not found" and logging if that string is in the output for the build.ignore attempt.

Follow-up

Notify here:

https://community.netlify.com/t/custom-build-ignore-script-exit-code-bug/5627/3

overlordofmu avatar Dec 06 '19 09:12 overlordofmu