aboutsummaryrefslogtreecommitdiff
path: root/lt-qcom/meta-qcom-tux.sh
blob: 2a1d92df80419e8e78d2d92ade21c0c5d8df6ac8 (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
#!/bin/bash

set -ex

# Get tuxsuite
virtualenv --python=$(which python3) .venv
source .venv/bin/activate
pip install tuxsuite
tuxsuite --version

# When testing a Github PR, use the appropriate ref
if [ "${ghprbPullId}" ]; then
    BRANCH="${ghprbTargetBranch}"
    REF="ref"
    QCOM="refs/pull/${ghprbPullId}/merge"

# otherwise it's a regular CI build
else
    REF="branch"
    QCOM="${BRANCH}"
fi

# Create Tux Job file
cat << EOF > tux.json
{
  "sources": {
    "git_trees": [
      {
        "url": "${POKY_URL}",
        "branch": "${BRANCH}"
      },
      {
        "url": "https://github.com/ndechesne/meta-qcom",
        "${REF}": "${QCOM}"
      }
    ]
  },
  "container": "ubuntu-20.04",
  "envsetup": "poky/oe-init-build-env",
  "distro": "${DISTRO}",
  "machine": "${MACHINE}",
  "target": "${IMAGES}",
  "bblayers_conf": [
    "BBLAYERS += '../meta-qcom/'"
  ],
  "artifacts": [
    "\$DEPLOY_DIR"
  ],
    "environment": {
  },
  "local_conf": [
    "INHERIT += 'buildstats buildstats-summary'",
    "TCLIBC := '${TCLIBC}'"
  ]
}
EOF

# Build, do not report tuxsuite return code, since we want to process json out
tuxsuite bake submit --json-out status.json tux.json || true

# cleanup virtualenv
deactivate

if [ ! -f status.json ]; then
    echo "tux suite failed, infrastructure error, status.json does not exist"
    exit 1
fi

uid=$(cat status.json | jq -r ".uid")
state=$(cat status.json | jq -r ".state")
result=$(cat status.json | jq -r ".result")

if [ "$state" != "finished" ]; then
    echo "tuxsuite failed, with an unexpected reason"
    exit 1
fi

wget https://oebuilds.tuxbuild.com/$uid/build.log
cat build.log

echo "TUXBUILD_URL=https://oebuilds.tuxbuild.com/$uid" > parameters

if [ "$result" != "pass" ]; then
    echo "tuxsuite build failed"
    exit 2
fi