Skip to content

Commit cf638b4

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 d4baa32 commit cf638b4

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
@@ -129,6 +129,7 @@ task:
129129
130130
configure_script: |
131131
su postgres <<-EOF
132+
set -e
132133
meson setup \
133134
--buildtype=debug \
134135
--auto-features=disabled \
@@ -137,6 +138,7 @@ task:
137138
EOF
138139
build_script: |
139140
su postgres <<-EOF
141+
set -e
140142
ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
141143
EOF
142144
upload_caches: ccache
@@ -146,6 +148,7 @@ task:
146148
# tap test that exercises both a frontend binary and the backend.
147149
test_minimal_script: |
148150
su postgres <<-EOF
151+
set -e
149152
ulimit -c unlimited
150153
meson test $MTEST_ARGS --suite setup
151154
meson test $MTEST_ARGS --num-processes ${TEST_JOBS} \
@@ -229,6 +232,7 @@ task:
229232
# already takes longer than other platforms except for windows.
230233
configure_script: |
231234
su postgres <<-EOF
235+
set -e
232236
meson setup \
233237
${MESON_COMMON_PG_CONFIG_ARGS} \
234238
--buildtype=debug \
@@ -241,6 +245,7 @@ task:
241245

242246
test_world_script: |
243247
su postgres <<-EOF
248+
set -e
244249
ulimit -c unlimited
245250
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
246251
EOF
@@ -265,6 +270,7 @@ task:
265270
# during upload, as it doesn't expect artifacts to change size
266271
stop_running_script: |
267272
su postgres <<-EOF
273+
set -e
268274
build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true
269275
EOF
270276
<<: *on_failure_meson
@@ -361,6 +367,7 @@ task:
361367
# And other uuid options are not available on NetBSD.
362368
configure_script: |
363369
su postgres <<-EOF
370+
set -e
364371
meson setup \
365372
${MESON_COMMON_PG_CONFIG_ARGS} \
366373
--buildtype=debugoptimized \
@@ -374,6 +381,7 @@ task:
374381

375382
test_world_script: |
376383
su postgres <<-EOF
384+
set -e
377385
ulimit -c unlimited
378386
# Otherwise tests will fail on OpenBSD, due to inability to start enough
379387
# processes.
@@ -509,6 +517,7 @@ task:
509517
# that.
510518
configure_script: |
511519
su postgres <<-EOF
520+
set -e
512521
./configure \
513522
--enable-cassert --enable-injection-points --enable-debug \
514523
--enable-tap-tests --enable-nls \
@@ -525,6 +534,7 @@ task:
525534

526535
test_world_script: |
527536
su postgres <<-EOF
537+
set -e
528538
ulimit -c unlimited # default is 0
529539
make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
530540
EOF
@@ -548,6 +558,7 @@ task:
548558
549559
configure_script: |
550560
su postgres <<-EOF
561+
set -e
551562
meson setup \
552563
${MESON_COMMON_PG_CONFIG_ARGS} \
553564
--buildtype=debug \
@@ -559,6 +570,7 @@ task:
559570
# locally.
560571
configure_32_script: |
561572
su postgres <<-EOF
573+
set -e
562574
export CC='ccache gcc -m32'
563575
meson setup \
564576
${MESON_COMMON_PG_CONFIG_ARGS} \
@@ -571,12 +583,14 @@ task:
571583
572584
build_script: |
573585
su postgres <<-EOF
586+
set -e
574587
ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
575588
ninja -C build -t missingdeps
576589
EOF
577590
578591
build_32_script: |
579592
su postgres <<-EOF
593+
set -e
580594
ninja -C build-32 -j${BUILD_JOBS} ${MBUILD_TARGET}
581595
ninja -C build -t missingdeps
582596
EOF
@@ -585,6 +599,7 @@ task:
585599

586600
test_world_script: |
587601
su postgres <<-EOF
602+
set -e
588603
ulimit -c unlimited
589604
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
590605
EOF
@@ -597,6 +612,7 @@ task:
597612
# from C, prevent that with PYTHONCOERCECLOCALE.
598613
test_world_32_script: |
599614
su postgres <<-EOF
615+
set -e
600616
ulimit -c unlimited
601617
PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS}
602618
EOF

0 commit comments

Comments
 (0)