GitRepository Custom Resource

2 minute read
On this page

The GitRepository Custom Resource configures a repository for integration with CloudBees Previews. It also contains repository-specific configuration information.

GitRepository

The GitRepository contains the following information.

Example GitRepository Custom Resource
kind: GitRepository
apiVersion: environment.cloudbees.com/v1alpha1
metadata:
  name: acme-web                                (1)
spec:
  url: https://github.com/acme/acme-web.git     (2)
  apiTokenSecretRef:
    name: github-token                          (3)
  webhookSecretRef:
    name: webhook-secret                        (4)
  ingressTLSSecretRef:
    name: tls-secret                            (5)
  imagePullSecretRefs:
    - name: imagepull-secret                    (6)
  secretRefs:                                   (7)
    - name: db-secret                           (8)
      key:  previews-dev-db-secret              (9)
      items:
        - name: password                        (10)
          key: password                         (11)
  env:                                          (12)
    - name: CUSTOM_VAR
      value: CUSTOM_VALUE
  autoCreateContexts:                           (13)
  - default
  autoUpdateContexts:                           (14)
  - default
1Name of the GitRepository resource.
2HTTPS Git URL for the repository this resource configures.
3Name of the Kubernetes Secret containing the SCM provider authentication token needed to interact with the Git repository specified in url.
4Name of the Kubernetes Secret containing the secret for verifying webhook payloads.
5Name of the TLS secret for environment ingresses for this repository. This value has precedence over the globally specified TLS secret in the Helm chart. See also TLS configuration via Helm chart.
6List of image pull secret names.
7List of secrets developers are allowed to use within previews by referring to them via the expression language within their .preview.yaml file. See also Using custom secrets.
8The name under which the secret is made available within .preview.yaml.
9The name of a Kubernetes Secret in the CloudBees Previews installation namespace from which to retrieve the values for the secret.
10The identifier that can be used to refer to the secret within .preview.yaml.
11The key within the Kubernetes Secret.
12List of custom environment variables passed to each step of the environment creation process.
13Configuration to enable automatic creation of preview environments. The autoCreateContexts configuration takes a list of preview contexts for which to enable auto-creation.
14Configuration to enable automatic updates of preview environments. The autoUpdateContexts configuration takes a list of preview contexts for which to enable auto-updates. By default, you must explicitly request a preview using the /preview comment on the pull request. You must repeat the comment each time you update the pull request. With autoUpdateContexts, you can list the preview contexts for which only an initial preview comment is necessary. Preview environments for the specified contexts will be created automatically with each subsequent push to the pull request.