Skip to content

Commit 7a2f826

Browse files
committed
jenkins_build.sh: Add building and deployment of blocks
If blocks are defined in the job, build and deploy them. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
1 parent e3bb459 commit 7a2f826

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

automation/jenkins_build.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,34 @@ else
143143
popd > /dev/null 2>&1
144144
fi
145145

146-
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -g "${BARYS_ARGUMENTS_VAR}"
146+
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -g "${BARYS_ARGUMENTS_VAR}" -b "-c image_docker" -i "balena-image"
147147
# Do not check for artifacts as when discontinuing device types build artifacts are not created, but device-type.json needs to be deployed to mark the device as discontinued
148148

149+
image_path=$(find "${WORKSPACE}/build/tmp/work/" -name "balena-image-${MACHINE}*.docker" -type l)
150+
if [ -L "${_image_path}" ]; then
151+
echo "[ERROR]:balena_deploy_hostapp: No hostapp to release"
152+
exit 1
153+
fi
154+
balena_deploy_block "$(balena_lib_get_slug "${MACHINE}")" "${MACHINE}" "${_bootable:-1}" "${deploy}" "${image_path}"
155+
156+
# Build and release blocks
157+
if [ -n "${blocks}" ]; then
158+
[ "${deploy}" = "no" ] && _final=""
159+
"${automation_dir}/jenkins_build-blocks.sh" -d "${MACHINE}" -a "$(balena_lib_environment)" -b "${blocks}" -t "$(balena_lib_token)" -s "${JENKINS_PERSISTENT_WORKDIR}" "${_final:+"-p"}"
160+
fi
161+
162+
# Release hostos
163+
osapp="${MACHINE}-hostos"
164+
blocks_apps="${MACHINE}"
165+
for block in ${blocks}; do
166+
blocks_apps="${blocks_apps} ${MACHINE}-${block}"
167+
done
168+
balena_deploy_hostos "${osapp}" "${blocks_apps}" "${MACHINE}" "${deploy}"
169+
BARYS_ARGUMENTS_VAR="${BARYS_ARGUMENTS_VAR} -a HOSTOS_APPS=${osapp}"
170+
171+
# Build image
172+
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -g "${BARYS_ARGUMENTS_VAR}"
173+
149174
if [ "$ENABLE_TESTS" = true ]; then
150175
# Run the test script in the device specific repository
151176
if [ -f "$WORKSPACE/tests/start.sh" ]; then

0 commit comments

Comments
 (0)