aboutsummaryrefslogtreecommitdiff
path: root/tcwg-make-release-christophe.yaml
blob: 4a848982de4ad0088cf666b27a8c72fd5eb37c14 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# http://docs.openstack.org/infra/jenkins-job-builder/definition.html
- job:
    name: tcwg-make-release-christophe
    project-type: matrix
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 10
    parameters:
        - string:
            name: gcc_src
            default: 'gcc-linaro-5.3-2016.02.tar.xz'
            description: 'The source of GCC. Specify as it would be passed to abe.sh, either a source tarballs, git branch and revision, or a URL of a tarball e.g., "gcc-linaro-5.3-2016.02.tar.xz"'
        - string:
            name: binutils_src
            default: ''
            description: 'A optional revision of binutils to use for this release, e.g., "binutils-gdb.git~linaro_binutils-2_25-branch"'
        - string:
            name: glibc_src
            default: ''
            description: 'An optional revision of Glibc to use for this release, e.g., "glibc.git~linaro/2.21/master"'
        - string:
            name: date
            default: ''
            description: 'An optional release string to use, e.g., "2016.05", "2016.05-rc3", "2016.05-1", "2016.05-1-rc2". The default is to extract the release string from the gcc_src field'
        - string:
            name: manifest_src
            default: ''
            description: 'Import a manifest file to reproduce a release'
        - string:
            name: toolchain_config
            default: 'default'
            description: 'Toolchain version config, e.g., "default", "gcc5", or "gcc6"'
        - string:
            name: target_list
            default: 'aarch64-elf aarch64-linux-gnu aarch64_be-elf aarch64_be-linux-gnu armv8l-linux-gnueabihf arm-eabi arm-linux-gnueabi arm-linux-gnueabihf armeb-eabi armeb-linux-gnueabi armeb-linux-gnueabihf'
            description: 'List of targets to use'
        - string:
            name: abe_branch
            default: refs/heads/master
            description: 'ABE revision to test'
        - string:
            name: scripts_branch
            default: master
            description: 'Scripts revision to use'
        - choice:
            name: debug
            choices:
                - none
                - abe
                - yaml
            description: "Level of debug information: none - No debugging information, abe - ABE debugging information, yaml - tcwg-make-release.yaml debug information (and exit)."
        - string:
            name: fileserver
            default: dev-01.tcwglab
            description: 'Remote file server for logs and binaries'
        - bool:
            name: testrelease
            default: 'true'
            description: 'Run test-release if make-release is successful'
        - string:
            name: binariesdir
            default: ''
            description: 'Upload dir for binaries on fileserver'
        - string:
            name: logsdir
            default: ''
            description: 'Upload dir for logs on fileserver'
    disabled: false
    node: tcwg-x86_64-ex40build-01
    retry-count: 3
    concurrent: true
    display-name: 'TCWG Make Release Christophe'
    scm:
        - git:
            url: https://git-us.linaro.org/toolchain/abe.git
            refspec: +refs/changes/*:refs/remotes/changes/*
            branches:
                - ${abe_branch}
            skip-tag: true
            shallow-clone: true
            basedir: abe
    axes:
        - axis:
            type: slave
            name: label
            values:
               - docker-trusty-amd64-tcwg-build
               - docker-trusty-i386-tcwg-build
        - axis:
            type: dynamic
            name: target
            values:
                - target_list
    execution-strategy:
        sequential: false
    wrappers:
        - timeout:
            timeout: 300
        - timestamps
        - ssh-agent-credentials:
            users:
              - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a' # tcwg-buildslave
        - build-name:
            name: '#${BUILD_NUMBER}-${ENV,var="date"}-${ENV,var="target"}'
    builders:
      - shell: |
            #!/bin/bash

            if test x"${debug}" = x"abe"; then
              shell="/bin/bash -x"
              set -x
            else
                shell="/bin/bash"
            fi

            if test x"${debug}" = x"yaml"; then
                echo WORKSPACE:  $WORKSPACE
                echo CURRENTDIR: `pwd`
                ls -lR
                exit 0
            fi

            git config --global user.email "tcwg-buildslave@linaro.org"
            git config --global user.name "TCWG BuildSlave"

            tcwg_release=${date}
            # If there is no date set, extract release information from the gcc_src
            if test "${date:+set}" != "set"; then
                tcwg_release="`basename $gcc_src | cut -d '-' -f4-`"
                tcwg_release=${tcwg_release%".tar.xz"}
            fi

            # This job always uses Canadian cross builds and builds 2
            # toolchains at a time when run on a amd64 slave.
            # When run on a i386 host, no need to duplicate the
            # Canadian cross build for mingw.
            case ${label} in
              docker-*-amd64-tcwg*)
                host=x86_64
                export canadian=true ;;
              docker-*-i386-tcwg*)
                host=i686
                export canadian=no ;;
             *)
                echo "ERROR: unsupported label: ${label}"
                exit 1
                ;;
            esac
            git clone -b $scripts_branch --depth 1 https://git-us.linaro.org/toolchain/jenkins-scripts

            ${shell} ${WORKSPACE}/jenkins-scripts/MakeRelease.job --abedir ${WORKSPACE}/abe --target ${target}${tcwg_release:+ --date ${tcwg_release}} --fileserver ${fileserver} --toolchainconfig ${toolchain_config} --binariesdir ${binariesdir}/${target} --logsdir ${logsdir}/${target}
            if test $? -gt 0; then
              exit 1
            fi

            # We always build a Linux tarball, even in canadian cross mode
            tarball_linux="`find ${WORKSPACE} -name gcc-linaro\*${tcwg_release}\*${target}\*.tar.xz | grep -v mingw`"
            if test x"${tarball_linux}" = x""; then
              echo "ERROR: no binary Linux tarball found!"
              exit 1
            fi

            if test x"${canadian}" = x"true"; then
              tarball_mingw="`find ${WORKSPACE} -name gcc-linaro\*${tcwg_release}\*${target}\*.tar.xz | grep mingw`"
              if test x"${tarball_mingw}" = x""; then
                echo "ERROR: no binary MingW tarball found!"
                exit 1
              fi
            fi

            # FIXME. MakeRelease copies to a directory, while
            # TestRelease downloads from a URL, so both dirs differ
            # depending on httpd's DocumentRoot
            # All this can be removed once test-release is started
            # after make-release has completed.
            case ${binariesdir} in
              releases/binaries/*)
                url_prefix=$(echo '~tcwg-buildslave/'${binariesdir})
                ;;
              *)
                echo Unsupported binariesdir: ${binariesdir}. Fix the job.
                ;;
            esac

            if $testrelease; then
              tarball_linux="`basename ${tarball_linux}`"
              tarball_linux_url="http://${fileserver}/${url_prefix}/${target}/${tarball_linux}"
              cat << EOF > tcwg.params.linux
            tarball_url=${tarball_linux_url}
            release=${tcwg_release}
            target=${host}-${target}
            EOF

              if test x"${canadian}" = x"true"; then
                tarball_mingw="`basename ${tarball_mingw}`"
                tarball_mingw_url="http://${fileserver}/${url_prefix}/${target}/${tarball_mingw}"
                cat << EOF > tcwg.params.mingw
            tarball_url=${tarball_mingw_url}
            release=${tcwg_release}
            target=mingw-${target}
            EOF
              fi
            fi

      - conditional-step:
          condition-kind: file-exists
          condition-filename: tcwg.params.linux
          steps:
              - trigger-builds:
                  - project: 'tcwg-test-release'
                    property-file: tcwg.params.linux
                    current-parameters: true
                    block: false
      - conditional-step:
          condition-kind: file-exists
          condition-filename: tcwg.params.mingw
          steps:
              - trigger-builds:
                  - project: 'tcwg-test-release'
                    property-file: tcwg.params.mingw
                    current-parameters: true
                    block: false
    publishers:
        - archive:
            artifacts: 'MakeRelease*.log.xz'
            latest-only: false
        - email:
            recipients: 'christophe.lyon@linaro.org'
        - email-ext:
            recipients: 'christophe.lyon@linaro.org'
            always: true
            send-to:
              requester
              recipients