jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/367886 )
Change subject: Make CI scripts more stricts
......................................................................
Make CI scripts more stricts
Set in bash:
-e Exit immediately if a command exits with a non-zero status.
-u Treat unset variables as an error when substituting.
-e would cause the script to abort immediately whenever a command fail
which is quite useful.
-u is the same, but for unset variables. Adjust ci-settings.sh to
provide a default value to BUILD_TAG which can be unset.
Bug: T171724
Change-Id: I0b0ce689fd22c3765accc16b91a04297d68f5e46
---
M bin/ci-create-dbs.sh
M bin/ci-drop-dbs.sh
M bin/ci-populate-dbs.sh
M bin/ci-settings.sh
M bin/drupal-install.sh
5 files changed, 6 insertions(+), 6 deletions(-)
Approvals:
jenkins-bot: Verified
Ejegg: Looks good to me, approved
diff --git a/bin/ci-create-dbs.sh b/bin/ci-create-dbs.sh
index 924ee43..1ed07ca 100755
--- a/bin/ci-create-dbs.sh
+++ b/bin/ci-create-dbs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -eu
BASEDIR=$(dirname $0)
. $BASEDIR/ci-settings.sh
diff --git a/bin/ci-drop-dbs.sh b/bin/ci-drop-dbs.sh
index ad1966b..4925a9c 100755
--- a/bin/ci-drop-dbs.sh
+++ b/bin/ci-drop-dbs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -eu
BASEDIR=$(dirname $0)
. $BASEDIR/ci-settings.sh
diff --git a/bin/ci-populate-dbs.sh b/bin/ci-populate-dbs.sh
index 9e37dd0..ea31286 100755
--- a/bin/ci-populate-dbs.sh
+++ b/bin/ci-populate-dbs.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -eu
BASEDIR=$(dirname $0)
. $BASEDIR/ci-settings.sh
diff --git a/bin/ci-settings.sh b/bin/ci-settings.sh
index d8df87d..41f5e2d 100644
--- a/bin/ci-settings.sh
+++ b/bin/ci-settings.sh
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/bin/bash -eu
-if [ -z "$BUILD_TAG" ]; then
+if [ -z "${BUILD_TAG:-}" ]; then
echo "BUILD_TAG environment variable was not set, exiting."
exit 1
fi
diff --git a/bin/drupal-install.sh b/bin/drupal-install.sh
index 1d5bd7d..ea4ff27 100755
--- a/bin/drupal-install.sh
+++ b/bin/drupal-install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -eu
if [ $# -ne 3 ]; then
app_name=`basename $0`
--
To view, visit https://gerrit.wikimedia.org/r/367886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b0ce689fd22c3765accc16b91a04297d68f5e46
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Jgreen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits