---
- job:
    name: speedcurve-lux-js-version-check
    display-name: SpeedCurve LUX JS version check
    project-type: freestyle
    description: 'Job to verify that GOV.UK is using the current JS version of Speedcurve LUX'
    logrotate:
      numToKeep: 100
    triggers:
      - timed: |
          TZ=Europe/London
          H 10,16 * * *
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    builders:
      - shell: |
          #!/usr/bin/env bash
          set -e

          # we grep against the version GOV.UK is currently using in
          # https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js
          curl -s https://cdn.speedcurve.com/js/lux.js\?id\=47044334 | grep 't="216"'
    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
    wrappers:
      - ansicolor:
          colormap: xterm

---
- job:
    name: speedcurve-lux-js-version-check
    display-name: SpeedCurve LUX JS version check
    project-type: freestyle
    description: 'Job to verify that GOV.UK is using the current JS version of Speedcurve LUX'
    logrotate:
      numToKeep: 100
    triggers:
      - timed: |
          TZ=Europe/London
          H 10,16 * * *
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    builders:
      - shell: |
          #!/usr/bin/env bash
          set -e

          # we grep against the version GOV.UK is currently using in
          # https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js
          curl -s https://cdn.speedcurve.com/js/lux.js\?id\=47044334 | grep 'V="301"'
    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
    wrappers:
      - ansicolor:
          colormap: xterm

Update LUX check to use latest version number
Update LUX check to use latest version number