---
- job:
    name: trigger_data_sync_complete
    display-name: trigger_data_sync_complete
    project-type: freestyle
    description: "This job triggers the Data_Sync_Complete jobs on a remote Jenkins machine"
    logrotate:
        numToKeep: 10
    properties:
        - build-discarder:
            days-to-keep: 30
            artifact-num-to-keep: 5
    builders:
        - shell: |
            echo "Getting crumb..."
            CRUMB=$(curl https://ci_alphagov:$API_KEY@$HOSTNAME/crumbIssuer/api/json | jq --raw-output '. | .crumb')

            echo "Triggering post-sync job on $HOSTNAME"
            curl -f -H "Jenkins-Crumb:$CRUMB" -XPOST https://$API_USER:$API_KEY@$HOSTNAME/job/Data_Sync_Complete/build --data-urlencode json="{}"
    wrappers:
        - ansicolor:
            colormap: xterm
    parameters:
        - string:
            name: API_USER
            description: 'The remote API user'
            default: false
        - password:
            name: API_KEY
            description: 'The remote API key'
            default: false
        - string:
            name: HOSTNAME
            description: 'The hostname of the Jenkins instance to trigger the Data_Sync_Complete job on'
            default: false

---
- job:
    name: trigger_data_sync_complete
    display-name: trigger_data_sync_complete
    project-type: freestyle
    description: "This job triggers the Data_Sync_Complete jobs on a remote Jenkins machine"
    logrotate:
        numToKeep: 10
    properties:
        - build-discarder:
            days-to-keep: 30
            artifact-num-to-keep: 5
    builders:
        - shell: |
            echo "Getting crumb..."
            CRUMB=$(curl https://$API_USER:$API_USER_PASSWORD@$HOSTNAME/crumbIssuer/api/json | jq --raw-output '. | .crumb')

            echo "Triggering post-sync job on $HOSTNAME"
            curl -f -H "Jenkins-Crumb:$CRUMB" -XPOST https://$API_USER:$API_USER_PASSWORD@$HOSTNAME/job/Data_Sync_Complete/build --data-urlencode json="{}"
    wrappers:
        - ansicolor:
            colormap: xterm
    parameters:
        - string:
            name: API_USER
            description: 'The remote API user'
            default: false
        - password:
            name: API_USER_PASSWORD
            description: 'The remote API key'
            default: false
        - string:
            name: HOSTNAME
            description: 'The hostname of the Jenkins instance to trigger the Data_Sync_Complete job on'
            default: false

Fix broken params for trigger sync complete job
Fix broken params for trigger sync complete job
