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_IMAGE = 'GeradoresWs/api' DOCKER_TAG = "${env.BUILD_ID}" DOCKER_REGISTRY = 'Shini89' //'your-docker-registry.com' // Registro Docker REMOTE_DOCKER_HOST = '192.168.2.20' REMOTE_DOCKER_USER = 'admin' REMOTE_DOCKER_PORT = '2375' REACT_DIR = 'geradoresfe' // Diret�rio do frontend React SERVICE_DIR = 'GeradoresService' // Diret�rio do projeto DLL API_DIR = 'GeradoresWS' // Diret�rio do Web API } stages { 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:
' } } } } } } stage('Checkout Code') { steps { git branch: 'master', url: 'https://git.homeware.pt/Marco/Geradores.git' } } /******************************************************* Stage BUILD *******************************************************/ stage('Build DLL') { steps { dir("${env.SERVICE_DIR}") { sh 'dotnet build -c Release' } } } stage('Build Frontend') { steps { dir("${env.REACT_DIR}") { sh 'npm install' sh 'npm run build' /* echo 'Building Docker image for React...' sh """ docker build -t ${env.DOCKER_REGISTRY}/react-frontend:latest . docker push ${env.DOCKER_REGISTRY}/react-frontend:latest """*/ } } } stage('Build Webservice') { steps { dir("${env.API_DIR}") { echo 'Building Webservice with ASP.NET Core...' sh 'dotnet build -c Release' /*echo 'Building Docker image for Webservice...' sh """ docker build -t ${env.DOCKER_REGISTRY}/webservice:latest . docker push ${env.DOCKER_REGISTRY}/webservice:latest """*/ } } } } }