diff --git a/Jenkinsfile b/Jenkinsfile index 420c63c..8360d0f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,49 +38,28 @@ ]) ) +// Load Jenkins shared libraries to customize this project +def libCst = [ + remote: 'ssh://git@code.in.digital-me.nl:2222/DEVops/JenkinsLibCustom.git', + branch: env.BRANCH_NAME, + credentialsId: 'bot-ci-dgm-rsa', +] + +library( + identifier: "libCst@${libCst.branch}", + retriever: modernSCM([ + $class: 'GitSCMSource', + remote: libCst.remote, + credentialsId: libCst.credentialsId + ]) +) + // Initialize lazyConfig for this pipeline lazyConfig( name: 'DummyAnd', nopoll: release['branch'], ) -// Define a method to run Fastlane from the later lazyStages -def fastlane(platform, lane) { - // Lookup the relevant credentials first - if (platform == 'android') { - usernamePasswordMap = [ - credentialsId: 'dappre-google', - passwordVariable: 'ANDROID_KEYPASSWORD', - usernameVariable: 'ANDROID_KEYALIAS' - ] - } else { - error "Unknown platform '${plateform}'" - } - - // With the credentials, prepare the relevant environment - withCredentials([usernamePassword(usernamePasswordMap)]){ - if (platform == 'android' ) { - envMap = [ - 'SKIP_SLOW_FASTLANE_WARNING=YES', - 'FASTLANE_SKIP_UPDATE_CHECK=YES', - 'FASTLANE_OPT_OUT_USAGE=YES', - "ANDROID_STOREFILE=/opt/certificates/${ANDROID_KEYALIAS}.jks", - "ANDROID_STOREPASSWORD=${ANDROID_KEYPASSWORD}", - 'JAVA_HOME=/usr/java/latest', - 'SLAVE_AAPT_TIMEOUT=15', - ] - } else { - error "Unknown platform '${plateform}'" - } - - // Now only calling Fastlane - withEnv(envMap) { - sh "bundle install" - sh "bundle exec fastlane ${platform} ${lane}" - } - } -} - def getVersion(part, returnGroup = false) { def gradleFile = readFile(encoding: 'UTF-8', file: 'app/build.gradle') def m = gradleFile =~ /([^\n]*(?:${part})(?:[^:]*:?\s+|\s*=\s*)"?)([.0-9]+)("?\s*(?:(?:\/\/|#)[^\n]*)?[\n])/