ipa upload to Testflight fails via Jenkins but passes via terminal

Viewed 329

So I have been trying to automate ipa uploads to Testflight via Jenkins. I am using the following command to achieve the same :

xcodebuild -exportArchive -archivePath Archive/application.xcarchive -exportPath Builds -exportOptionsPlist ~/Desktop/jenkins_slave/AppstoreExportOptions.plist -quiet

When executed via terminal, it works fine and the ipa is uploaded to Testflight.

However, when I am running via Jenkins, the upload fails citing authentication error. Logs below :

2022-01-10 17:58:24.681 xcodebuild[14144:25274615]  DVTPortal: Error:
Error Domain=DVTPortalServiceErrorDomain Code=1100 "Your session has expired. Please log in." UserInfo={payload={
    creationTimestamp = "2022-01-10T17:58:24Z";
    httpCode = 200;
    protocolVersion = QH65B2;
    requestUrl = "https://developerservices2.apple.com/services/QH65B2/viewDeveloper.action";
    responseId = "207a4f29-2863-4dce-b290-7f28e845cc44";
    resultCode = 1100;
    resultString = "Your session has expired. Please log in.";
    userLocale = "en_US";
    userString = "Your session has expired. Please log in.";
}, NSLocalizedDescription=Your session has expired. Please log in.}
2022-01-10 17:58:24.682 xcodebuild[14144:25274618]  IDEDistribution: Failed to log in with account 'xyz@gmail.com' while checking for an App Store Connect account
error: exportArchive: Failed to log in.

Error Domain=IDEDistributionErrorDomain Code=9 "Failed to log in." UserInfo={IDEDistributionErrorsAccountIssues=(
    "Account \"xyz@gmail.com\": Failed to log in"
), NSLocalizedDescription=Failed to log in., NSLocalizedRecoverySuggestion=App Store Connect access for “Company xyz.” is required. Ensure that your Apple ID account usernames and passwords are correct in the Accounts preference pane.}

I can't figure out what is going wrong. I have already tried the following as mentioned in numerous places, but it still doesn't work :

defaults write com.apple.dt.Xcode DVTDeveloperAccountUseKeychainService_2 -bool NO

I know you'll would suggest to use fastlane to achieve this faster and effectively. Eventually I would integrate fastlane in my project, but I want to understand what is going wrong here.

0 Answers
Related