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>
This commit is contained in:
Dostoievski Batista 2024-12-03 17:17:17 -03:00
parent 0cf05c13c6
commit 0215b0dcbc
4 changed files with 24 additions and 25 deletions

@ -43,12 +43,6 @@ pipeline {
booleanParam(
name: 'DRY_RUN'
)
string(
name: 'REMOTE_SERVER'
)
string(
name: 'REMOTE_BUILD_HOME'
)
string(
name: 'BUILD_HOME'
)

@ -179,6 +179,11 @@ pipeline {
defaultValue: true,
description: 'Send patch to be signed by signing server.'
)
booleanParam(
name: 'PATCH_BUILD',
defaultValue: true,
description: 'Flag that enable --reuse_maximum when build-packages. Meant to be used together with PKG_REUSE.'
)
string(
name: 'SW_VERSION',
description: 'Version of the build being used. e.g., XX.YY'
@ -284,8 +289,10 @@ or with paths relative to repo root:
}
steps {
// build and publish packages
runPart("build-packages",[ booleanParam (name: 'PATCH_BUILD', value: true) ])
runPart("build-packages")
runPart("publish-packages")
// build iso
runPart ("build-iso")
}
}
stage('PATCH:prepare') {

@ -15,32 +15,33 @@ require_job_env REMOTE_SERVER
load_build_env
# run the patch prepare step
# Prepare the folder to receive the ostree repository
# Prepare the folder to receive the base ostree repository
DEPLOY_DIR="${BUILD_HOME}/localdisk/deploy"
OSTREE_REPO="ostree_repo"
REMOTE_BUILD_OSTREE=${REMOTE_BUILD_HOME}/localdisk/deploy/${OSTREE_REPO}
# Name of the folder where we will copy the remote repository
OSTREE_BASE="ostree_base"
# Full path to the remote ostree repository
REMOTE_BUILD_OSTREE=${REMOTE_BUILD_HOME}/localdisk/deploy/ostree_repo
mkdir -p "${DEPLOY_DIR}" && cd "$_"
# Init ostree repo
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_REPO} "init --mode=archive-z2"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "init --mode=archive-z2"
notice "Pulling content from remote ostree ${REMOTE_SERVER}/${REMOTE_BUILD_HOME}"
# Add build as remote
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_REPO} "remote add --set=gpg-verify=false deb-build \
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "remote add --set=gpg-verify=false deb-build \
${REMOTE_SERVER}/${REMOTE_BUILD_OSTREE} starlingx"
# Pull only the latest commit
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_REPO} "pull --depth=0 --mirror deb-build starlingx"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "pull --depth=0 --mirror deb-build starlingx"
# Update ostree summary
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_REPO} "summary --update"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "summary --update"
notice "Pull done, ostree commit log"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_REPO} "log starlingx"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "log starlingx"
if ! $DRY_RUN ; then
notice "Fixing ostree_repo permissions"
notice "Fixing ${OSTREE_BASE} permissions"
OSTREE_USER=`stat -c %u ${REMOTE_BUILD_OSTREE}`
OSTREE_GROUP=`stat -c %g ${REMOTE_BUILD_OSTREE}`
notice "Changing ostree permission to match source, user: ${OSTREE_USER}, group: ${OSTREE_GROUP}"
docker run --rm --volume "${BUILD_HOME}:${BUILD_HOME}" debian:bullseye chown -R "${OSTREE_USER}:${OSTREE_GROUP}" "${DEPLOY_DIR}/${OSTREE_REPO}"
docker run --rm --volume "${BUILD_HOME}:${BUILD_HOME}" debian:bullseye chown -R "${OSTREE_USER}:${OSTREE_GROUP}" "${DEPLOY_DIR}/${OSTREE_BASE}"
fi

@ -17,8 +17,6 @@ load_build_env
require_job_env SIGNING_SERVER
require_job_env SIGNING_USER
require_job_env REMOTE_BUILD_HOME
require_job_env REMOTE_SERVER
require_job_env BUILD_HOME
declare_job_env MY_REPO "$REPO_ROOT/cgcs-root"
@ -33,14 +31,13 @@ PATCHES_LIST=$(find $FULL_PATH_PATCH_OUTPUT -type f -name "*.patch" -printf '%f\
# 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 collect the iso from the remote build home to be used as base
REMOTE_ISO="${REMOTE_SERVER}/${REMOTE_BUILD_HOME}/localdisk/deploy/starlingx-intel-x86-64-cd.iso"
curl -L ${REMOTE_ISO} --output ${BUILD_HOME}/localdisk/starlingx-base.iso
ISO_BASE="/localdisk/starlingx-base.iso"
# 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} \
${PATCHES_FLAG[*]} -o /localdisk/deploy/${PREPATCHED_NAME}"
-b /localdisk/deploy/ostree_base \
${PATCHES_FLAG[*]} -o /localdisk/deploy/${PREPATCHED_NAME}"
if ! $DRY_RUN ; then
(