From 943c24875050d0a5d9eb0f8224ae19d8f08c9773 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Tue, 31 Mar 2026 18:27:41 -0500 Subject: [PATCH] Add preflight checks in Jenkinsfile to ensure Docker is installed on the agent before proceeding with the pipeline, improving error handling and setup validation. --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 289fb47c..7a85b081 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ pipeline { - agent any + agent { + label 'any' + } options { timestamps() @@ -17,6 +19,21 @@ pipeline { } stages { + stage('Preflight tools') { + steps { + sh ''' + set -euo pipefail + echo "Node: $(hostname)" + if ! command -v docker >/dev/null 2>&1; then + echo "ERROR: este agente no tiene docker instalado." + echo "Usa un nodo Jenkins con label 'docker' y acceso al daemon." + exit 1 + fi + docker --version + ''' + } + } + stage('Checkout') { steps { checkout([