aboutsummaryrefslogtreecommitdiff
path: root/lt-socionext-m8m.yaml
blob: 6523e511c815b4f7c45d91a4d6b85d2c12b083b5 (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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
- job:
    name: lt-socionext-m8m
    project-type: matrix
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            linaro:
                - job-read
    parameters:
        - password:
            name: PRIVATE_KEY
            default: ${LT_SOCIONEXT_PRIVATE_KEY}
        - string:
            name: BUNDLE_STREAM_NAME
            default: '/private/team/socionext/m8m/'
        - string:
            name: LAVA_SERVER
            default: 'validation.linaro.org/RPC2/'
    disabled: false
    node: master
    child-workspace: .
    display-name: 'LT Socionext - M8M'
    triggers:
        - timed: '@daily'
    axes:
        - axis:
            type: user-defined
            name: GIT_BRANCH
            values:
                - mainline-basis
                - snlt-v3.18
        - axis:
            type: slave
            name: label
            values:
                - docker-utopic
    execution-strategy:
        sequential: true
    wrappers:
        - timestamps
        - matrix-tie-parent:
            node: master
    builders:
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            set -e

            trap cleanup_exit INT TERM EXIT

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

            sudo apt-get update
            sudo apt-get install -y python-pycurl qemu-utils

            TMPKEYDIR=$(mktemp -d /tmp/m8m.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 socionext.git.linaro.org >> ~/.ssh/known_hosts
            cat << EOF >> ~/.ssh/config
            Host socionext.git.linaro.org
                User linaro-landing-team-socionext-bot
            EOF
            chmod 0600 ~/.ssh/*

            git clone -b ${GIT_BRANCH} --depth 1 ssh://socionext.git.linaro.org/srv/landing-teams.git.linaro.org/socionext/linux.git ${WORKSPACE}

            export make_deb=false
            export make_install=true
            export kernel_flavour=lt-m8m
            export kernel_config=m8m_defconfig
            export MAKE_DTBS=true
            export tcbindir="${HOME}/srv/toolchain/arm-tc-15.02/bin"
            export toolchain_url="http://releases.linaro.org/15.02/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf.tar.xz"

            git clone --depth 1 https://git.linaro.org/git/ci/lci-build-tools.git lci-build-tools
            bash lci-build-tools/jenkins_kernel_build_inst

            curl http://snapshots.linaro.org/openembedded/images/m8m/latest/core-image-base-m8m-*.rootfs.tar.bz2 -o core-image-base-m8m.tar.bz2
            TARGZFILE=core-image-base-m8m.tar.bz2
            IMGFILE=core-image-base-m8m.img

            qemu-img create -f raw ${IMGFILE} 1G
            DEVICE=$(sudo losetup --find --show ${IMGFILE})

            echo "I: Create filesystem"
            sudo mkfs.ext4 -L m8m -O ^has_journal ${DEVICE}

            echo "I: Tune filesystem"
            sudo tune2fs -c 0 -i 0 ${DEVICE}

            echo "I: Mount device on local filesystem"
            MOUNTDIR=$(mktemp -d /tmp/m8m.XXXXXX)
            sudo mount ${DEVICE} ${MOUNTDIR}

            sudo tar -jxf ${TARGZFILE} -C ${MOUNTDIR} --numeric-owner

            sudo mount -t proc proc ${MOUNTDIR}/proc

            KERNEL_PATH=$(find ${WORKSPACE} -maxdepth 1 -type d -name 'builddir-*-linaro-lt-m8m')
            sudo make O=${KERNEL_PATH} INSTALL_MOD_PATH=${MOUNTDIR}/lib/modules modules_install
            sudo cp -a out/zImage ${MOUNTDIR}/boot/Image-nolpae
            sudo cp -a out/dtbs/mb86s27eb.dtb ${MOUNTDIR}/boot/
            sudo find ${MOUNTDIR}/lib/modules -type l -delete

            sudo umount -l ${MOUNTDIR}/proc || true
            sudo umount ${DEVICE}
            rm -rf ${MOUNTDIR}
            sudo losetup --detach ${DEVICE}

            gzip -9 ${IMGFILE}
            mv ${IMGFILE}.gz out/

            # Publish
            PUB_DEST=openembedded/pre-built/lt-socionext/m8m/mainline/${BUILD_NUMBER}
            [ "${GIT_BRANCH}" = "snlt-v3.18" ] && PUB_DEST=openembedded/pre-built/lt-socionext/m8m/v3.18/${BUILD_NUMBER}

            cat > out/BUILD-INFO.txt << EOF
            Format-Version: 0.5

            Files-Pattern: *
            License-Type: protected
            Auth-Groups: linaro-landing-team-socionext-git
            EOF

            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 \
              --link-latest \
              --build-info out/BUILD-INFO.txt \
              out ${PUB_DEST}
        - shell: |
            #!/bin/bash

            set -e

            # Cleanup any sensitive files
            git clean -fdx
            rm -rf ${WORKSPACE}/* ${WORKSPACE}/.git*
    publishers:
        - email:
            recipients: 'fathi.boudra@linaro.org'