aboutsummaryrefslogtreecommitdiff
path: root/tcwg-publish-snapshot.yaml
blob: 0bae98a3a226ed3eafcf53bf5e689efa19af1035 (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
- job:
    name: tcwg-publish-snapshot
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
    parameters:
        - string:
                name: snapshot_version
                default: ''
                description: 'Snapshot revision to deploy (like: 5.2-2015.10, 5.2-2015.11-rc1)'
        - bool:
               name: binaries
               default: false
               description: 'Publish binaries'
        - string:
                name: notes_branch
                default: 'refs/heads/toolchain-snapshots'
                description: 'Release notes branch name or sha1'
        - bool:
               name: notes_only
               default: false
               description: 'Publish release notes only'
    disabled: false
    node: tcwg-x86_64-ex40build-01
    display-name: 'TCWG source or binaries tarball publishing on snapshot.linaro.org'
    wrappers:
        - timestamps
    builders:
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            set -ex

            trap cleanup_exit INT TERM EXIT

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

            # Extract GCC version, and other needed mangling information
            # Since GCC 5 our branch name only contains GCC major number.
            gcc_version=${snapshot_version%%-*}
            gcc_major=${gcc_version%%.*}
            version_suffix=${snapshot_version##*-}
            bin_dir=${snapshot_version#*-}
            dest_dir="components/toolchain/"
            prefix="gcc-linaro"

            if [[ "$version_suffix" != rc* ]]; then
              prefix+="-snapshot"
              bin_dir="snapshot-$bin_dir"
            fi

            [ $gcc_major -ge "5" ] && gcc_version=$gcc_major

            if ${binaries}; then
              dest_dir+="binaries"
              notes_path="/${dest_dir}"
              cp_content="-r /work/space/binaries/${bin_dir}/*"
            else
              dest_dir+="gcc-linaro"
              notes_path="/${dest_dir}/${gcc_version}"
              cp_content="/work/space/sources/${prefix}-${snapshot_version}.tar.*"
            fi

            mkdir -p out

            # Release notes
            notes_url=https://git.linaro.org/toolchain/release-notes.git/blob_plain/${notes_branch}
            wget ${notes_url}:${notes_path}/README.textile -O out/README.textile

            if ! ${notes_only}; then
              cp ${cp_content} out/
            fi

            # Publish to snapshots
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget 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 \
              out ${dest_dir}/${snapshot_version}/
    publishers:
        - email-ext:
            recipients: 'bernhard.rosenkranzer@linaro.org, fathi.boudra@linaro.org, koen.kooi@linaro.org'
            always: true