- job:
    name: jdk14-update-src-tree-persist
    project-type: freestyle
    defaults: global
    description: |
        This jobs writes the current jdk14 src tree to /work/openjdk-testing/jdk14/openjdk-jtreg-nightly-tests/...<br>
        It is used to report failure/errors against the jtreg results.
    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: YEAR
            default: 'default'
        - string:
            name: DAY_OF_YEAR
            default: 'default'
    disabled: true
    node: j12-qrep-01
    display-name: 'DELETE ME'
    wrappers:
        - workspace-cleanup:
            dirmatch: false
        - timestamps
    builders:
        - copyartifact:
            project: jdk14-update-src-tree
            filter: 'out/*'
            target: incoming
            flatten: true
        - shell: |
            #!/bin/bash

            set -exu

            : ${YEAR:=$(date +%Y)}
            : ${DAY_OF_YEAR:=$(date +%j)}
            PERSIST=$HOME/srv/openjdk14

            TOP_DIR=$PERSIST/openjdk-jtreg-nightly-tests
            src_dir=$TOP_DIR/src/$YEAR/$DAY_OF_YEAR
            mkdir -p $src_dir
            echo "Extracting tarball to $src_dir"
            tar -C $src_dir --strip-components=1 -xf $WORKSPACE/incoming/jdk14.tar.gz

            # Copy bill-of-materials to persistent area for email report.
            cp incoming/BOM $TOP_DIR
