pipeline {
agent any
parameters {
booleanParam(name: 'DeployAll', defaultValue: false, description: 'Deploy Site/WS ?')
booleanParam(name: 'deploySite', defaultValue: false, description: 'Deploy Site ?')
}
triggers {
pollSCM('* * * * *')
}
/*
environment {
now = new Date().format('yyyyMMdd-HHmm', TimeZone.getTimeZone('UTC'))
DOCKER_HOST = 'tcp://192.168.2.20:2375'
DOCKER_TAG = "${env.BUILD_ID}"
DOCKER_REGISTRY = 'Shini89' //'your-docker-registry.com' // Registro Docker
REACT_DIR = 'geradoresfe'
REACT_DOCKER_IMAGE = 'shini89/geradoresfe:lastest'
SERVICE_DIR = 'GeradoresService'
API_DIR = 'GeradoresWS'
API_DOCKER_IMAGE = 'shini89/geradoresws:lastest'
}
*/
environment {
DOCKER_HOST = 'tcp://192.168.2.20:2375'
DOCKER_REGISTRY = 'docker.io/shini89'
DOCKER_TAG = "${env.BUILD_ID}" // Tag única para builds
REACT_DIR = 'geradoresfe'
SERVICE_DIR = 'GeradoresService'
API_DIR = 'GeradoresWS'
}
stages {
stage('Validate Docker Connection') {
steps {
script {
echo "Validando conexão com Docker remoto: ${DOCKER_HOST}"
// Testa a conexão com o Docker remoto
sh 'docker --version'
}
}
}
stage('Check for Changes') {
steps {
script {
CodeChanges = currentBuild.changeSets != []
if (CodeChanges) {
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
message = message + "
Autor: ${entry.author.fullName} ( ${entry.author} )
Commit: ${entry.msg}"
def files = new ArrayList(entry.affectedFiles)
message = message + '
Ficheiros: