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
|
#!/bin/bash
set -ex
# install jflog client tool, v1, used for publishing artifacts
(mkdir -p $HOME/bin && cd $HOME/bin && curl -fL https://getcli.jfrog.io | sh)
# Get tuxsuite
virtualenv --python=$(which python3) .venv
source .venv/bin/activate
pip install tuxsuite
tuxsuite --version
[ "${DISTRO}" = "rpb" ] && IMAGES+=" ${IMAGES_RPB}"
[ "${DISTRO}" = "rpb-wayland" ] && IMAGES+=" ${IMAGES_RPB_WAYLAND}"
# These machines only build the basic rpb-console-image
case "${MACHINE}" in
am57xx-evm|intel-core2-32|intel-corei7-64)
IMAGES="rpb-console-image"
;;
esac
# Default value for BB_OVERRIDE is set to new syntax
if [ -z "${BB_OVERRIDE}" ]; then
BB_OVERRIDE=':'
fi
# Create Tux Job file
cat << EOF > tux.json
{
"sources": {
"repo": {
"url": "${MANIFEST_URL}",
"branch": "${MANIFEST_BRANCH}",
"manifest": "default.xml"
}
},
"container": "ubuntu-20.04",
"envsetup": "setup-environment",
"distro": "${DISTRO}",
"machine": "${MACHINE}",
"target": "${IMAGES}",
"artifacts": [
"\$DEPLOY_DIR"
],
"environment": {
},
"local_conf": [
"INHERIT += 'buildstats buildstats-summary'",
"INHERIT${BB_OVERRIDE}remove = 'rm_work'",
"IMAGE_NAME${BB_OVERRIDE}append = '-${BUILD_NUMBER}'",
"KERNEL_IMAGE_NAME${BB_OVERRIDE}append = '-${BUILD_NUMBER}'",
"MODULE_TARBALL_NAME${BB_OVERRIDE}append = '-${BUILD_NUMBER}'",
"DT_IMAGE_BASE_NAME${BB_OVERRIDE}append = '-${BUILD_NUMBER}'",
"BOOT_IMAGE_BASE_NAME${BB_OVERRIDE}append = '-${BUILD_NUMBER}'"
]
}
EOF
# Process top level job extra local.conf
# This jq script will take the main JSON file and merge local_conf data
if [ -f "${WORKSPACE}/local.conf.json" ]; then
cp tux.json tux.orig.json
jq 'reduce inputs.local_conf as $s (.; .local_conf += $s)' tux.orig.json "${WORKSPACE}/local.conf.json" > tux.json
fi
# 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
# Prepare files to publish, if needed
if [ -z "${PUBLISH_SERVER}" ]; then
exit 0
fi
DEPLOY_DIR_IMAGE=${PWD}/deploy_dir_images
echo "DEPLOY_DIR_IMAGE=${DEPLOY_DIR_IMAGE}" >> parameters
# files to download
wget https://oebuilds.tuxbuild.com/$uid/?export=json -O root.json
wget https://oebuilds.tuxbuild.com/$uid/images/${MACHINE}/?export=json -O images.json
mkdir ${DEPLOY_DIR_IMAGE} && pushd ${DEPLOY_DIR_IMAGE}
for j in ${WORKSPACE}/root.json ${WORKSPACE}/images.json; do
for f in $(cat $j | jq -r .files[].Url); do
wget $f
done
done
popd
# Create MD5SUMS file
find ${DEPLOY_DIR_IMAGE} -type f | xargs md5sum > MD5SUMS.txt
sed -i "s|${DEPLOY_DIR_IMAGE}/||" MD5SUMS.txt
mv MD5SUMS.txt ${DEPLOY_DIR_IMAGE}
|