summaryrefslogtreecommitdiff
path: root/auto
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 /auto
parent62765d042fe1b4a0131b67a6529401e01d0db0e0 (diff)
downloadvyos-jenkins-fbff50d477ace829335b9600a3b611256cf97d70.tar.gz
vyos-jenkins-fbff50d477ace829335b9600a3b611256cf97d70.zip
updated scripts to use proper exit code and stderr for reporting errors
Diffstat (limited to 'auto')
-rwxr-xr-xauto/gpg-script.sh6
-rw-r--r--auto/helper-logic16
-rwxr-xr-xauto/ssh-script.sh6
-rwxr-xr-xauto/uncron-script.sh6
4 files changed, 17 insertions, 17 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