pipeline { agent any stages { stage('Verificar conectividade') { steps { script { def sites = [ 'google.com.br', 'nasa.gov', 'github.com' ] def hasFailed = false for (site in sites) { def result = sh(returnStdout: true, script: "nc -zv $site 443") def status = result.contains('failed') ? 'Offline' : 'Online' echo "O site $site está $status" if (status == 'Offline') { hasFailed = true } } if (hasFailed) { error("Algum teste falhou. A pipeline será marcada como failed.") } } } } } }