--- apiVersion: template.openshift.io/v1 kind: Template metadata: name: "${JOB_NAME}-cronjob-template" annotations: description: "Scheduled Task to perform a Newman Test" tags: "cronjob,Newman,Postman" objects: - kind: CronJob apiVersion: batch/v1beta1 metadata: name: "${JOB_NAME}" spec: schedule: "${SCHEDULE}" concurrencyPolicy: Forbid successfulJobsHistoryLimit: "${{SUCCESS_JOBS_HISTORY_LIMIT}}" failedJobsHistoryLimit: "${{FAILED_JOBS_HISTORY_LIMIT}}" jobTemplate: spec: template: metadata: labels: template: "${JOB_NAME}-job" cronjob: "${JOB_NAME}" spec: containers: - name: newman image: postman/newman:alpine # COLLECTION - URL to collection file # ENVIRONMENT - Filename of mounted file from 'newman-environment' secret command: - "newman" - "run" - "$(COLLECTION)" - "--environment" - "ENVIRONMENT" - "--delay-request" - "5000" envFrom: - configMapRef: name: newman-config volumeMounts: - name: newman-environment mountPath: "/etc/newman" readOnly: true restartPolicy: Never activeDeadlineSeconds: 600 terminationGracePeriodSeconds: 30 volumes: - name: newman-environment secret: secretName: newman-environment-secret defaultMode: 420 parameters: - name: JOB_NAME displayName: Job Name description: Name of the Scheduled Job to Create. value: newman required: true - name: SCHEDULE displayName: Cron Schedule description: Cron Schedule to Execute the Job (using local cluster system TZ) # Currently targeting 1:00 AM Daily value: "0 1 * * *" - name: SUCCESS_JOBS_HISTORY_LIMIT displayName: Successful Job History Limit description: The number of successful jobs that will be retained value: "5" required: true - name: FAILED_JOBS_HISTORY_LIMIT displayName: Failed Job History Limit description: The number of failed jobs that will be retained value: "2" required: true