aboutsummaryrefslogtreecommitdiff
path: root/jdk8-jtreg-test-publish-results.yaml
blob: a75952846fb474fd7d3c7d480e3f63e36ab5f297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
- job:
    name: jdk8-jtreg-test-publish-results
    project-type: freestyle
    defaults: global
    description: |
        * Results are published to http://openjdk.linaro.org/openjdk8-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: ''
    disabled: false
    node: aarch64-06
    display-name: 'OpenJDK 8 - Publish jtreg results'
    wrappers:
        - timestamps
        - ssh-agent-credentials:
            # openjdk-testing user id
            users:
                - '744cffb4-9ce1-4856-b103-9fdda06dad36'
        - credentials-binding:
            - text:
                credential-id: OPENJDK_KEY
                variable: PRIVATE_KEY
    builders:
        - copyartifact:
            project: jtreg-build
            filter: 'jtreg-build-4.2.0-SNAPSHOT.tar.xz'
            flatten: true
        - shell: |
            #!/bin/bash

            set -ex

            # Start ssh-agent workaround
            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
                kill -9 ${SSH_AGENT_PID}
            }

            TMPKEYDIR=$(mktemp -d /tmp/sct.XXXXXX)
            cat > ${TMPKEYDIR}/private-key-wrapper.py << EOF
            #!/usr/bin/python

            import os
            import sys

            def main():
                private_key = os.environ.get("PRIVATE_KEY", "Undefined")
                if private_key == "Undefined":
                    sys.exit("PRIVATE_KEY is not defined.")

                buffer = private_key.replace(' ','\n')
                with open('linaro-private-key', 'w') as f:
                    f.write('-----BEGIN RSA PRIVATE KEY-----\n')
                    f.write(buffer)
                    f.write('\n-----END RSA PRIVATE KEY-----\n')

            if __name__ == "__main__":
                main()
            EOF
            python ${TMPKEYDIR}/private-key-wrapper.py
            chmod 0600 ${WORKSPACE}/linaro-private-key

            eval `ssh-agent` >/dev/null 2>/dev/null
            ssh-add ${WORKSPACE}/linaro-private-key >/dev/null 2>/dev/null
            rm -rf ${WORKSPACE}/linaro-private-key ${TMPKEYDIR}

            test -d ~/.ssh || mkdir ~/.ssh
            ssh-keyscan people.linaro.org >> ~/.ssh/known_hosts
            LANG=C sort -u ~/.ssh/known_hosts | sponge ~/.ssh/known_hosts
            cat << EOF >> ~/.ssh/config
            Host people.linaro.org
                User stuart.monteith
            EOF
            chmod 0600 ~/.ssh/*

            # End workload

            PERSIST=$HOME/srv/openjdk
            SCRIPT_DIR=$PERSIST/openjdk-test-scripts
            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/openjdk8-jtreg-nightly-tests bash -x $SCRIPT_DIR/publish $PUBLISH_DEST
    publishers:
        - email:
            recipients: 'fathi.boudra@linaro.org stuart.monteith@linaro.org'