From baa7ff7a9d6b5b3a6134e93b2f9016158eccbc82 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Priotto Date: Thu, 27 Apr 2023 21:56:57 -0300 Subject: [PATCH 1/3] =?UTF-8?q?ajuste=20de=20vari=C3=A1veis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1906153..05c1f2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,20 @@ pipeline { } } } + + stage('Envs') { + when { anyOf { branch 'master'; branch 'develop'; branch 'release'; } } + steps { + script { + withCredentials([file(credentialsId: "plateia-app_env_${branchname}", variable: 'env')]) { + sh 'if [ -d "env" ]; then rm -f env; fi' + sh 'cp ${env} env' + sh 'chmod a+r+x env && . $(realpath env)' + sh 'if [ -d "env" ]; then rm -f env; fi' + } + } + } + } stage('Build APK Dev') { when { From 906cf89571a579fe8bb5d763a8a2c3ee21c47e68 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Priotto Date: Thu, 27 Apr 2023 22:03:41 -0300 Subject: [PATCH 2/3] Update Jenkinsfile debug --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 05c1f2b..c4bcd94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,6 +55,7 @@ pipeline { file(credentialsId: 'plateia-app_key-properties', variable: 'APPKEYPROPERTIES'), file(credentialsId: 'plateia-app_firebase_options_development', variable: 'FIREBASEDEV'), file(credentialsId: 'plateia-app_upload-keystore-jks', variable: 'APPKEYUPLOAD'), + file(credentialsId: "plateia-app_env_${branchname}", variable: 'env'), ]) { sh 'cd ${WORKSPACE}' sh 'cp ${GOOGLEJSONDEV} android/app/src/development/google-services.json' @@ -62,6 +63,13 @@ pipeline { sh 'cp ${FIREBASEDEV} lib/app/firebase/firebase_options_development.dart ' sh 'cp ${APPKEYPROPERTIES} android/key.properties' sh 'cp ${APPKEYUPLOAD} android/app/upload-keystore.jks' + sh 'if [ -d "env" ]; then rm -f env; fi' + sh 'cp ${env} env' + sh 'chmod a+r+x env && . $(realpath env)' + sh 'if [ -d "env" ]; then rm -f env; fi' + sh 'echo ################' + sh 'env' + sh 'echo ################' sh 'flutter clean' sh 'flutter pub get' sh 'flutter packages pub run build_runner build --delete-conflicting-outputs' From 2d784661d55241ad4906b64a4a95525c701f6ad8 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Priotto Date: Thu, 27 Apr 2023 22:32:46 -0300 Subject: [PATCH 3/3] Update Jenkinsfile --- Jenkinsfile | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4bcd94..330430f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,20 +29,6 @@ pipeline { } } - stage('Envs') { - when { anyOf { branch 'master'; branch 'develop'; branch 'release'; } } - steps { - script { - withCredentials([file(credentialsId: "plateia-app_env_${branchname}", variable: 'env')]) { - sh 'if [ -d "env" ]; then rm -f env; fi' - sh 'cp ${env} env' - sh 'chmod a+r+x env && . $(realpath env)' - sh 'if [ -d "env" ]; then rm -f env; fi' - } - } - } - } - stage('Build APK Dev') { when { anyOf { @@ -63,18 +49,14 @@ pipeline { sh 'cp ${FIREBASEDEV} lib/app/firebase/firebase_options_development.dart ' sh 'cp ${APPKEYPROPERTIES} android/key.properties' sh 'cp ${APPKEYUPLOAD} android/app/upload-keystore.jks' - sh 'if [ -d "env" ]; then rm -f env; fi' - sh 'cp ${env} env' - sh 'chmod a+r+x env && . $(realpath env)' - sh 'if [ -d "env" ]; then rm -f env; fi' - sh 'echo ################' - sh 'env' - sh 'echo ################' + sh 'if [ -d ".env" ]; then rm -f .env; fi' + sh 'cp ${env} .env' sh 'flutter clean' sh 'flutter pub get' sh 'flutter packages pub run build_runner build --delete-conflicting-outputs' sh "flutter build apk --build-name=${APP_VERSION} --build-number=${BUILD_NUMBER} --release --flavor=development --target lib/main_development.dart --no-tree-shake-icons" sh "ls -ltra build/app/outputs/flutter-apk/" + sh 'if [ -d ".env" ]; then rm -f .env; fi' stash includes: 'build/app/outputs/flutter-apk/**/*.apk', name: 'appbuild' } } @@ -92,6 +74,7 @@ pipeline { file(credentialsId: 'plateia-app_key-properties', variable: 'APPKEYPROPERTIES'), file(credentialsId: 'plateia-app_firebase_options_staging', variable: 'FIREBASEHOM'), file(credentialsId: 'plateia-app_upload-keystore-jks', variable: 'APPKEYUPLOAD'), + file(credentialsId: "plateia-app_env_${branchname}", variable: 'env'), ]) { sh 'cd ${WORKSPACE}' sh 'cp ${GOOGLEJSONHOM} android/app/src/staging/google-services.json' @@ -99,11 +82,14 @@ pipeline { sh 'cp ${FIREBASEHOM} lib/app/firebase/firebase_options_staging.dart ' sh 'cp ${APPKEYPROPERTIES} android/key.properties' sh 'cp ${APPKEYUPLOAD} android/app/upload-keystore.jks' + sh 'if [ -d ".env" ]; then rm -f .env; fi' + sh 'cp ${env} .env' sh 'flutter clean' sh 'flutter pub get' sh 'flutter packages pub run build_runner build --delete-conflicting-outputs' sh "flutter build apk --build-name=${APP_VERSION} --build-number=${BUILD_NUMBER} --release --flavor=staging --target lib/main_staging.dart --no-tree-shake-icons" sh "ls -ltra build/app/outputs/flutter-apk/" + sh 'if [ -d ".env" ]; then rm -f .env; fi' stash includes: 'build/app/outputs/flutter-apk/**/*.apk', name: 'appbuild' } } @@ -119,6 +105,7 @@ pipeline { file(credentialsId: 'plateia-app_key-properties', variable: 'APPKEYPROPERTIES'), file(credentialsId: 'plateia-app_firebase_options_production', variable: 'FIREBASEPROD'), file(credentialsId: 'plateia-app_upload-keystore-jks', variable: 'APPKEYUPLOAD'), + file(credentialsId: "plateia-app_env_${branchname}", variable: 'env'), ]) { sh 'cd ${WORKSPACE}' sh 'cp ${GOOGLEJSONPROD} android/app/src/production/google-services.json' @@ -126,11 +113,14 @@ pipeline { sh 'cp ${FIREBASEPROD} lib/app/firebase/firebase_options_production.dart ' sh 'cp ${APPKEYPROPERTIES} android/key.properties' sh 'cp ${APPKEYUPLOAD} android/app/upload-keystore.jks' + sh 'if [ -d ".env" ]; then rm -f .env; fi' + sh 'cp ${env} .env' sh 'flutter clean' sh 'flutter pub get' sh 'flutter packages pub run build_runner build --delete-conflicting-outputs' sh "flutter build apk --build-name=${APP_VERSION} --build-number=${BUILD_NUMBER} --release --flavor=production --target lib/main_production.dart --no-tree-shake-icons" sh "ls -ltra build/app/outputs/flutter-apk/" + sh 'if [ -d ".env" ]; then rm -f .env; fi' stash includes: 'build/app/outputs/flutter-apk/**/*.apk', name: 'appbuild' } }