- job:
    name: jdk14-jtreg-test-publish-results
    project-type: freestyle
    defaults: global
    description: |
        * Results are published to http://openjdk.linaro.org/jdk14/openjdk-jtreg-nightly-tests/
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            openjdk-members:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 10
            artifact-num-to-keep: 5
    parameters:
        - string:
            name: PUBLISH_DEST
            default: ''
        - string:
            name: PUBLISH_HOST
            default: ''
        - string:
            name: YEAR
            default: 'default'
        - string:
            name: DAY_OF_YEAR
            default: 'default'
    disabled: true
    node: j12-qrep-01
    display-name: 'DELETE ME'
    wrappers:
        - timestamps
        - ssh-agent-credentials:
            users:
                - '744cffb4-9ce1-4856-b103-9fdda06dad36'
    builders:
        - copyartifact:
            project: jtreg-build
            filter: 'jtreg-build-4.2.0-SNAPSHOT.tar.xz'
            flatten: true
        - shell: |
            #!/bin/bash

            set -ex

            PERSIST=$HOME/srv/openjdk14
            SCRIPT_DIR=$PERSIST/openjdk-test-scripts
            export JDK_VERSION=14

            (unset PRIVATE_KEY; env | sort  >$WORKSPACE/env.out)
            tree -fd -L 5 $PERSIST | xz >$WORKSPACE/tree.out.xz

            if [ -d $SCRIPT_DIR ]; then
                (cd $SCRIPT_DIR; git pull)
            else
                git clone https://git.linaro.org/leg/openjdk/openjdk-test-scripts.git $SCRIPT_DIR
            fi

            tar xf jtreg-build-4.2.0-SNAPSHOT.tar.xz
            export PATH=${WORKSPACE}/jtreg/bin:$PATH
            which jtdiff
            TOP_DIR=$PERSIST/openjdk-jtreg-nightly-tests bash -x $SCRIPT_DIR/publish $PUBLISH_DEST $NODE_NAME
    publishers:
        - archive:
            artifacts: 'tree.out.xz, env.out'
        - email:
            recipients: 'fathi.boudra@linaro.org stuart.monteith@linaro.org'
