aboutsummaryrefslogtreecommitdiff
path: root/schneider-openembedded-test-notify.yaml
blob: 47e003b677fd78ddf278f8e6355677effd36e2ad (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
- job:
    name: schneider-openembedded-test-notify
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
                - job-workspace
            everyone-flat:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 30
    disabled: false
    node: master
    concurrent: false
    display-name: 'Schneider OpenEmbedded Test Notify'
    wrappers:
        - timeout:
            timeout: 60
        - timestamps
        - ssh-agent-credentials:
            users:
                - '768c1ba1-6052-4b97-a531-7e4fabda6979'
        - credentials-binding:
            - text:
                credential-id: QA_REPORTS_TOKEN
                variable: QA_REPORTS_TOKEN
    builders:
        - shell: |
            #!/bin/bash

            set -ex
            pwd
            echo "Get previous"
            wget -nv -O last.cve https://snapshots.linaro.org//openembedded/schneider/linaro-warrior-4.19/rzn1d/latest/dip/dip-image-rzn1-snarc.rootfs.cve
            echo "Get baseline"
            wget -nv -O base.cve https://releases.linaro.org/members/schneider/openembedded/2019.09-warrior.2/rzn1d-4.19/dip-image-rzn1-snarc-linaro-rel-2019.09-warrior.2-internal-70.rootfs.cve
    publishers:
        - postbuildscript:
            builders:
                - role: MASTER
                  build-on:
                    - SUCCESS
                  build-steps:
                    - shell: |
                        echo "Combining CVEs"
                        #sort -u ${JENKINS_HOME}/jobs/${JOB_NAME}/configurations/axis-DISTRO/dip/axis-MACHINE/*/axis-label/docker-stretch-amd64/builds/${BUILD_NUMBER}/archive/cve-*.txt > cve.txt
                        sort -u ${JENKINS_HOME}/jobs/schneider-openembedded-warrior-4.19-rfs/configurations/axis-DISTRO/dip/axis-MACHINE/*/axis-label/docker-stretch-amd64/builds/31/archive/cve-*.txt > cve.txt
                        cat cve.txt
                        echo "HTMLify CVEs"
                        perl -F'\t' -lane '($type, $cve, $pkg, $url, @rest) = @F; push @{$foo{$type}}, ("<a href=\"$url\">$cve</a> $pkg" . list(@rest)); sub list { return @_ ? join("", "<ul>\n", map("<li>$_</li>\n", @_), "</ul>") : ""} ; END { foreach (reverse sort keys %foo) { print "<b>$_ CVEs</b>", list(@{$foo{$_}}) if @{$foo{$_}} }}' cve.txt > cve.html
                        echo "Summarize CVEs"
                        printf "NEW=%d CHANGED=%d FIXED=%d\n" `grep NEW cve.txt|wc -l` >cve.sum

        - groovy-postbuild:
            script:
                !include-raw:
                  - schneider-openembedded/postbuild.groovy
        - email-ext:
            # Send custom email generated in jenkins job
            recipients: 'ralph.siemsen@linaro.org'
            subject: 'Schneider OpenEmbedded Test Notify'
            body: |
                $DEFAULT_CONTENT

                CVE summary: ${FILE,path="cve.sum"}
            attachments: "cve.html"
            success: true
        - email:
             recipients: 'ralph.siemsen@linaro.org'