Skip to content

Commit ae23810

Browse files
committed
ci: Add missing "set -e" to scripts run by su.
If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted to use #error during compilation, leading to the diagnosis of this problem. Reviewed-by: Tristan Partin <tristan@partin.io> (earlier version) Discussion: https://postgr.es/m/DDZP25P4VZ48.3LWMZBGA1K9RH%40partin.io Backpatch-through: 15
1 parent 6d8acb7 commit ae23810

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.cirrus.tasks.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ task:
104104
105105
configure_script: |
106106
su postgres <<-EOF
107+
set -e
107108
meson setup \
108109
--buildtype=debug \
109110
--auto-features=disabled \
@@ -112,6 +113,7 @@ task:
112113
EOF
113114
build_script: |
114115
su postgres <<-EOF
116+
set -e
115117
ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
116118
EOF
117119
upload_caches: ccache
@@ -121,6 +123,7 @@ task:
121123
# tap test that exercises both a frontend binary and the backend.
122124
test_minimal_script: |
123125
su postgres <<-EOF
126+
set -e
124127
ulimit -c unlimited
125128
meson test $MTEST_ARGS --suite setup
126129
meson test $MTEST_ARGS --num-processes ${TEST_JOBS} \
@@ -195,6 +198,7 @@ task:
195198
# already takes longer than other platforms except for windows.
196199
configure_script: |
197200
su postgres <<-EOF
201+
set -e
198202
meson setup \
199203
--buildtype=debug \
200204
-Dcassert=true -Dinjection_points=true \
@@ -207,6 +211,7 @@ task:
207211

208212
test_world_script: |
209213
su postgres <<-EOF
214+
set -e
210215
ulimit -c unlimited
211216
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
212217
EOF
@@ -231,6 +236,7 @@ task:
231236
# during upload, as it doesn't expect artifacts to change size
232237
stop_running_script: |
233238
su postgres <<-EOF
239+
set -e
234240
build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true
235241
EOF
236242
<<: *on_failure_meson
@@ -316,6 +322,7 @@ task:
316322
# And other uuid options are not available on NetBSD.
317323
configure_script: |
318324
su postgres <<-EOF
325+
set -e
319326
meson setup \
320327
--buildtype=debugoptimized \
321328
--pkg-config-path ${PKGCONFIG_PATH} \
@@ -330,6 +337,7 @@ task:
330337

331338
test_world_script: |
332339
su postgres <<-EOF
340+
set -e
333341
ulimit -c unlimited
334342
# Otherwise tests will fail on OpenBSD, due to inability to start enough
335343
# processes.
@@ -468,6 +476,7 @@ task:
468476
# that.
469477
configure_script: |
470478
su postgres <<-EOF
479+
set -e
471480
./configure \
472481
--enable-cassert --enable-injection-points --enable-debug \
473482
--enable-tap-tests --enable-nls \
@@ -484,6 +493,7 @@ task:
484493

485494
test_world_script: |
486495
su postgres <<-EOF
496+
set -e
487497
ulimit -c unlimited # default is 0
488498
make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
489499
EOF
@@ -506,6 +516,7 @@ task:
506516
507517
configure_script: |
508518
su postgres <<-EOF
519+
set -e
509520
meson setup \
510521
--buildtype=debug \
511522
-Dcassert=true -Dinjection_points=true \
@@ -517,6 +528,7 @@ task:
517528
# locally.
518529
configure_32_script: |
519530
su postgres <<-EOF
531+
set -e
520532
export CC='ccache gcc -m32'
521533
meson setup \
522534
--buildtype=debug \
@@ -531,12 +543,14 @@ task:
531543
532544
build_script: |
533545
su postgres <<-EOF
546+
set -e
534547
ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
535548
ninja -C build -t missingdeps
536549
EOF
537550
538551
build_32_script: |
539552
su postgres <<-EOF
553+
set -e
540554
ninja -C build-32 -j${BUILD_JOBS} ${MBUILD_TARGET}
541555
ninja -C build -t missingdeps
542556
EOF
@@ -545,6 +559,7 @@ task:
545559

546560
test_world_script: |
547561
su postgres <<-EOF
562+
set -e
548563
ulimit -c unlimited
549564
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
550565
EOF
@@ -557,6 +572,7 @@ task:
557572
# from C, prevent that with PYTHONCOERCECLOCALE.
558573
test_world_32_script: |
559574
su postgres <<-EOF
575+
set -e
560576
ulimit -c unlimited
561577
PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS}
562578
EOF

0 commit comments

Comments
 (0)