This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
203 lines (196 sloc)
10.1 KB
| #!/bin/env groovy | |
| @Library('cliqz-shared-library@vagrant') _ | |
| properties([ | |
| disableConcurrentBuilds(), | |
| [$class: 'JobRestrictionProperty'] | |
| ]) | |
| node('gideon') { | |
| def branchName = "${BRANCH_NAME}" | |
| writeFile file: 'Vagrantfile', text: ''' | |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "xcode-10.1" | |
| config.vm.synced_folder ".", "/vagrant", disabled: true | |
| config.vm.define "publishios" do |publishios| | |
| publishios.vm.hostname ="publishios" | |
| config.ssh.private_key_path = "/Users/jenkins/reusable-VMs/publishios/.vagrant/machines/publishios/virtualbox/private_key" | |
| publishios.vm.network "public_network", :bridge => "en0: Ethernet 1", auto_config: false | |
| publishios.vm.boot_timeout = 900 | |
| publishios.ssh.forward_agent = true | |
| publishios.vm.provider "virtualbox" do |v| | |
| v.name = "publishios" | |
| v.gui = false | |
| v.memory = ENV["NODE_MEMORY"] | |
| v.cpus = ENV["NODE_CPU_COUNT"] | |
| end | |
| publishios.vm.provision "shell", privileged: false, run: "always", inline: <<-SHELL#!/bin/bash -l | |
| set -e | |
| set -x | |
| rm -f agent.jar | |
| curl -LO #{ENV['JENKINS_URL']}/jnlpJars/agent.jar | |
| ls . | |
| java -version | |
| java -jar agent.jar -jnlpUrl #{ENV['JENKINS_URL']}/computer/#{ENV['NODE_ID']}/slave-agent.jnlp -secret #{ENV["NODE_SECRET"]} & | |
| SHELL | |
| end | |
| end | |
| ''' | |
| sh '''#!/bin/bash -l | |
| set -e | |
| set -x | |
| mkdir -p .vagrant/machines/publishios/virtualbox | |
| cd .vagrant/machines/publishios/virtualbox/ | |
| if [ ! -f id ]; then touch id && echo "1b070f2c-9c26-470f-9d81-58e109313b47" >> id; fi | |
| ''' | |
| vagrant.inside( | |
| 'Vagrantfile', | |
| '/jenkins', | |
| 2, // CPU | |
| 8000, // MEMORY | |
| 12000, // VNC port | |
| false, // rebuild image | |
| ) { nodeId -> | |
| node(nodeId) { | |
| stage('Checkout') { | |
| checkout scm | |
| } | |
| try { | |
| stage('Prepare') { | |
| sh '''#!/bin/bash -l | |
| brew install getsentry/tools/sentry-cli | |
| set -e | |
| set -x | |
| java -version | |
| node -v | |
| npm -v | |
| brew -v | |
| xcodebuild -version | |
| pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | |
| sudo xcodebuild -license accept | |
| gem install fastlane --no-document | |
| fastlane clearCache | |
| fastlane prepare | |
| pip install --user virtualenv | |
| ''' | |
| } | |
| stage('Build & Upload') { | |
| if("${branchName}".contains("-lumenBeta")){ | |
| withCredentials([ | |
| [ | |
| $class : 'UsernamePasswordMultiBinding', | |
| credentialsId : '85859bba-4927-4b14-bfdf-aca726009962', | |
| passwordVariable: 'GITHUB_PASSWORD', | |
| usernameVariable: 'GITHUB_USERNAME', | |
| ], | |
| string(credentialsId: '8b4f7459-c446-4058-be61-3c3d98fe72e2', variable: 'ITUNES_USER'), | |
| string(credentialsId: 'c454a3e9-83af-480a-82fe-08c858512140', variable: 'SentryDSN'), | |
| string(credentialsId: '05be12cd-5177-4adf-9812-809f01451fa0', variable: 'FASTLANE_PASSWORD'), | |
| string(credentialsId: 'ee93743c-b0be-46aa-b49a-ab3caaea4f67', variable: 'MATCH_PASSWORD'), | |
| string(credentialsId: 'f206e880-e09a-4369-a3f6-f86ee94481f2', variable: 'SENTRY_AUTH_TOKEN'), | |
| string(credentialsId: 'ab91f92a-4588-4034-8d7f-c1a741fa31ab', variable: 'FASTLANE_ITC_TEAM_ID'), | |
| string(credentialsId: 'cc9215e4-ca8f-41bd-9e0b-1c2ba1900949', variable: 'LumenAPIKey'), | |
| string(credentialsId: '1593d451-3909-4b48-8b5e-9b3d289c38d1', variable: 'RevenuecatAPIKey')]) | |
| { | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| rm -rf /Users/vagrant/Library/Keychains/ios-build.keychain* | |
| rm -rf ../build-tools | |
| export app_name=Lumen | |
| export PATH="$PATH:/Users/vagrant/Library/Python/2.7/bin" | |
| echo de > shipping_locales.txt && echo en-US >> shipping_locales.txt | |
| fastlane importLocalizations | |
| export MATCH_KEYCHAIN_NAME=ios-build.keychain | |
| fastlane lumenBeta | |
| ''' | |
| } | |
| } | |
| else if("${branchName}".contains("-lumenRelease")){ | |
| withCredentials([ | |
| [ | |
| $class : 'UsernamePasswordMultiBinding', | |
| credentialsId : '85859bba-4927-4b14-bfdf-aca726009962', | |
| passwordVariable: 'GITHUB_PASSWORD', | |
| usernameVariable: 'GITHUB_USERNAME', | |
| ], | |
| string(credentialsId: '8b4f7459-c446-4058-be61-3c3d98fe72e2', variable: 'ITUNES_USER'), | |
| string(credentialsId: 'Lumen_SentryKey', variable: 'SentryDSN'), | |
| string(credentialsId: '05be12cd-5177-4adf-9812-809f01451fa0', variable: 'FASTLANE_PASSWORD'), | |
| string(credentialsId: 'ee93743c-b0be-46aa-b49a-ab3caaea4f67', variable: 'MATCH_PASSWORD'), | |
| string(credentialsId: 'f206e880-e09a-4369-a3f6-f86ee94481f2', variable: 'SENTRY_AUTH_TOKEN'), | |
| string(credentialsId: 'ab91f92a-4588-4034-8d7f-c1a741fa31ab', variable: 'FASTLANE_ITC_TEAM_ID'), | |
| string(credentialsId: 'cc9215e4-ca8f-41bd-9e0b-1c2ba1900949', variable: 'LumenAPIKey'), | |
| string(credentialsId: '1593d451-3909-4b48-8b5e-9b3d289c38d1', variable: 'RevenuecatAPIKey')]) | |
| { | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| rm -rf /Users/vagrant/Library/Keychains/ios-build.keychain* | |
| rm -rf ../build-tools | |
| export app_name=Lumen | |
| export PATH="$PATH:/Users/vagrant/Library/Python/2.7/bin" | |
| echo de > shipping_locales.txt && echo en-US >> shipping_locales.txt | |
| fastlane importLocalizations | |
| export MATCH_KEYCHAIN_NAME=ios-build.keychain | |
| fastlane lumenRelease | |
| ''' | |
| } | |
| } | |
| else{ | |
| withCredentials([ | |
| [ | |
| $class : 'UsernamePasswordMultiBinding', | |
| credentialsId : '85859bba-4927-4b14-bfdf-aca726009962', | |
| passwordVariable: 'GITHUB_PASSWORD', | |
| usernameVariable: 'GITHUB_USERNAME', | |
| ], | |
| string(credentialsId: 'c9d7aaae-25ee-4b74-b03f-d50312c53edd', variable: 'ITUNES_USER'), | |
| string(credentialsId: 'c033c0cc-a707-4a5d-aa5f-efccdd28c654', variable: 'SentryDSN'), | |
| string(credentialsId: 'd373025a-dc98-4fba-a2e3-da21e2011972', variable: 'FASTLANE_PASSWORD'), | |
| string(credentialsId: '9d4b5abb-a0ab-4d8b-85b7-cf380485da7c', variable: 'MATCH_PASSWORD'), | |
| string(credentialsId: 'f206e880-e09a-4369-a3f6-f86ee94481f2', variable: 'SENTRY_AUTH_TOKEN'), | |
| string(credentialsId: 'd9dc5c33-beef-402e-93d2-376a722a9766', variable: 'FASTLANE_ITC_TEAM_ID')]) | |
| { | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| rm -rf /Users/vagrant/Library/Keychains/ios-build.keychain* | |
| rm -rf ../build-tools | |
| export app_name=Ghostery | |
| export PATH="$PATH:/Users/vagrant/Library/Python/2.7/bin" | |
| fastlane importLocalizations | |
| ''' | |
| if("${branchName}".contains("-beta")){ | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| export MATCH_KEYCHAIN_NAME=ios-build.keychain | |
| fastlane beta | |
| ''' | |
| } | |
| else if ("${branchName}".contains("-r")){ | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| export MATCH_KEYCHAIN_NAME=ios-build.keychain | |
| fastlane release | |
| ''' | |
| } | |
| } | |
| } | |
| } | |
| } | |
| catch(all){ | |
| print "Something Failed. Check the above logs." | |
| } | |
| finally { | |
| stage("Clean Up"){ | |
| sh '''#!/bin/bash -l | |
| set -x | |
| set -e | |
| fastlane clearCache | |
| ''' | |
| } | |
| } | |
| } | |
| } | |
| } |