Skip to content

Exiting PDF install script with error code if commands fail #1148

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jesuino
Copy link
Contributor

@jesuino jesuino commented Jun 5, 2025

Description

This forces the script to exit with error if some of the commands fail. closes #1147

How Has This Been Tested?

Tested locally making sure that the image is not built when the script fails

@openshift-ci openshift-ci bot requested review from harshad16 and paulovmr June 5, 2025 18:57
@openshift-ci openshift-ci bot added the size/xs label Jun 5, 2025
Copy link
Member

@jiridanek jiridanek left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -2,6 +2,8 @@

# Install dependencies required for Notebooks PDF exports

set -e
Copy link
Member

Choose a reason for hiding this comment

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

Yep, that's how this is normally done

https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/

There are some piped commands below, so also consider

set -o pipefail

The bash shell normally only looks at the exit code of the last command of a pipeline. This behavior is not ideal as it causes the -e option to only be able to act on the exit code of a pipeline’s last command. This is where -o pipefail comes in.

For better build log, I also suggest set -x

@jstourac
Copy link
Member

jstourac commented Jun 6, 2025

/lgtm

@jiridanek
Copy link
Member

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm label Jun 6, 2025
Copy link
Contributor

openshift-ci bot commented Jun 6, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiridanek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUN ./utils/install_pdf_deps.sh step exited with ecode 0 without actually installing xelatex
3 participants