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
project_path="/Users/USER_NAME/.jenkins/workspace/PROJECT_NAME"

#Specify project address
workspace_path="$project_path/PROJECT_NAME.xcworkspace"

#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
scheme="PROJECT_NAME"
#Specify the configuration name to package
configuration="Release"
#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
export_method='enterprise'


#Specify output path
output_path="$project_path/build/PROJECT_NAME{now}"
#Specify output archive address
archive_path="$output_path/PROJECT_NAME.xcarchive"
#Specify the output ipa name
ipa_name="PROJECT_NAME{now}.ipa"

#Specify the output ipa address
ipa_path="$output_path/${ipa_name}"
#Specify packaging configuration
export_plist_path="$project_path/ExportOptions.plist"
#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}

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

#export
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