summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordd <dd@wx.tnyzeq.icu>2024-06-30 17:06:26 +0200
committerdd <dd@wx.tnyzeq.icu>2024-06-30 17:06:26 +0200
commitfbff50d477ace829335b9600a3b611256cf97d70 (patch)
treeb1fa6e26c8ba259a5607508c48c7a4f2d65bcc43
parent62765d042fe1b4a0131b67a6529401e01d0db0e0 (diff)
downloadvyos-jenkins-fbff50d477ace829335b9600a3b611256cf97d70.tar.gz
vyos-jenkins-fbff50d477ace829335b9600a3b611256cf97d70.zip
updated scripts to use proper exit code and stderr for reporting errors
-rwxr-xr-xauto/gpg-script.sh6
-rw-r--r--auto/helper-logic16
-rwxr-xr-xauto/ssh-script.sh6
-rwxr-xr-xauto/uncron-script.sh6
-rwxr-xr-xbuild-iso.sh16
5 files changed, 25 insertions, 25 deletions
diff --git a/auto/gpg-script.sh b/auto/gpg-script.sh
index 2e26668..d3f3c67 100755
--- a/auto/gpg-script.sh
+++ b/auto/gpg-script.sh
@@ -2,9 +2,9 @@
set -e
# Ensure we are jenkins user
-if [ "$EUID" -ne 1006 ]
- then echo "Please run as jenkins"
- exit
+if [ "$EUID" -ne 1006 ]; then
+ >&2 echo "Please run as jenkins"
+ exit 1
fi
if [ -f ~/.gnupg/pubring.kbx ]; then
diff --git a/auto/helper-logic b/auto/helper-logic
index bcd10ef..6fcc1de 100644
--- a/auto/helper-logic
+++ b/auto/helper-logic
@@ -44,8 +44,8 @@ function PrintHeader {
function EnsureRoot {
# Ensure we are root
if [ "$EUID" -ne 0 ]; then
- echo -e "${RED}Please run as root${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}Please run as root${NOCOLOR}"
+ exit 1
fi
}
@@ -63,8 +63,8 @@ function PrintOkIndicator {
}
function PrintErrorIndicator {
- echo -e "$ERROR_INDICATOR $1"
- exit
+ >&2 echo -e "$ERROR_INDICATOR $1"
+ exit 1
}
function PrintJobNotStarted {
@@ -84,7 +84,7 @@ function PrintJobCompleted {
function PrintJobFailed {
tput el
- echo -e "[ ${RED}Failed!${NOCOLOR} ] Package: $1 - Branch: $2"
+ >&2 echo -e "[ ${RED}Failed!${NOCOLOR} ] Package: $1 - Branch: $2"
}
function Run {
@@ -158,7 +158,7 @@ function TestJenkinsConnection {
rm $TOKEN_FILE
fi
- exit
+ exit 1
fi
}
@@ -578,7 +578,7 @@ function CreateMarkerFile {
function EnsureStageIsComplete {
if [ ! -f "/tmp/installer_stage_${1}_completed" ]; then
- echo -e "${RED}Stage ${1} has not been completed - please run that first.${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}Stage ${1} has not been completed - please run that first.${NOCOLOR}"
+ exit 1
fi
}
diff --git a/auto/ssh-script.sh b/auto/ssh-script.sh
index abdf7ae..8f39fb0 100755
--- a/auto/ssh-script.sh
+++ b/auto/ssh-script.sh
@@ -2,9 +2,9 @@
set -e
# Ensure we are jenkins user
-if [ "$EUID" -ne 1006 ]
- then echo "Please run as jenkins"
- exit
+if [ "$EUID" -ne 1006 ]; then
+ >&2 echo "Please run as jenkins"
+ exit 1
fi
if [ -f ~/.ssh/id_ed25519.pub ]; then
diff --git a/auto/uncron-script.sh b/auto/uncron-script.sh
index 3dd1916..a8df081 100755
--- a/auto/uncron-script.sh
+++ b/auto/uncron-script.sh
@@ -2,9 +2,9 @@
set -e
# Ensure we are jenkins user
-if [ "$EUID" -ne 1006 ]
- then echo "Please run as jenkins"
- exit
+if [ "$EUID" -ne 1006 ]; then
+ >&2 echo "Please run as jenkins"
+ exit 1
fi
if [ -d uncron ]; then
diff --git a/build-iso.sh b/build-iso.sh
index c9a4598..dc6fd6e 100755
--- a/build-iso.sh
+++ b/build-iso.sh
@@ -22,8 +22,8 @@ read -p "Please enter your email address: " EMAIL
echo
if ([ "$BRANCH" != "equuleus" ] && [ "$BRANCH" != "sagitta" ]); then
- echo -e "${RED}Invalid branch${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}Invalid branch${NOCOLOR}"
+ exit 1
fi
if [ -d vyos-build ]; then
@@ -166,13 +166,13 @@ elif [ "$BRANCH" == "sagitta" ]; then
BUILD_EXIT_CODE=$?
else
- echo -e "${RED}Invalid branch${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}Invalid branch${NOCOLOR}"
+ exit 1
fi
if [ $BUILD_EXIT_CODE != 0 ]; then
- echo -e "${RED}ISO build failed${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}ISO build failed${NOCOLOR}"
+ exit 1
fi
if [ -f vyos-build/build/live-image-amd64.hybrid.iso ]; then
@@ -182,8 +182,8 @@ if [ -f vyos-build/build/live-image-amd64.hybrid.iso ]; then
echo -e "The file is called: ${GREEN}vyos-${RELEASE_NAME}-iso-amd64.iso${NOCOLOR}".
else
echo
- echo -e "${RED}Failed to locate ISO file.${NOCOLOR}"
- exit
+ >&2 echo -e "${RED}Failed to locate ISO file.${NOCOLOR}"
+ exit 1
fi
if [ -d vyos-build ]; then