apiVersion: batch/v1
kind: Job
metadata:
  labels:
    app: jx-boot
    jenkins-x.io/kind: jx-git-operator
spec:
  backoffLimit: 4
  completions: 1
  parallelism: 1
  template:
    metadata:
      labels:
        app: jx-boot
        jenkins-x.io/kind: jx-git-operator
    spec:
      initContainers:
        - args:
            - '-c'
            - 'mkdir -p $HOME; git config --global --add user.name $GIT_AUTHOR_NAME; git
          config --global --add user.email $GIT_AUTHOR_EMAIL; git config --global
          credential.helper store; git clone ${GIT_URL} ${GIT_SUB_DIR}; echo cloned
          url: $(inputs.params.url) to dir: ${GIT_SUB_DIR}; cd ${GIT_SUB_DIR}; git
          checkout ${GIT_REVISION}; echo checked out revision: ${GIT_REVISION} to
          dir: ${GIT_SUB_DIR}'
          command:
            - /bin/sh
          env:
            - name: GIT_URL
              valueFrom:
                secretKeyRef:
                  key: url
                  name: jx-boot
            - name: GIT_REVISION
              value: master
            - name: GIT_SUB_DIR
              value: source
            - name: GIT_AUTHOR_EMAIL
              value: jenkins-x@googlegroups.com
            - name: GIT_AUTHOR_NAME
              value: jenkins-x-labs-bot
            - name: GIT_COMMITTER_EMAIL
              value: jenkins-x@googlegroups.com
            - name: GIT_COMMITTER_NAME
              value: jenkins-x-labs-bot
            - name: XDG_CONFIG_HOME
              value: /workspace/xdg_config
          image: gcr.io/jenkinsxio/jx-cli:3.0.1
          name: git-clone
          volumeMounts:
            - mountPath: /workspace
              name: workspace-volume
          workingDir: /workspace
      containers:
        - args:
            - apply
          command:
            - make
          image: gcr.io/jenkinsxio/jx-cli:3.0.1
          imagePullPolicy: Always
          name: job
          volumeMounts:
            - mountPath: /workspace
              name: workspace-volume
          workingDir: /workspace/source
      dnsPolicy: ClusterFirst
      restartPolicy: Never
      schedulerName: default-scheduler
      serviceAccountName: jx-boot-job
      terminationGracePeriodSeconds: 30
      volumes:
        - name: workspace-volume
          emptyDir: {}
