aboutsummaryrefslogtreecommitdiff
path: root/lkft-aosp-master-cts-vts.yaml
blob: ab4077b80169d20a68f08548e6a64f1c342f4d55 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
- job:
    name: lkft-aosp-master-cts-vts
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 60
        numToKeep: 60
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
    disabled: true
    node: docker-xenial-aosp
    display-name: 'LKFT AOSP Master CTS/VTS builds'
    concurrent: true
    triggers:
        - timed : 'H 0 * * *'
    wrappers:
        - timestamps
        - timeout:
            timeout: 900
        - credentials-binding:
            - text:
                credential-id: ARTIFACTORIAL_TOKEN
                variable: ARTIFACTORIAL_TOKEN
    builders:
        - shell: |
            #!/bin/bash

            export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

            java -version

            sudo apt-get update
            sudo apt-get install -y gcc-4.9-multilib bison git gperf libxml2-utils python-mako zip time python-requests genisoimage patch mtools python-pip pxz libssl-dev

            wget -q http://mirrors.kernel.org/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb \
              http://mirrors.kernel.org/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb \
              http://mirrors.kernel.org/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
            sudo dpkg -i --force-all *.deb

            mkdir -p ${HOME}/bin ${WORKSPACE}/build/out
            curl https://storage.googleapis.com/git-repo-downloads/repo > ${HOME}/bin/repo
            chmod a+x ${HOME}/bin/*
            export PATH=${HOME}/bin:${PATH}

            DIR_SRV_AOSP_MASTER="/home/buildslave/srv/aosp-master"
            if [ ! -d "${DIR_SRV_AOSP_MASTER}" ]; then
              sudo mkdir -p "${DIR_SRV_AOSP_MASTER}"
              sudo chmod 777 "${DIR_SRV_AOSP_MASTER}"
            fi
            cd "${DIR_SRV_AOSP_MASTER}"

            git config --global user.email "ci_notify@linaro.org"
            git config --global user.name "Linaro CI"

            # Runs as ubuntu
            set -xe
            rm -rf .repo/manifests* .repo/local_manifests build-tools jenkins-tools build-configs
            git clone --depth 1 https://git.linaro.org/infrastructure/linaro-android-build-tools.git build-tools
            git clone --depth 1 https://git.linaro.org/infrastructure/linaro-jenkins-tools.git jenkins-tools
            git clone --depth 1 http://android-git.linaro.org/git/android-build-configs.git build-configs

            ANDROID_ROOT="${DIR_SRV_AOSP_MASTER}/build"
            DIR_PUB_SRC="${ANDROID_ROOT}/out"

            # clean the out directory as this workspace is used accross multiple builds
            rm -fr ${DIR_SRV_AOSP_MASTER}/.repo-backup
            if [ -d "${ANDROID_ROOT}/.repo" ]; then
                mv -f ${ANDROID_ROOT}/.repo ${DIR_SRV_AOSP_MASTER}/.repo-backup
            fi
            rm -fr ${ANDROID_ROOT}/ && mkdir -p ${ANDROID_ROOT}
            if [ -d "${DIR_SRV_AOSP_MASTER}/.repo-backup" ]; then
                mv -f ${DIR_SRV_AOSP_MASTER}/.repo-backup ${ANDROID_ROOT}/.repo
            fi

            # build cts/vts under ${ANDROID_ROOT}
            cd ${ANDROID_ROOT}
            for f_build_config in aosp-master-cts aosp-master-vts; do
                export BUILD_CONFIG_FILENAME="${f_build_config}"

                # Early test
                if [ ! -f ${DIR_SRV_AOSP_MASTER}/build-configs/${BUILD_CONFIG_FILENAME} ]; then
                  echo "No config file named ${BUILD_CONFIG_FILENAME} exists"
                  echo "in android-build-configs.git"
                  exit 1
                fi

                # Build Android CTS/VTS
                ${DIR_SRV_AOSP_MASTER}/build-configs/linaro-build.sh -c ${BUILD_CONFIG_FILENAME}

                [ -f ${DIR_PUB_SRC}/host/linux-x86/vts/android-vts.zip ] && mv -fv ${DIR_PUB_SRC}/host/linux-x86/vts/android-vts.zip ${DIR_PUB_SRC}/
                [ -f ${DIR_PUB_SRC}/host/linux-x86/cts/android-cts.zip ] && mv -fv ${DIR_PUB_SRC}/host/linux-x86/cts/android-cts.zip ${DIR_PUB_SRC}/
            done

            rm -rf ${DIR_PUB_SRC}/host/
            rm -rf ${DIR_PUB_SRC}/BUILD-INFO.txt
            wget https://git.linaro.org/ci/job/configs.git/blob_plain/HEAD:/android-lcr/hikey/build-info/aosp-master-template.txt -O ${DIR_PUB_SRC}/BUILD-INFO.txt

            cp -a ${ANDROID_ROOT}/out/pinned-manifest/*-pinned-manifest.xml ${ANDROID_ROOT}/out
            cp -a ${ANDROID_ROOT}/out/pinned-manifest/*-pinned-manifest.xml ${WORKSPACE}/ || true
            cp -a ${DIR_PUB_SRC}/*.xml ${DIR_PUB_SRC}/*.json ${WORKSPACE}/ || true

            # Publish parameters
            cat << EOF > ${WORKSPACE}/publish_parameters
            PUB_DEST=android/lkft/lkft-aosp-master-cts-vts/${BUILD_NUMBER}
            PUB_SRC=${DIR_PUB_SRC}
            PUB_EXTRA_INC=^[^/]+\.(dtb|dtbo|zip)$|MLO|vmlinux|System.map
            EOF
        - inject:
            properties-file: publish_parameters
        - linaro-publish-token
        - shell:
            !include-raw:
                - android/linaro-publisher.sh
        - shell: |
            #!/bin/bash -e
            export PUB_DEST=android/lkft/lkft-aosp-master-cts-vts/${BUILD_NUMBER}
            export VTS_URL=http://snapshots.linaro.org/${PUB_DEST}
            export CTS_URL=http://snapshots.linaro.org/${PUB_DEST}

            echo "VTS_URL=${VTS_URL}" > cts_vts_url_parameters
            echo "CTS_URL=${CTS_URL}" >> cts_vts_url_parameters
            cat cts_vts_url_parameters
    publishers:
        - trigger-parameterized-builds:
            - project:
                - 'lkft-aosp-master-x15'
              condition: SUCCESS
              property-file: cts_vts_url_parameters
        - archive:
            artifacts: '*.xml,*.json'
            latest-only: true
        - logparser:
            parse-rules: '/var/jenkins_home/userContent/android.parse'
            unstable-on-warning: false
            fail-on-error: false
        - fingerprint:
            files: 'build/fingerprints/*'
        - email:
            recipients: 'tom.gall@linaro.org yongqin.liu@linaro.org'