---
- scm:
    name: smokey_Smokey
    scm:
      - git:
          url: git@github.com:alphagov/smokey.git
          branches: [master]

- job:
    name: Smokey
    description: Task to run the smoke tests after each deploy.
    display-name: Smokey
    project-type: freestyle
    scm:
      - smokey_Smokey
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    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
    builders:
      - shell: |
          set +x
          export TARGET_PLATFORM=<%= @environment %>
          set -x
          ./jenkins.sh
    wrappers:
      - ansicolor:
          colormap: xterm

---
- scm:
    name: smokey_Smokey
    scm:
      - git:
          url: git@github.com:alphagov/smokey.git
          branches: [master]

- job:
    name: Smokey
    description: Task to run the smoke tests after each deploy.
    display-name: Smokey
    project-type: freestyle
    scm:
      - smokey_Smokey
    properties:
      - build-discarder:
          days-to-keep: 30
          artifact-num-to-keep: 5
    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
    parameters:
      - string:
          name: TARGET_APPLICATION
          description: Application to target (optional).
    builders:
      - shell: |
          set +x
          export TARGET_PLATFORM=<%= @environment %>
          set -x
          ./jenkins.sh
    wrappers:
      - ansicolor:
          colormap: xterm

Support running only app-specific scenarios
Support running only app-specific scenarios

This adds an optional string parameter that will be used by the
'jenkins.sh' script in Smokey to only run scenarios with a tag
that matches, noting that many scenarios are not relevant to a
given app. We need this feature to support Continuous Deployment,
so that deploys are not blocked by unrelated failures. The name
'TARGET_APPLICATION' makes this job triggerable by 'Deploy_App',
since the parameter names match.
