Last active
March 19, 2019 14:13
-
-
Save FilipIlievski/9a0577bd6e398ddbe9db9b177e13ec45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { | |
label 'mac' | |
} | |
options { | |
timestamps() | |
} | |
environment { | |
JENKINS_SCRIPTS = '$JENKINS_HOME/scripts/app_features/' | |
BRANCH = "${params.Branch}" | |
ENVIRONMENT = "${params.Environment}" | |
LOCALYTICS_KEY = "${params.LocalyticsKey}" | |
ADJUSTENVIRONMENT = "${params.AdjustEnvironment}" | |
} | |
stages { | |
stage('Checkout') { | |
steps { | |
ansiColor('gnome-terminal') { | |
checkout([ | |
changelog: false, | |
poll: false, | |
scm: [$class: 'GitSCM', branches: [[name: BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'aboutyou-mobile-app-react']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'Bob-LDAP', url: 'ssh://[email protected]:7999/am/aboutyou-mobile-app-react.git']]] | |
]) | |
script { | |
switch(ENVIRONMENT) { | |
case "INTEGRATION": | |
ENVIRONMENTURL = "${env.API_URL_INTEGRATION}" | |
break | |
case "STAGING": | |
ENVIRONMENTURL = "${env.API_URL_STAGING}" | |
break | |
case "PRODUCTION": | |
ENVIRONMENTURL = "${env.API_URL_PRODUCTION}" | |
break | |
} | |
switch(ADJUSTENVIRONMENT) { | |
case "ADJUST_SANDBOX": | |
ADJUSTENVVALUE = "true" | |
break | |
case "ADJUST_PRODUCTION": | |
ADJUSTENVVALUE = "false" | |
break | |
} | |
switch(LOCALYTICS_KEY) { | |
case "DEVELOPMENT": | |
LOCALYTICS_RAW_KEY = "${env.IOS_APP_LOCALYTICS_DEVELOPMENT_KEY}" | |
break | |
case "PRODUCTION": | |
LOCALYTICS_RAW_KEY = "${env.IOS_APP_LOCALYTICS_PRODUCTION_KEY}" | |
break | |
} | |
} | |
} | |
} | |
} | |
stage('Build') { | |
steps { | |
ansiColor('gnome-terminal') { | |
sh JENKINS_SCRIPTS + "setup_environment_ios.sh \"${params.AppName}\" ${params.AppVersion} $ENVIRONMENTURL $ADJUSTENVVALUE ${params.EnableLogging} ${params.EnableCheckoutDebugging} $LOCALYTICS_RAW_KEY ${params.AdjustDevToken}" | |
sh JENKINS_SCRIPTS + "build_release_ipa.sh ${params.AppVersion}" | |
} | |
} | |
} | |
stage('Deploy') { | |
steps { | |
ansiColor('gnome-terminal') { | |
wrap([$class: 'BuildUser']) { | |
sh JENKINS_SCRIPTS + "create_release_notes.sh $BRANCH $ENVIRONMENT $ADJUSTENVVALUE ${params.EnableLogging} \"${params.AppName}\" ${params.EnableCheckoutDebugging} ${params.AdjustDevToken} $LOCALYTICS_KEY" | |
sh JENKINS_SCRIPTS + "deploy_ipa.sh" | |
} | |
} | |
} | |
} | |
} | |
post { | |
always { | |
ansiColor('gnome-terminal') { | |
wrap([$class: 'BuildUser']) { | |
sh JENKINS_SCRIPTS + "send_result.sh $BRANCH $ENVIRONMENT $ADJUSTENVVALUE ${params.EnableLogging} \"${params.AppName}\" ${params.EnableCheckoutDebugging} ${currentBuild.currentResult} ${params.AdjustDevToken} $LOCALYTICS_KEY" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment