aboutsummaryrefslogtreecommitdiff
path: root/tcwg-gcc-release-automation.yaml
blob: c442ad2ac4c63c934e4030e3001844f812cbf00d (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
- job:
    name: tcwg-gcc-release-automation
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 10
            num-to-keep: 10
    parameters:
        - choice:
            name: tag_kind
            choices:
                - snapshot
                - candidate
                - release
            description: 'Type of release to do.'
        - string:
            name: spin
            default: ''
            description: 'Spin number'
        - string:
            name: gcc_ref
            default: ''
            description: 'GCC tag or branch name (like linaro-6.3-2017.03, linaro/gcc-6-branch)'
        - string:
            name: date
            default: ''
            description: 'snapshot or release date (yyyy.mm)'
        - string:
            name: abe_branch
            default: 'refs/heads/master'
            description: 'ABE branch to use.'
    disabled: false
    node: tcwg-x86_64-dev-01
    concurrent: true
    display-name: 'TCWG GCC Release Automation'
    scm:
        - git:
            url: https://git-us.linaro.org/toolchain/gcc.git
            refspec: +refs/heads/*:refs/remotes/origin/*
            branches:
                - refs/heads/master
            basedir: gcc_src
            per-build-tag: false
            wipe-workspace: false
            reference-repo: /home/tcwg-buildslave/snapshots-ref/gcc.git
            clean:
                before: true
        - git:
            url: https://git-us.linaro.org/toolchain/tcwg-release-tools
            refspec: +refs/heads/*:refs/remotes/origin/*
            branches:
                - refs/heads/automation
            basedir: tcwg-release-tools
            per-build-tag: false
            wipe-workspace: false
            clean:
                before: true
    execution-strategy:
        sequential: true
    wrappers:
        - timeout:
            timeout: 300
        - timestamps
        - ssh-agent-credentials:
            # tcwg-buildslave user id
            users:
                - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
        - build-name:
            name: '#${BUILD_NUMBER}-${ENV,var="tag"}'
    builders:
        - shell: |
            #!/bin/bash
            set -ex

            pushd gcc_src

            # Git/Gerrit config
            git config --local user.name "TCWG Automation"
            git config --local user.email linaro-toolchain@lists.linaro.org
            if git remote | grep -q gerrit; then
              git remote rm gerrit
            fi
            git remote add gerrit ssh://tcwg-buildslave@review.linaro.org:29418/toolchain/gcc
            git remote update

            FLAGS="-t $gcc_ref -e gerrit"
            [ "${spin:+set}" = "set" ] && FLAGS+=" $spin"
            [ "${date:+set}" = "set" ] && FLAGS+=" -d $date"

            case "$tag_kind" in
                snapshot)  FLAGS+=" -S" ; dir_suffix="-snap";;
                candidate) FLAGS+=" -r" ;;
                release)   FLAGS+=" -R" ;;
                *) echo "ERROR: tag_king is missing"; exit 1 ;;
            esac

            ${WORKSPACE}/tcwg-release-tools/tcwg-release-tag.sh $FLAGS

            # Pick up the created tag.
            tag=$(git describe --abbrev=0)

            case ${tag} in
              *-4\.*) toolchainconf="gcc4_9" ;;
              *-5\.*) toolchainconf="gcc5" ;;
              *-6\.*) toolchainconf="gcc6" ;;
              *-7\.*) toolchainconf="gcc7" ;;
              *) echo "ERROR: Bad tag: ${tag}"; exit 1 ;;
            esac

            # Remove linaro-[snapshot-] prefix
            upload_dir=${tag#*ro-}
            upload_dir="/home/tcwg-buildslave/releases/sources/${upload_dir#*ot-}$dir_suffix"

            popd 1>/dev/null

            cat << EOF > ${WORKSPACE}/buildfarm_parameters
            override=gcc=gcc.git~$tag --extraconfigdir ../config/$toolchainconf
            log_name=${JOB_NAME}-${tag}-${BUILD_NUMBER}/\${builder_type}.\$target
            abe_branch=$abe_branch
            EOF

            cat << EOF > ${WORKSPACE}/env.properties
            tag=$tag
            toolchainconf=$toolchainconf
            upload_dir=$upload_dir
            EOF
        - trigger-builds:
            - project: tcwg-buildfarm
              property-file: buildfarm_parameters
              block: true
        - inject:
            properties-file: ${WORKSPACE}/env.properties
        - shell: |
            #!/bin/bash
            set -ex

            pushd /home/tcwg-buildslave/logs/${JOB_NAME}-${tag}-${BUILD_NUMBER}

            mkdir -p $upload_dir
            for i in * ; do
                cp ${i}/gcc-linaro-*-manifest.txt ${upload_dir}/${i}-gcc-${tag}-manifest.txt
            done

            popd 1>/dev/null
        - trigger-builds:
            - project: tcwg-make-source-tarball
              property-file: ${WORKSPACE}/env.properties
              block: true
            - project: tcwg-make-and-test-release
              property-file: ${WORKSPACE}/env.properties
              predefined-parameters: |
                  gcc_src=gcc.git~$tag
                  toolchain_config=$toolchainconf
                  abe_branch=$abe_branch
              block: true
    publishers:
        - email:
            recipients: 'yvan.roux@linaro.org'
        - workspace-cleanup:
            clean-if:
                - success: true
                - unstable: false
                - failure: false
                - aborted: false
                - not-built: false