1

我正在尝试设置BITRISE CLI,我无法使用BITRISE CLI 下载项目源代码。如何在本地机器上使用 bitrise cli 克隆托管在 git hub 中的项目?

4

1 回答 1

2

Bitrise CLI 旨在以两种不同的方式使用:

  • 在 CI 环境中使用它,检索代码应该是过程的一部分。
  • 在您已经拥有代码的本地 Mac/PC 上使用它,因此无需检索它。

如果您安装 CLI 并且仅bitrise run在您的 Mac/PC 上,那么它将以第二种模式运行,这意味着您已经拥有您的代码,因此将跳过相关步骤。

在 CI 环境中,或者如果您想在自己的 Mac/PC 上强制“CI 模式”,您应该在运行 bitrise cli 之前将CI环境变量设置为。trueCLI 还有一个命令行标志选项,可用于激活此模式:

$ bitrise --help

NAME: bitrise - Bitrise Automations Workflow Runner

USAGE: bitrise [OPTIONS] COMMAND/PLUGIN [arg...]

VERSION: 1.16.1

GLOBAL OPTIONS:
  --loglevel value, -l value  Log level (options: debug, info, warn, error, fatal, panic). [$LOGLEVEL]
  --debug                     If true it enabled DEBUG mode. If no separate Log Level is specified this will also set the loglevel to debug. [$DEBUG]
  --ci                        If true it indicates that we're used by another tool so don't require any user input! [$CI]
  --pr                        If true bitrise runs in pull request mode.
  --help, -h                  show help
  --version, -v               print the version
...

如您所见,该--ci标志可用于启用此模式(例如bitrise --ci run ...),以及CI环境变量。

当您运行 Bitrise CLI 是 CI 模式时,它会简单地将.IsCI run_if条件设置为true,否则在非 CI 模式下它是false. 这意味着,某些步骤会利用此标志,并且默认标记为仅在 CI 模式下运行 - 例如参见 Git 克隆步骤的定义:https ://github.com/bitrise-io/steps-git -clone/blob/13fc7d29662bc68aaead618a72d499fb0f031d6c/step.yml#L18

你当然可以用run_if自己的方式覆盖bitrise.yml它,它只是默认配置。

因此,强制步骤在任何环境中运行的另一种方法是将其标记在bitrise.ymlwith 中run_if: true

相关链接:

于 2018-05-26T09:32:53.630 回答