I build a Docker image based on jenkins/jenkins:lts-jdk11, and I set
JAVA_OPTS=-Djenkins.install.SetupWizard.adminInitialApiToken=11[32 hex digits]
Regardless of whether I set
-Djenkins.install.runSetupWizard=true
or
-Djenkins.install.runSetupWizard=false
the result is the same: The admin user has no API token configured.
My goal is to create an image with a known API token that I can use in scripts, without any manual configuration - and I cannot see how to achieve this.
Works fine for me with a clean Jenkins home. "jenkins.install.SetupWizard#createInitialApiToken: API Token generated using system property: jenkins.install.SetupWizard.adminInitialApiToken" is logged and I get a token after completing the wizard and checking the admin user's profile. You must be running against an existing Jenkins home rather than a clean one.