---

- job:
    name: <%= @job_name %>
    display-name: <%= @job_name %>
    project-type: freestyle
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    builders:
      - trigger-builds:
          - project: run-rake-task
            block: true
            predefined-parameters: |
              TARGET_APPLICATION=rummager
              MACHINE_CLASS=search
              RAKE_TASK="analytics:create_data_import_csv EXPORT_PATH=/data/export/enhanced_ecommerce"
          - project: run-rake-task
            block: true
            predefined-parameters: |
              TARGET_APPLICATION=rummager
              MACHINE_CLASS=search
              RAKE_TASK="analytics:delete_old_files EXPORT_PATH=/data/export/enhanced_ecommerce EXPORT_FILE_LIMIT=10"
    triggers:
        - timed: '<%= @cron_schedule %>'
    publishers:
        - trigger-parameterized-builds:
            - project: Success_Passive_Check
              condition: 'SUCCESS'
              predefined-parameters: |
                  NSCA_CHECK_DESCRIPTION=<%= @service_description %>
                  NSCA_OUTPUT=<%= @service_description %> success
            - project: Failure_Passive_Check
              condition: 'FAILED'
              predefined-parameters: |
                  NSCA_CHECK_DESCRIPTION=<%= @service_description %>
                  NSCA_OUTPUT=<%= @service_description %> failed

---

- job:
    name: <%= @job_name %>
    display-name: <%= @job_name %>
    project-type: freestyle
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    builders:
      - trigger-builds:
          - project: run-rake-task
            block: true
            predefined-parameters: |
              TARGET_APPLICATION=rummager
              MACHINE_CLASS=search
              RAKE_TASK="analytics:create_data_import_csv[/data/export/enhanced_ecommerce]"
          - project: run-rake-task
            block: true
            predefined-parameters: |
              TARGET_APPLICATION=rummager
              MACHINE_CLASS=search
              RAKE_TASK="analytics:delete_old_files[/data/export/enhanced_ecommerce,10]"
    triggers:
        - timed: '<%= @cron_schedule %>'
    publishers:
        - trigger-parameterized-builds:
            - project: Success_Passive_Check
              condition: 'SUCCESS'
              predefined-parameters: |
                  NSCA_CHECK_DESCRIPTION=<%= @service_description %>
                  NSCA_OUTPUT=<%= @service_description %> success
            - project: Failure_Passive_Check
              condition: 'FAILED'
              predefined-parameters: |
                  NSCA_CHECK_DESCRIPTION=<%= @service_description %>
                  NSCA_OUTPUT=<%= @service_description %> failed

Fix exporting enhanced ecommerce data
Fix exporting enhanced ecommerce data

This task uses the Jenkins run-rake-task task. The analytics:create_data_import_csv
and analytics:create_data_import_csv have been modified to accept
parameters instead of environment variables.

See: git:
 - https://github.com/alphagov/rummager/pull/1317,
 - https://github.com/alphagov/govuk-puppet/pull/8301
