Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

prepare.sh: use errtrace to trigger trap from function #9

Merged
merged 1 commit into from
May 26, 2021

Conversation

nicki-krizek
Copy link
Contributor

When using -e/-o errexit without the -E/-o errtrace option, trap won't
be triggered if a command fails inside a function. In this case, all
relevant commands are executed inside start_container() and
install_dependencies() functions.

When the error is properly propagated, the trap error handling actually
works and the gitlab runner will attempt to re-try to start-up the
container since it correctly detects that the job failed during the
preparation stage.

See https://stackoverflow.com/a/35800451 for more details about -e -E
interaction

When using -e/-o errexit without the -E/-o errtrace option, trap won't
be triggered if a command fails inside a function. In this case, all
relevant commands are executed inside start_container() and
install_dependencies() functions.

When the error is properly propagated, the trap error handling actually
works and the gitlab runner will attempt to re-try to start-up the
container since it correctly detects that the job failed during the
preparation stage.

See https://stackoverflow.com/a/35800451 for more details about -e -E
interaction
@jonasbb
Copy link
Owner

jonasbb commented May 26, 2021

Thanks, that looks good.

Btw. I really like the openness of CZ NIC like open source contributions or presentations at OARC :)

@jonasbb jonasbb merged commit 2366a4b into jonasbb:master May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants