jenkins-pipelines/scripts/patch-iso.sh
Dostoievski Batista 0215b0dcbc Change ISO and ostree used by the patch-iso step
This change adds the stage build-iso to the patch pipeline, change the
ISO used by the create-prepatched-iso script and specify the ostree
repository to be use as base.

Test plan:
    PASS: Run complete patch pipeline with success

Depends-On: https://review.opendev.org/c/starlingx/root/+/936975
Closes-Bug: 2090871

Change-Id: Ia0b47fb9a18e4747c4983e09b144691d27c173e2
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
2024-12-06 15:37:20 -03:00

51 lines
1.6 KiB
Bash

#!/bin/bash
#
# Copyright (c) 2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
source $(dirname "$0")/lib/job_utils.sh
require_job_env BUILD_HOME
require_job_env SW_VERSION
require_job_env PATCH_NUM
load_build_env
require_job_env SIGNING_SERVER
require_job_env SIGNING_USER
require_job_env BUILD_HOME
declare_job_env MY_REPO "$REPO_ROOT/cgcs-root"
declare_job_env PATCH_PREVIOUS_NAME "${PATCH_PREVIOUS:1}"
PREPATCHED_NAME="prepatched-iso-${SW_VERSION}.${PATCH_NUM}.iso"
DEFAULT_PATCH_OUTPUT="/localdisk/deploy/patch_output/"
# Collect every patches from the default patch output path
FULL_PATH_PATCH_OUTPUT="${BUILD_HOME}${DEFAULT_PATCH_OUTPUT}"
PATCHES_LIST=$(find $FULL_PATH_PATCH_OUTPUT -type f -name "*.patch" -printf '%f\n' | sort)
# Prepare the patches list to be used in lat container, adding -p prefix and the path
PATCHES_FLAG=$(printf '%s\n' ${PATCHES_LIST[*]} | xargs -I {} echo "-p ${DEFAULT_PATCH_OUTPUT}{}")
# We use the iso generated by build-iso step
ISO_BASE="/localdisk/deploy/starlingx-intel-x86-64-cd.iso"
# Create pre-patched ISO
stx_docker_cmd ${DRY_RUN_ARG} "--container=lat" "create-prepatched-iso -i ${ISO_BASE} \
-b /localdisk/deploy/ostree_base \
${PATCHES_FLAG[*]} -o /localdisk/deploy/${PREPATCHED_NAME}"
if ! $DRY_RUN ; then
(
export MY_WORKSPACE=$WORKSPACE_ROOT
export PATH=$MY_REPO/build-tools:$PATH:/usr/local/bin
PREPATCHED_PATH="${BUILD_HOME}/localdisk/deploy/${PREPATCHED_NAME}"
maybe_run sign_iso_formal.sh "${PREPATCHED_PATH}" || die "failed to sign ISO"
)
notice "Formal signing done"
fi