gpt4 book ai didi

docker - 您能否在具有苹果 2 因素身份验证的 CI 环境中使用 "expo build:ios"以及如何使用

转载 作者:行者123 更新时间:2023-12-02 18:00:40 24 4
gpt4 key购买 nike

有没有办法使用expo build:ios在 CI 环境中并通过 2 因素身份验证?

由于我的苹果开发人员帐户需要 2 因素身份验证,我在我们的 CI 环境中使用 expo 开始构建时遇到了麻烦。

expo build:ios命令应该只在本地使用或没有 2 因素身份验证?

运行构建 本地在交互模式下有效 - 仅在我第一次选择构建应用程序时才需要密码和 2 因素身份验证。对于连续构建,我只使用 expo build:ios --release-channel test就是这样

我的 CI 环境是 google 的 Cloud Build - 它在一个 Docker 容器中运行,所以我不能去进行一次手动登录来让运行器保留一些 session 信息,就像它发生在本地一样吗?

阅读 expo build:ios 的 cli 使用信息后并且您可以将您的帐户密码设置为 ENV 变量,例如 EXPO_APPLE_PASSWORD我认为应该可以在 CI 环境中使用它

但后来我得到以下结果:

expo login --non-interactive -u XXX

Success. You are now logged in as XXX.

expo build:ios --non-interactive --no-wait --release-channel test --apple-id XXXXX --team-id F7NE7X9ZFW

- Making sure project is set up correctly...
[16:43:00] Checking if there is a build in progress...
[16:43:00] Trying to authenticate with Apple Developer Portal...
Two-factor Authentication (6 digits code) is enabled for account 'XXXXX'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915
If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
...
Please enter the 6 digit code:
[16:43:02] Authentication with Apple Developer Portal failed!
[16:43:02] Reason: Unknown reason, raw: "The input stream is exhausted."

所以我点击了非交互式 session 的链接: https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification

我看到我必须创建和使用 FASTLANE_SESSION环境变量。
但在那一点上,我不确定它是否会起作用,因为这似乎来自 expo 内部使用的一些工具。

我想我可以安装 fastlane在本地并尝试使用命令 fastlane spaceauth -u user@example.org 生成此变量.虽然我在世博会文档中没有找到任何关于此的信息

有使用信息 expo build:ios要构建独立的应用程序,它仅涵盖如何在本地构建它们 https://docs.expo.io/versions/v36.0.0/distribution/building-standalone-apps/

他们有一个 CI 流程指南(“关于你的 CI”) - 但它使用的是 turtle-cli对于 iOS,它需要在 mac 环境中运行 - 它涵盖了如何在自己的机器上构建自己而不是使用 expo.io https://docs.expo.io/versions/v36.0.0/distribution/turtle-cli/

我尝试过的另一件事是运行:

expo build:ios \
--team-id YOUR_TEAM_ID \
--dist-p12-path /path/to/your/dist/cert.p12 \
--provisioning-profile-path /path/to/your/provisioning/profile.mobileprovision

EXPO_IOS_DIST_P12_PASSWORD设置为 env 变量但构建会失败,因为它仍然需要苹果 id 和密码

有没有办法可以共享或复制我的本地 session - 我第一次运行时博览会创建的 session build:ios我在哪里通过身份验证并且不再提示我输入 CI 机器的密码?

最佳答案

