aboutsummaryrefslogtreecommitdiff
path: root/trigger-lt-qcom-openembedded-images.yaml
blob: ba23ce3abbe8d924b03fe5469bea0b42b4da3760 (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
- job:
    name: trigger-lt-qcom-openembedded-images
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
        - build-discarder:
            days-to-keep: 1
            num-to-keep: 30
            artifact-num-to-keep: 30
    parameters:
        - string:
            name: FORCE_TRIGGER
            default: ''
    disabled: false
    node: master
    display-name: 'Trigger for Qualcomm OE builds'
    triggers:
        - timed: 'H/5 * * * *'
    wrappers:
        - timestamps
    builders:
        - shell: |
            #!/bin/bash

            set -e

            GIT_BRANCH="refs/heads/morty"
            git ls-remote --heads https://github.com/openembedded/openembedded-core ${GIT_BRANCH} > git-polling.txt
            git ls-remote --heads https://github.com/openembedded/meta-openembedded ${GIT_BRANCH} >> git-polling.txt
            git ls-remote --heads https://github.com/ndechesne/meta-qcom  ${GIT_BRANCH} >> git-polling.txt
            git ls-remote --heads https://github.com/96boards/meta-rpb ${GIT_BRANCH} >> git-polling.txt
            git ls-remote --heads https://git.linaro.org/openembedded/meta-backports ${GIT_BRANCH} >> git-polling.txt

            rm -f git-changes-detected
            # Check the file existence
            if wget -q --spider "${JOB_URL}lastSuccessfulBuild/artifact/git-polling.txt"; then
              # Download the file
              wget -q "${JOB_URL}lastSuccessfulBuild/artifact/git-polling.txt" -O git-polling-latest.txt
              # Compare latest git polling with current
              cmp -s git-polling-latest.txt git-polling.txt || touch git-changes-detected
            else
              echo "Remote file does not exist. Skip comparison and trigger."
            fi

            # Allow to force manually the build
            [ -z "${FORCE_TRIGGER}" ] || touch git-changes-detected
        - conditional-step:
            condition-kind: file-exists
            condition-filename: git-changes-detected
            steps:
                - trigger-builds:
                    - project: 'lt-qcom-openembedded-rpb-morty'
    publishers:
        - archive:
            artifacts: 'git-polling.txt'