Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9495731

Browse files
committedOct 28, 2021
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 0e2c46c commit 9495731

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed
 

‎automation/jenkins_build.sh

+23-2
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,35 @@ else
158158
popd > /dev/null 2>&1
159159
fi
160160

161-
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -v "${buildFlavor}" -g "${BARYS_ARGUMENTS_VAR}"
161+
# Artifacts
162+
163+
# Build hostapp
164+
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -v "${buildFlavor}" -g "${BARYS_ARGUMENTS_VAR}" -b "-c image_docker" -i "balena-image"
162165

163166
image_path=$(find "${WORKSPACE}/build/tmp/work/" -name "balena-image-${MACHINE}*.docker" -type l)
164167
if [ -L "${_image_path}" ]; then
165168
echo "[ERROR]:balena_deploy_hostapp: No hostapp to release"
166169
exit 1
167170
fi
171+
balena_deploy_block "$(balena_lib_get_slug "${MACHINE}")" "${MACHINE}" "${_bootable:-1}" "${deploy}" "${image_path}"
172+
173+
# Build and release blocks
174+
if [ -n "${blocks}" ]; then
175+
[ "${deploy}" = "no" ] && _final=""
176+
"${automation_dir}/jenkins_build-blocks.sh" -d "${MACHINE}" -a "$(balena_lib_environment)" -b "${blocks}" -t "$(balena_lib_token)" -v "${buildFlavor}" -s "${JENKINS_PERSISTENT_WORKDIR}" "${_final:+"-p"}"
177+
fi
178+
179+
# Release hostos
180+
osapp="${MACHINE}-hostos"
181+
blocks_apps="${MACHINE}"
182+
for block in ${blocks}; do
183+
blocks_apps="${blocks_apps} ${MACHINE}-${block}"
184+
done
185+
balena_deploy_hostos "${osapp}" "${blocks_apps}" "${MACHINE}" "${deploy}"
186+
BARYS_ARGUMENTS_VAR="${BARYS_ARGUMENTS_VAR} -a HOSTOS_APPS=${osapp}"
187+
188+
# Build image
189+
"${automation_dir}"/../build/balena-build.sh -d "${MACHINE}" -s "${JENKINS_PERSISTENT_WORKDIR}" -a "$(balena_lib_environment)" -v "${buildFlavor}" -g "${BARYS_ARGUMENTS_VAR}"
168190

169191
if [ "$ENABLE_TESTS" = true ]; then
170192
# Run the test script in the device specific repository
@@ -186,7 +208,6 @@ if [ "$deploy" = "yes" ]; then
186208

187209
balena_deploy_to_s3 "$MACHINE" "${buildFlavor}" "${ESR}" "${deployTo}"
188210
balena_deploy_to_dockerhub "${MACHINE}"
189-
balena_deploy_block "$(balena_lib_get_slug "${MACHINE}")" "${MACHINE}" "${_bootable:-1}" "${deploy}" "${image_path}"
190211

191212
if [ "$AMI" = "true" ]; then
192213
echo "[INFO] Generating AMI"

0 commit comments

Comments
 (0)
Please sign in to comment.