apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: prowjobs.prow.k8s.io
  annotations:
    "api-approved.kubernetes.io": "https://github.com/kubernetes/test-infra/pull/8669"
  labels:
    app.kubernetes.io/part-of: prow
spec:
  group: prow.k8s.io
  names:
    kind: ProwJob
    singular: prowjob
    plural: prowjobs
  scope: Namespaced
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            x-kubernetes-preserve-unknown-fields: true
            properties:
              max_concurrency:
                type: integer
                minimum: 0
              type:
                type: string
                enum:
                - "presubmit"
                - "postsubmit"
                - "periodic"
                - "batch"
          status:
            type: object
            x-kubernetes-preserve-unknown-fields: true
            properties:
              state:
                type: string
                enum:
                - "triggered"
                - "pending"
                - "success"
                - "failure"
                - "aborted"
                - "error"
            anyOf:
            - not:
                properties:
                  state:
                    enum:
                    - "success"
                    - "failure"
                    - "error"
            - required:
              - completionTime
    additionalPrinterColumns:
    - name: Job
      type: string
      description: The name of the job being run.
      jsonPath: .spec.job
    - name: BuildId
      type: string
      description: The ID of the job being run.
      jsonPath: .status.build_id
    - name: Type
      type: string
      description: The type of job being run.
      jsonPath: .spec.type
    - name: Org
      type: string
      description: The org for which the job is running.
      jsonPath: .spec.refs.org
    - name: Repo
      type: string
      description: The repo for which the job is running.
      jsonPath: .spec.refs.repo
    - name: Pulls
      type: string
      description: The pulls for which the job is running.
      jsonPath: ".spec.refs.pulls[*].number"
    - name: StartTime
      type: date
      description: When the job started running.
      jsonPath: .status.startTime
    - name: CompletionTime
      type: date
      description: When the job finished running.
      jsonPath: .status.completionTime
    - name: State
      description: The state of the job.
      type: string
      jsonPath: .status.state
