aboutsummaryrefslogtreecommitdiff
path: root/lt-qcom-db410c-bootloader.yaml
blob: 78eb3eb3da80dc588a102ef3c70d12659f5271f2 (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
- job:
    name: lt-qcom-db410c-bootloader
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            linaro-landing-team-qualcomm-personnel:
                - job-read
                - job-build
                - job-cancel
    parameters:
        - password:
            name: PRIVATE_KEY
            default: ${LT_QUALCOMM_PRIVATE_KEY}
        - string:
            name: BRANCH
            default: 'master'
    disabled: false
    node: docker-utopic-amd64
    display-name: 'Qualcomm bootloader for DragonBoard 410c'
    wrappers:
        - timestamps
    builders:
        - linaro-publish-token:
            host: builds.96boards.org
        - shell: |
            #!/bin/bash

            set -e

            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
              cd ${WORKSPACE}
              kill -9 ${SSH_AGENT_PID}
              rm -rf out*
            }

            sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
            sudo apt-get update
            sudo apt-get install -y python-pycurl zip

            TMPKEYDIR=$(mktemp -d /tmp/qcom.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}

            mkdir ~/.ssh
            ssh-keyscan dev-private-git.linaro.org >> ~/.ssh/known_hosts
            cat << EOF >> ~/.ssh/config
            Host dev-private-git.linaro.org
                User git
            EOF
            chmod 0600 ~/.ssh/*

            git clone --depth 1 -b ${BRANCH} ssh://dev-private-git.linaro.org/landing-teams/working/qualcomm/db410c_bootloader.git ${WORKSPACE}
            # record commit info in build log
            git log -1

            ./build sdcard_rescue_image bootloader_linux bootloader_android

            # add license.txt file
            wget https://git.linaro.org/landing-teams/working/qualcomm/lt-docs.git/blob_plain/HEAD:/license/license.txt
            cp license.txt out/dragonboard410c_sdcard_rescue
            cp license.txt out/dragonboard410c_bootloader_emmc_linux
            cp license.txt out/dragonboard410c_bootloader_emmc_android

            # Final preparation of archives for publishing
            mkdir out-rescue
            zip -rj out-rescue/dragonboard410c_sdcard_rescue-${BUILD_NUMBER}.zip out/dragonboard410c_sdcard_rescue
            zip -rj out-rescue/dragonboard410c_bootloader_emmc_linux-${BUILD_NUMBER}.zip out/dragonboard410c_bootloader_emmc_linux
            zip -rj out-rescue/dragonboard410c_bootloader_emmc_android-${BUILD_NUMBER}.zip out/dragonboard410c_bootloader_emmc_android

            # Create MD5SUMS file
            (cd out-rescue && md5sum * > MD5SUMS.txt)

            # Publish
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget -q https://git.linaro.org/ci/publishing-api.git/blob_plain/HEAD:/linaro-cp.py -O ${HOME}/bin/linaro-cp.py
            time python ${HOME}/bin/linaro-cp.py \
              --server ${PUBLISH_SERVER} \
              --link-latest \
              out-rescue snapshots/dragonboard410c/linaro/rescue/${BUILD_NUMBER}
        - shell: |
            #!/bin/bash

            set -e

            # Cleanup any sensitive files
            git clean -fdx
            rm -rf ${WORKSPACE}/* ${WORKSPACE}/.git*
    publishers:
        - email:
            recipients: 'nicolas.dechesne@linaro.org fathi.boudra@linaro.org'
        - ircbot:
            channels:
                - name: '#linaro-lt-qcomm'
                  password: ${LT_QCOM_KEY}