[RFC,yocto-autobuilder-helper] scripts: run-docs-build: make the script fail hard ASAP when there's an error

Message ID 20220223113106.2781516-1-foss+yocto@0leil.net
State New
Headers show
Series [RFC,yocto-autobuilder-helper] scripts: run-docs-build: make the script fail hard ASAP when there's an error | expand

Commit Message

Quentin Schulz Feb. 23, 2022, 11:31 a.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

There are some intermittent issues with the script not publishing all
versions. So let's go extreme and fail the script if any error happens:
 - a command returns a non-zero code, even if piped,
 - a variable is used uninitialized,

This also makes the script print each and every command being run so we
have a better idea where the script struggles.

Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

RFC:
 - I highly suspect this change to break the building script because
 Sphinx probably throws errors at old doc builds,
 - Also, with Sphinx updates, new warnings might arrise on
 old/unmaintained branches, we probably want to use virtualenv with
 specific Sphinx versions to make sure this is not an issue in the
 future? (and allows to bump Sphinx (or other dependencies) requirement
 for newer doc branches),

 scripts/run-docs-build | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Opdenacker Feb. 23, 2022, 1:05 p.m. UTC | #1
Hi Quentin,

On 2/23/22 12:31, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> There are some intermittent issues with the script not publishing all
> versions. So let's go extreme and fail the script if any error happens:
>  - a command returns a non-zero code, even if piped,
>  - a variable is used uninitialized,
>
> This also makes the script print each and every command being run so we
> have a better idea where the script struggles.
>
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>
> RFC:
>  - I highly suspect this change to break the building script because
>  Sphinx probably throws errors at old doc builds,
>  - Also, with Sphinx updates, new warnings might arrise on
>  old/unmaintained branches, we probably want to use virtualenv with
>  specific Sphinx versions to make sure this is not an issue in the
>  future? (and allows to bump Sphinx (or other dependencies) requirement
>  for newer doc branches),
>
>  scripts/run-docs-build | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/scripts/run-docs-build b/scripts/run-docs-build
> index 3bc35b3..b7b5773 100755
> --- a/scripts/run-docs-build
> +++ b/scripts/run-docs-build
> @@ -2,6 +2,12 @@
>  # Called with $1 as the build directory
>  #             $2 as the path to yocto-docs
>  #             $3 as the path to bitbake
> +
> +set -e
> +set -u
> +set -o pipefail
> +set -x
> +
>  builddir=$1
>  ypdocs=$2/documentation/
>  bbdocs=$3/doc/

Agreeing with the change.
How would we get the script output?

Thanks
Michael.
Michael Opdenacker Feb. 23, 2022, 3:26 p.m. UTC | #2
On 2/23/22 15:52, Quentin Schulz wrote:
>
>> Agreeing with the change.
>> How would we get the script output?
>>
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/114
>
> seems to be a good place to start with?
>
Ah right, thanks. I won't forget it next time.
Michael.

Patch

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 3bc35b3..b7b5773 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -2,6 +2,12 @@ 
 # Called with $1 as the build directory
 #             $2 as the path to yocto-docs
 #             $3 as the path to bitbake
+
+set -e
+set -u
+set -o pipefail
+set -x
+
 builddir=$1
 ypdocs=$2/documentation/
 bbdocs=$3/doc/