diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy new file mode 100644 index 00000000..1c180ff2 --- /dev/null +++ b/Jenkinsfile.groovy @@ -0,0 +1,59 @@ +pipeline { + agent { + label 'master' + } + + options { + buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10')) + disableConcurrentBuilds() + } + + environment { + // ANDROID_HOME = "/usr/local/android/sdk" // Cambia in base al tuo sistema + JAVA_HOME = tool 'JDK 17.0.6 x64' // Nome dello strumento configurato in Jenkins + PATH = "${env.JAVA_HOME}/bin:${env.PATH}" + } + + stages { + + stage('Build') { + steps { + bat "./gradlew assembleRelease" + archiveArtifacts artifacts: 'app/build/outputs/apk/release/', onlyIfSuccessful: true + } + } + + stage('Publish') { + steps { + azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms' + } + } + } + + post { + success { + script { + bat "curl -k https://devservices.studioml.it/ems-api/updateWMSApp" + bat "curl -k https://services.studioml.it/ems-api/updateWMSApp" + if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") { + office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE' + } + } + } + unstable { + script { + if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") { + office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE' + } + } + } + failure { + script { + if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") { + office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su WMS', status: 'FAILURE', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE' + } + } + } + } + +} \ No newline at end of file