How do I specify a particular branch other than master in my OpenShift deployment?

Viewed 438

My objective is to build a container image from git, but only from a specific branch. In order to do that, in my build.yaml, I have to specify the uri of the git branch:

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

This will fetch the master branch, however, I want the superset-custom-exporter branch. How do I do that?

I tried testing the certain URLs[1] through web and through the command git clone, all of them failed.

  1. adding branch name after #
  2. using the exact web url
1 Answers

You can use the ref property to specify a branch name (or any other commit-ish):

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