apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: tekton-git-polling
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          serviceAccountName: tekton-utils
          containers:
            - name: polling
              image: registry.cn-huhehaote.aliyuncs.com/feng-566/tekton-git-polling:v0.0.1
              imagePullPolicy: IfNotPresent
              args:
                - --repo=https://github.com/win5do/tekton-cicd-demo.git
                - --username=$(username)
                - --password=$(password)
                - --branch=*
                - --range=300
                - --template=/opt/configmaps/tpl/pipelineRunTemplate
              env:
                - name: username
                  valueFrom:
                    secretKeyRef:
                      name: git-auth
                      key: username
                - name: password
                  valueFrom:
                    secretKeyRef:
                      name: git-auth
                      key: password
              volumeMounts:
                - name: tpl
                  mountPath: "/opt/configmaps/tpl"
                  readOnly: true
          volumes:
            - name: tpl
              configMap:
                name: pr-tpl
