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

set -ex

# Create clean workspace
rm -rf tuxoe && mkdir tuxoe && cd tuxoe

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

[ "${DISTRO}" = "poky" ] && IMAGES+=" ${IMAGES_poky}"

# Create Tux Job file
cat << EOF > tux.json
{
  "sources": {
    "git_trees": [
      {
        "url": "${POKY_URL}",
        "branch": "${GIT_BRANCH#origin/}",
        "sha" : "${GIT_COMMIT}"
      }
    ]
  },
  "container": "ubuntu-20.04",
  "envsetup": "poky/oe-init-build-env",
  "distro": "${DISTRO}",
  "machine": "${MACHINE}",
  "target": "${IMAGES}",
  "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

url=$(cat status.json | jq -r ".download_url")
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 $url/build.log
cat build.log

echo "TUXBUILD_URL=$url" > ${WORKSPACE}/parameters

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