I am working on Continuous Integration with Xcode 9. I have successfully setup Server & Bot.
Integration works fine.
Requirement: I required ipa path in Post Script to upload on my server.
Problem:
I am using XCS_PRODUCT
variable for fetching ipa path.
Here is ENV
Output from post trigger:
XCS_BOT_NAME=TestXCTest Bot
XCS=1
XCS_WARNING_CHANGE=0
XCS_SOURCE_DIR=/Users/xcodeserver/Library/Caches/XCSBuilder/Bots/b2642ba61e9ffe8554a9d17d1f0126d5/Source
SHELL=/bin/bash
XCS_INTEGRATION_RESULT=succeeded
TMPDIR=/var/folders/wv/33mqmjhn525clw9zzx2c0xq80000gs/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.xHus0eJhWj/Render
XCS_TEST_FAILURE_COUNT=0
XCS_INTEGRATION_ID=51c2cf4d7b95c0c4a4f948f23001620e
XCS_BOT_TINY_ID=B705E6C
USER=xcodeserver
XCS_ARCHIVE=/Users/xcodeserver/Library/Caches/XCSBuilder/Integration-51c2cf4d7b95c0c4a4f948f23001620e/TestXCTest.xcarchive
XCS_TEST_FAILURE_CHANGE=0
XCS_INTEGRATION_TINY_ID=2C6684E
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.W6OUJYNErV/Listeners
__CF_USER_TEXT_ENCODING=0x1F9:0:0
XCS_PRIMARY_REPO_DIR=/Users/xcodeserver/Library/Caches/XCSBuilder/Bots/b2642ba61e9ffe8554a9d17d1f0126d5/Source/TestXCTest
PATH=/Applications/Xcode_9.3.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
XCS_BOT_ID=b2642ba61e9ffe8554a9d17d1f0126d5
PWD=/Users/xcodeserver/Library/Caches/XCSBuilder/Bots/b2642ba61e9ffe8554a9d17d1f0126d5/Source
XCS_XCODEBUILD_LOG=/Users/xcodeserver/Library/Caches/XCSBuilder/Integration-51c2cf4d7b95c0c4a4f948f23001620e/xcodebuild.log
XCS_PRODUCT=/Users/xcodeserver/Library/Caches/XCSBuilder/Integration-51c2cf4d7b95c0c4a4f948f23001620e/ExportedProduct/TestXCTest.ipa
XCS_PRIMARY_REPO_BRANCH=master
XPC_FLAGS=0x0
XCS_ERROR_COUNT=0
XCS_ANALYZER_WARNING_COUNT=0
XCS_TESTS_CHANGE=-2
XPC_SERVICE_NAME=0
XCS_ERROR_CHANGE=0
SHLVL=1
HOME=/Users/xcodeserver
XCS_DERIVED_DATA_DIR=/Users/xcodeserver/Library/Caches/XCSBuilder/Bots/b2642ba61e9ffe8554a9d17d1f0126d5/DerivedData
XCS_ANALYZER_WARNING_CHANGE=0
LOGNAME=xcodeserver
XCS_WARNING_COUNT=0
XCS_TESTS_COUNT=0
XCS_OUTPUT_DIR=/Users/xcodeserver/Library/Caches/XCSBuilder/Integration-51c2cf4d7b95c0c4a4f948f23001620e
XCS_INTEGRATION_NUMBER=13
_=/usr/bin/env
Here it show ipa at this path:
/Users/xcodeserver/Library/Caches/XCSBuilder/Integration-51c2cf4d7b95c0c4a4f948f23001620e/ExportedProduct/TestXCTest.ipa
But In finder There isn't any folder like Integration-.....
So Question is How can I get ipa path?
I have checked many questions regarding this like:
Continuous integration Xcode Server after trigger $XCS_PRODUCT not set
Xcode Bot: how to get .ipa path on a post trigger script?
but didn't get answer for Xcode 9.
Found issue
Xcode is deleting Integration folder after completion.
Solution:
I have added below post script to copy ipa:
rm -r "/Users/xcodeserver/Desktop/ipa/*"
cp -R "${XCS_OUTPUT_DIR}/ExportedProduct/" "/Users/xcodeserver/Desktop/ipa/"