如何在OpenShift部署中指定除master以外的特定分支?

问题描述

我的目标是从git(但仅从特定分支)构建容器映像。为此,我必须在build.yaml中指定git分支的uri:

spec:
  output:
    to:
      kind: imagestreamTag
      name: superset-custom-exporter:latest
  source:
    git:
      uri: https://gitlab.cee.domain.com/repo-org/repo-name.git
    type: Git

这将获取master分支,但是,我想要superset-custom-exporter分支。我该怎么办?

我尝试通过网络和通过命令git clone测试某些URL [1],所有这些都失败了。

  1. #之后添加分支名称
  2. 使用确切的网站网址

解决方法

您可以使用ref属性来指定分支名称(或任何其他提交名称):

source:
  git:
    uri: https://gitlab.cee.domain.com/repo-org/repo-name.git
    ref: superset-custom-exporter
  type: Git