Add preflight checks in Jenkinsfile to ensure Docker is installed on the agent before proceeding with the pipeline, improving error handling and setup validation.

This commit is contained in:
2026-03-31 18:27:41 -05:00
parent c45f97d480
commit 943c248750

19
Jenkinsfile vendored
View File

@@ -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([