以下是最终对我有用的内容:
我创建了另一个包标识符 com.myawesome.stuff我还生成/创建了:

  • 经销证书P12 --dist-p12-path
  • 按键 .p8 文件 - --push-id--push-p8-path
  • 配置文件。 - --push-p8-path

  • 然后 本地我已经运行了以下内容:
    交互式登录
    expo login
    与苹果交互认证
    expo build:ios --clear-credentials --apple-id my@appleId.com --team-id=TheTeam --dist-p12-path=dist.p12 --provisioning-profile-path=profile.mobileprovision --push-p8-path=push.p8 --push-id=THEID --release-channel test
    公平地说,我已经在本地运行了这些,但在谷歌云控制台终端中运行
    然后 关于 CI 环境 我们只是使用:
    expo login --non-interactive "--username=XXXX"
    expo build:ios --non-interactive --no-wait "--release-channel=$BRANCH_NAME"
    哪个有效并产生以下日志
    - Making sure project is set up correctly...
    [17:48:39] Checking if there is a build in progress...

    [17:48:40] Fetching available credentials
    [17:48:40] Unable to validate distribution certificate due to insufficient Apple Credentials
    [17:48:40] Unable to validate Push Keys due to insufficient Apple Credentials
    - Performing best effort validation of Provisioning Profile...

    [xmldom error] element parse error: Error: invalid tagName:
    @#[line:99,col:125]
    [xmldom error] element parse error: Error: invalid tagName:
    @#[line:114,col:75]
    [xmldom error] element parse error: Error: invalid tagName:
    @#[line:143,col:84]
    ✔ Successfully performed best effort validation of Provisioning Profile.
    [17:48:40]
    [17:48:40] Project Credential Configuration:
    [17:48:40] Experience: @XXXX/XXXX, bundle identifier: com.XXXXXXXX
    [17:48:40] Provisioning profile is missing. It will be generated during the next build
    [17:48:40] Apple Team ID: XXXXXXX, Apple Team Name: ---------
    [17:48:40]
    [17:48:40] Distribution Certificate - Certificate ID: -----
    [17:48:40] Apple Team ID: XXXXXXX, Apple Team Name: ---------
    [17:48:40] used by
    @XXXX/XXXX (com.XXXXXXX)
    [17:48:40] Push Notifications Key - Key ID: XXXXXXXX
    [17:48:40] Apple Team ID: XXXXXXX, Apple Team Name: ---------
    [17:48:40] used by
    @XXXX/XXXX (com.XXXXXXX)
    [17:48:40] Unable to find an existing Expo CLI instance for this directory, starting a new one...
    [17:48:42] Starting Metro Bundler on port 19001.
    [17:48:46] Tunnel ready.
    [17:48:46] Publishing to channel 'test'...
    [17:48:47] Building iOS bundle
    [17:50:13] Finished building JavaScript bundle in 60785ms.
    [17:50:13] Building Android bundle
    [17:51:04] Finished building JavaScript bundle in 51597ms.
    [17:51:04] Analyzing assets
    [17:51:06] Finished building JavaScript bundle in 1669ms.
    [17:51:08] Finished building JavaScript bundle in 1526ms.
    [17:51:08] Uploading assets
    [17:51:08] No assets changed, skipped.
    [17:51:08] Processing asset bundle patterns:
    [17:51:08] - /workspace/**/*
    [17:51:08] Uploading JavaScript bundles
    [17:51:12] Published
    [17:51:12] Your URL is

    https://exp.host/@XXXX/XXXX?release-channel=test

    [17:51:12] › Closing Expo server
    [17:51:12] › Stopping Metro bundler
    [17:51:13] Checking if this build already exists...

    [17:51:13] Build started, it may take a few minutes to complete.
    [17:51:13] You can check the queue length at https://expo.io/turtle-status

    [17:51:13] You can make this faster. 🐢
    Get priority builds at: https://expo.io/settings/billing

    [17:51:13] You can monitor the build at

    https://expo.io/dashboard/XXXX/builds/e5c32814-8613-4fef-889a-05ca982e952f

    [17:51:13] Alternatively, run `expo build:status` to monitor it from the command line.
    check尽管在开始时出现了麻烦的警告,但构建仍然有效并产生 .ipa我们已成功提交试飞

    [xmldom error] element parse error: Error: invalid tagName: @#[line:99,col:125]

    [17:48:40] Provisioning profile is missing. It will be generated during the next build



    我认为问题可能是我们使用的谷歌云构建机器设置在美国的位置,但我上次使用的是 expo build:ios在我的电脑上本地命令我在不同的地区。所以只需运行 expo build:ios -clear-credentials可能就足够了,您可以让 expo 创建和管理所有必需的证书。
    但是我在 CI 上找不到任何信息。您应该使用的(非交互式)环境 expo build:ios无需提供 Apple ID 和凭据

    关于docker - 您能否在具有苹果 2 因素身份验证的 CI 环境中使用 "expo build:ios"以及如何使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60566559/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com