From da1b6aaed844a7d4fc94530129945257c660a2b7 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 6 Dec 2024 23:46:36 -0500 Subject: [PATCH] fail-early guards --- scripts/1clickservice.groovy | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/1clickservice.groovy b/scripts/1clickservice.groovy index fa9c367..3ee9ab4 100644 --- a/scripts/1clickservice.groovy +++ b/scripts/1clickservice.groovy @@ -26,6 +26,27 @@ pipeline { error("servicename cannot have spaces. try dashes.") } + + sh """#!/bin/bash + function testcmd(){ + if ! command -v \$1 2>&1 >/dev/null + then + echo "this agent doesn't have \$1" + exit 1 + fi + } + + testcmd mktemp + testcmd curl + testcmd git + testcmd sed + testcmd ssh + testcmd ssh-keyscan + testcmd ssh-keygen + testcmd scp + testcmd jq + """ + switch (targetHost) { case "alloces.lan": SUDOER_USR = SUDOER_ALLOCES_USR