---
- job:
    name: Publishing_API_Archive_Events
    display-name: Publishing_API_Archive_Events
    project-type: freestyle
    description: "This job periodically archives publishing API events to S3"
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    builders:
      - shell: ssh deploy@$(govuk_node_list -c publishing_api --single-node) "cd /var/apps/publishing-api && govuk_setenv publishing-api bundle exec rake events:export_to_s3"
    logrotate:
      numToKeep: 10
    triggers:
        - timed: |
            TZ=Europe/London
            H 5 * * 0
    publishers:
        - email:
            recipients: 2nd-line-support@digital.cabinet-office.gov.uk
            send-to-individuals: true

---
- job:
    name: Publishing_API_Archive_Events
    display-name: Publishing_API_Archive_Events
    project-type: freestyle
    description: "This job periodically archives publishing API events to S3"
    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=publishing-api
              MACHINE_CLASS=publishing_api
              RAKE_TASK=events:export_to_s3
    logrotate:
      numToKeep: 10
    triggers:
        - timed: |
            TZ=Europe/London
            H 5 * * 0
    publishers:
        - email:
            recipients: 2nd-line-support@digital.cabinet-office.gov.uk
            send-to-individuals: true

Use run-rake-task in Publishing_API_Archive_Events job
Use run-rake-task in Publishing_API_Archive_Events job
