代码之家  ›  专栏  ›  技术社区  ›  Majesty

Gitlab:手动运行管道时是否可以传递SQL脚本?

  •  0
  • Majesty  · 技术社区  · 1 年前

    有时我需要对数据库进行不属于迁移思想的更改(迁移是关于更改模式,但我需要操作数据本身)。

    因此,我正在考虑一个额外的管道,我可以手动启动它,但事先提供一个原始的sql文件。Gitlab似乎有这样一个选择——它提供了 文件 变量类型,但它旁边没有文件输入。

    enter image description here

    有可能让它像我想象的那样工作吗?

    1 回复  |  直到 1 年前
        1
  •  1
  •   KamilCuk    1 年前

    手动运行管道时是否可以传递SQL脚本?

    是的,这是可能的,只需将脚本作为环境变量传递即可。你可以传递任何文本,也可以传递任何数据。

    它提供了一个File变量类型,但旁边没有文件输入。

    请参阅文档 https://docs.gitlab.com/ee/ci/variables/#use-file-type-cicd-variables .

    File type variables:
    Consist of a key, value, and file.
    Are made available in jobs as environment variables, with:
        The CI/CD variable key as the environment variable name.
        The CI/CD variable value saved to a temporary file.
        The path to the temporary file as the environment variable value.