This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
133 lines (126 sloc)
5.25 KB
| #!/bin/env groovy | |
| @Library('cliqz-shared-library@vagrant') _ | |
| properties([ | |
| disableConcurrentBuilds(), | |
| [$class: 'JobRestrictionProperty'] | |
| ]) | |
| node('mac-vm-host') { | |
| def branchName = "${BRANCH_NAME}" | |
| writeFile file: 'Vagrantfile', text: ''' | |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "browser-ios-v300" | |
| config.vm.define "publishios" do |publishios| | |
| publishios.vm.hostname ="publishios" | |
| publishios.vm.network "public_network", :bridge => "en0", auto_config: false | |
| publishios.vm.boot_timeout = 900 | |
| publishios.vm.provider "vmware_fusion" do |v| | |
| v.name = "publishios" | |
| v.whitelist_verified = true | |
| v.gui = false | |
| v.memory = ENV["NODE_MEMORY"] | |
| v.cpus = ENV["NODE_CPU_COUNT"] | |
| v.cpu_mode = "host-passthrough" | |
| v.vmx["remotedisplay.vnc.enabled"] = "TRUE" | |
| v.vmx["RemoteDisplay.vnc.port"] = ENV["NODE_VNC_PORT"] | |
| v.vmx["ethernet0.pcislotnumber"] = "33" | |
| 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 | |
| nohup java -jar agent.jar -jnlpUrl #{ENV['JENKINS_URL']}/computer/#{ENV['NODE_ID']}/slave-agent.jnlp -secret #{ENV["NODE_SECRET"]} & | |
| SHELL | |
| end | |
| end | |
| ''' | |
| vagrant.inside( | |
| 'Vagrantfile', | |
| '/jenkins', | |
| 4, // 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 virtualenv | |
| sudo /usr/bin/easy_install virtualenv | |
| ''' | |
| } | |
| stage('Build & Upload') { | |
| 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 | |
| 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 | |
| ''' | |
| } | |
| } | |
| } | |
| } | |
| } |