Script chapter of Jenkins construction

After struggling with Xcode 9, it failed to export the. ipa file with Jenkins, and finally succeeded after being directed by a friend. Here is the final solution;

The general idea is as follows: Jenkins' configuration in the web page will mostly be sorted out later, and finally generate shell script in the terminal, and then each completed item will show success in the construction result. If there is a step error, the whole construction process will fail, so this explains that the previous construction has been stuck after Achiver's success.

Based on the above ideas, we will discard the previous Jenkins configuration, cancel the construction process of Jenkins project, clear all Xcode configurations, and use script configuration. I will post the following details and explain them properly:

#!/bin/bash -l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

#The following project name is the project name
pod install --verbose --no-repo-update
open PROJECT_NAME.xcworkspace

#The following user name is the user name

#Specify project address

#Add the current time string to the end of the folder
now=$(date +"%Y_%m_%d_%H_%M_%S")

#Specify the scheme name of the project
#Specify the configuration name to package
#Specify the output method used for packaging. Currently, app store, package, ad-hoc, enterprise, development, and developer ID are supported, that is, the method parameter of xcodebuild

#Specify output path
#Specify output archive address
#Specify the output ipa name

#Specify the output ipa address
#Specify packaging configuration
#Get the commit message when executing the command
#commit_msg="$(cat $project_path/build_log.txt)"

#Output set variable value
echo "===workspace path: ${workspace_path}==="
echo "===archive path: ${archive_path}==="
echo "===ipa path: ${ipa_path}==="
echo "===export method: ${export_method}==="
#echo "===commit msg: ${commit_msg}==="

#Clear the previous build first
xcodebuild clean -workspace ${workspace_path} -scheme ${scheme} -configuration ${configuration}

xcodebuild archive -workspace ${workspace_path} -scheme ${scheme} -archivePath ${archive_path}

xcodebuild -exportArchive -archivePath ${archive_path} -exportPath ${output_path} -exportOptionsPlist ${export_plist_path}

According to the above secret method, you will get a successful construction case under Xcode 9, and the. ipa file will also be exported. As for later uploading to the platform, please go to each platform to find and sort out the documents without further explanation.

Today's new year, I wish you a happy new year, 2018, no bug s in the code, new technology will start soon, my sister's hands will be soft, wages will rise fast, and life will be happy!!!

Tags: jenkins xcode shell

Posted on Mon, 04 May 2020 07:15:59 -0400 by pckidcomplainer