aboutsummaryrefslogtreecommitdiff
path: root/tcwg-publish-snapshot.yaml
blob: 3545b87581e626fee690a25205069c070b40e115 (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
- job:
    name: tcwg-publish-snapshot
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 30
    parameters:
        - string:
                name: snapshot_version
                default: ''
                description: 'Snapshot revision to deploy (like: 5.2-2015.10, 5.2-2015.11-rc1)'
        - string:
                name: buildnum
                default: ''
                description: 'Build number to deploy, empty for latest'
        - bool:
               name: binaries
               default: false
               description: 'Publish binaries'
        - string:
                name: notes_branch
                default: 'toolchain-snapshots'
                description: 'Release notes branch name or sha1, e.g., releases/linaro-6.2-2016.11-rc2'
        - bool:
               name: notes_only
               default: false
               description: 'Publish release notes only'
    disabled: false
    node: tcwg-x86_64-dev-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##*-}

            # Append suffix for snapshots
            if [[ "$version_suffix" != rc* ]]; then
              ldir="${snapshot_version}-snap"
            else
              ldir="${snapshot_version}"
            fi

            # Common parts
            dest_dir="components/toolchain/"
            cp_content="-r $HOME/releases/"

            # Paths slightly differ between binaries and sources
            if ${binaries}; then
              dest_dir+="binaries"
              notes_path="${dest_dir}"
              # Append build number if provided, choose the latest otherwise
              if test x"${buildnum}" != x; then
                ldir+="-${buildnum}"
              else
                pushd $HOME/releases/binaries/
                ldir=`ls -d ${ldir}* | tail -n 1`
                popd
              fi
              cp_content+="binaries/${ldir}/*"
            else
              dest_dir+="gcc-linaro"
              [ $gcc_major -ge 5 ] && gcc_version=$gcc_major
              notes_path+="${dest_dir}/${gcc_version}"
              cp_content+="sources/${ldir}/*"
            fi

            mkdir -p out

            # Release notes
            notes_url=https://git.linaro.org/toolchain/release-notes.git/plain/
            wget ${notes_url}${notes_path}/README.textile?h=${notes_branch} -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/plain/linaro-cp.py -O ${HOME}/bin/linaro-cp.py
            time python ${HOME}/bin/linaro-cp.py \
              --api_version 3 \
              out ${dest_dir}/${snapshot_version}/
    publishers:
        - email-ext:
            recipients: 'bernhard.rosenkranzer@linaro.org, fathi.boudra@linaro.org, koen.kooi@linaro.org'
            always: true