jenkins-pipelines/scripts/ostree-pull.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

48 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 REMOTE_BUILD_HOME
require_job_env REMOTE_SERVER
load_build_env
# Prepare the folder to receive the base ostree repository
DEPLOY_DIR="${BUILD_HOME}/localdisk/deploy"
# 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_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_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_BASE} "pull --depth=0 --mirror deb-build starlingx"
# Update ostree summary
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "summary --update"
notice "Pull done, ostree commit log"
ostree_cmd ${DRY_RUN_ARG} ${OSTREE_BASE} "log starlingx"
if ! $DRY_RUN ; then
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_BASE}"
fi