Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins+fastlane fails with "Missing password for user"

TL;DR

What's the simplest, secure, step-by-step approach to giving Jenkins 2.x access to the credentials needed for fastlane + sigh?

Context

I inherited a Jenkins 1.x installation and decided to upgrade to 2.x. We have several iOS projects that were building and pushing to HockeyApp/TestFlight without issues, but I had some free time and I figured it'd be better to upgrade from 1.x to 2.x now rather than having to do 1.x to 3.x later.

Not knowing how the original installation had been done, it seemed safest to just use the packaged installer, so I downloaded the binary for 2.32.3 and stepped through the wizard.

Problem

In order to test the upgrade, I logged into the web interface, navigated to an iOS project managed by Fastlane, and clicked "Rebuild last". The build failed almost immediately:

Missing password for user [email protected], and running in non-interactive shell

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | xcversion                           | 0           |
| 💥    | sigh                                | 0           |
+------+-------------------------------------+-------------+

...

/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.25.0/credentials_manager/lib/
credentials_manager/account_manager.rb:125:in `ask_for_login': [!] Missing
password for user [email protected], and running in non-interactive
shell (RuntimeError)

...

After quite a lot of googling, I've tried following a few suggestions, all with no luck. At this point I'm concerned that I'll just end up breaking things because all of the solutions I've encountered are multi-step, across multiple domains (jenkins, keychain, shell commands), and lacking in any what-could-go-wrong-when-trying-this-solution-and-how-to-recover context.

In short, I'm almost at the end of my rope. Or, as the saying goes, I've got just enough rope to hang myself…and I'd rather not. 😬

like image 850
clozach Avatar asked Sep 19 '25 18:09

clozach


1 Answers

Try setting these environment variables.

FASTLANE_USER: Your App Store Connect / Apple Developer Portal user, if your/fastlane/setup accesses App Store Connect or the Apple Developer Portal (e.g. submit a TestFlight build, create a profile, …)

FASTLANE_PASSWORD: Your App Store Connect / Apple Developer Portal password, usually only needed if you also set theFASTLANE_USERvariable

To generate a web session for your CI machine, use fastlane spaceauth -u [email protected]

This will authenticate you and provide a string that can be transferred to your CI system. Copy everything from—\nto your CI server and provide it as environment variable named FASTLANE_SESSION

FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: You need to provide an application specific password if you have 2-factor enabled and use pilot or deliver to upload a binary to App Store Connect

For further details refer this https://docs.fastlane.tools/best-practices/continuous-integration/#environment-variables-to-set

Hope this helps!

like image 154
Sumit Avatar answered Sep 21 '25 17:09

Sumit