aboutsummaryrefslogtreecommitdiff
path: root/96boards-reference-kernel-enterprise.yaml
blob: d848b84f3565ffc5791633cc6c1f8a6080ae0b85 (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
- job:
    name: 96boards-reference-kernel-enterprise
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
                - job-workspace
            linaro:
                - job-read
                - job-extended-read
                - job-build
                - job-configure
                - job-cancel
    parameters:
        - string:
            name: KERNEL_GIT_BRANCH
            default: '96b/2015.12'
        - string:
            name: KERNEL_GIT_URL
            default: 'https://git.linaro.org/people/amit.kucheria/kernel.git'
        - string:
            name: TARGET_REPO
            default: 'linaro-staging'
    disabled: false
    node: docker-jessie-amd64
    display-name: '96boards - Reference Component Enterprise - Linux Kernel'
    wrappers:
        - timestamps
        - build-name:
            name: '#${BUILD_NUMBER}'
    builders:
        - linaro-publish-token:
            host: builds.96boards.org
        - shell: |
            #!/bin/bash

            set -ex

            sudo apt-get update
            sudo apt-get install -y ccache python-pycurl quilt cpio rsync

            # Checkout source code
            git clone -b ${KERNEL_GIT_BRANCH} ${KERNEL_GIT_URL} linux
            git clone --depth 1 https://git.linaro.org/ci/debian-kernel-packaging.git debian-pkg

            # Export the kernel packaging version
            cd linux

            kernel_version=`make kernelversion`
            export KERNEL_GIT_VERSION=`git log --format="%H" -1`
            export KDEB_PKGVERSION="${kernel_version}-${BUILD_NUMBER}"
            git tag v${kernel_version}

            cd ..

            # Build the source kernel
            cd debian-pkg
            cat << EOF > debian/changelog
            linux ($KDEB_PKGVERSION) jessie; urgency=medium

              * Auto build:
                - URL: ${KERNEL_GIT_URL}
                - Branch: ${KERNEL_GIT_BRANCH}
                - Hash: ${KERNEL_GIT_VERSION}

             -- Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>  `date "+%a, %d %b %Y %T %z"`

            EOF

            # Use the kernel config from the kernel tree
            cp ../linux/arch/arm64/configs/distro.config debian/config/arm64/config

            debian/rules clean || true
            debian/bin/genorig.py ../linux
            debian/rules orig
            fakeroot debian/rules source
            debuild -S -uc -us
            cd ..

            cat > ${WORKSPACE}/build-package-params <<EOF
            source=${BUILD_URL}/artifact/$(echo *.dsc)
            repo=${TARGET_REPO}
            codename=jessie
            EOF

            # Final preparation for publishing
            mkdir out
            rm *.orig.tar.xz
            cp orig/*.orig.tar.xz ${WORKSPACE}/
            cp -a *.dsc *.changes *.debian.tar.xz *.orig.tar.xz out/

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

            # Build information
            cat > out/README.textile << EOF

            h4. 96Boards - Reference Component Enterprise - Kernel

            Linux Kernel build consumed by the 96Boards Reference Platform Enterprise Builds

            Build Description:
            * Build URL: "$BUILD_URL":$BUILD_URL
            * Git tree: "$KERNEL_GIT_URL":$KERNEL_GIT_URL
            * Git branch: $KERNEL_GIT_BRANCH
            * Git hash: $KERNEL_GIT_VERSION
            * Kernel version: $kernel_version
            * Kernel deb version: $KDEB_PKGVERSION
            EOF

            # 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 snapshots/reference-platform/components/linux/enterprise/${BUILD_NUMBER}/
    publishers:
        - archive:
            artifacts: '*.dsc, *.xz'
        - trigger-parameterized-builds:
            - project: build-package
              property-file: build-package-params
              condition: SUCCESS
        - email:
            recipients: 'ricardo.salveti@linaro.org'