What is PullRequest

A PullRequest is a Kubernetes CustomResourceDefinition (CRD) that represents pull request in your Git repository host. Initially when a Repository CRD is created, all pull requests are fetched from remote. After that, they are created/updated based on pull request events with matching clone URL. The naming format is {repository-CRD-name}-{pull-request-id}.

PullRequest Spec

As with all other Kubernetes objects, a PullRequest needs apiVersion, kind, and metadata fields. It also needs a .spec section. Below is an example PullRequest object:

apiVersion: git.kube.ci/v1alpha1
kind: PullRequest
  creationTimestamp: 2018-11-09T06:51:00Z
  generation: 1
    repository: kubeci-gpig
    state: open
  name: kubeci-gpig-1
  namespace: default
  - apiVersion: git.kube.ci/v1alpha1
    blockOwnerDeletion: true
    kind: Repository
    name: kubeci-gpig
    uid: d0a491e9-e3eb-11e8-a7e0-080027868e9e
  resourceVersion: "110983"
  selfLink: /apis/git.kube.ci/v1alpha1/namespaces/default/pullrequests/kubeci-gpig-1
  uid: d1975ba0-e3eb-11e8-a7e0-080027868e9e
  headRef: b001
  headSHA: 46859a78afa9f895962ccf111c7982f66e9d3b72
  number: 1

The repository and state labels are set by default. Apart from them, all existing labels in the remote associated with the pull request are also set with empty value (ok-to-test label in the example above).

The .spec section has following parts:


Represents the ID number of the pull request.


Represents the head reference associated with this pull request.


Represents the SHA of the head (i.e. the latest commit hash) associated with this pull request.