aboutsummaryrefslogtreecommitdiff
path: root/openembedded-armv7a-m8m.yaml
blob: 7f306c94e3c36e9e6317938f22dd3b34a094fb9b (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
- job:
    name: openembedded-armv7a-m8m
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            linaro:
                - job-read
    parameters:
        - password:
            name: PRIVATE_KEY
            default: ${PRIVATE_KEY}
        - string:
            name: MACHINE
            default: 'm8m'
        - string:
            name: DISTRO
            default: 'poky'
    disabled: true
    node: docker-utopic-amd64
    display-name: 'OpenEmbedded - Socionext M8M (ARMv7-A)'
    triggers:
        - timed: '@weekly'
    wrappers:
        - timestamps
    builders:
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            set -e

            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
              cd ${WORKSPACE}
              rm -rf build/tmp/deploy/images/m8m
              kill -9 ${SSH_AGENT_PID}
            }

            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 chrpath gawk texinfo libsdl1.2-dev  
            
            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 dizzy --depth 1 ssh://socionext.git.linaro.org/srv/landing-teams.git.linaro.org/socionext/poky.git ${WORKSPACE}

            # Build
            source oe-init-build-env
            echo "BBLAYERS += \" ${WORKSPACE}/meta-openembedded/meta-oe\"" >> conf/bblayers.conf
            echo "BBLAYERS += \" ${WORKSPACE}/meta-openembedded/meta-filesystems\"" >> conf/bblayers.conf
            echo "BBLAYERS_NON_REMOVABLE += \" ${WORKSPACE}/meta-oe\"" >> conf/bblayers.conf
            bitbake core-image-base

            # Publish
            rm -f ${WORKSPACE}/build/tmp/deploy/images/m8m/*.txt
            find ${WORKSPACE}/build/tmp/deploy/images/m8m -type l -delete
            cat > ${WORKSPACE}/build/tmp/deploy/images/m8m/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 \
              --api_version 3 \
              --link-latest \
              --build-info ${WORKSPACE}/build/tmp/deploy/images/m8m/BUILD-INFO.txt \
              ${WORKSPACE}/build/tmp/deploy/images/m8m openembedded/images/m8m/${BUILD_NUMBER}
        - shell: |
            #!/bin/bash

            set -e

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