jenkins-pipelines/scripts/patch-make.sh
Dostoievski Batista 0cf05c13c6 Add patch signing to the pipeline
This change allows the user to select if he wants to sign the patch
using the SIGN_PATCH variable, when set to True it will automatically
add the "--remote-sign" option to the patch-builder script and export
the env variables, SIGNING_USER and SIGNING_SERVER, from the build.conf

Test plan:
    PASS: Run entire patch pipeline with SIGN_PATCH enable

Story: 2010676
Task: 51404

Change-Id: I7e895f30ea64a517a3555117250a4f00f8b6dfe1
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
2024-12-04 12:26:38 -03:00

46 lines
1.2 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
require_job_env SIGN_PATCH
load_build_env
# RECIPE_PATH indicate a path inside the builder container
RECIPE_PATH="\${MY_REPO_ROOT_DIR}/cgcs-root/patch-xml/${SW_VERSION}/${SW_VERSION}.${PATCH_NUM}.xml"
# Check if we are using a custom patch recipe
if [ ! -z "${CUSTOM_PATCH_RECIPE}" ]; then
RECIPE_PATH="${CUSTOM_PATCH_RECIPE}"
fi
# If custom name is provided add it to the parameters
EXTRA_ARGS=()
if [ ! -z "${PATCH_NAME}" ]; then
EXTRA_ARGS+=("--name ${PATCH_NAME}")
fi
# If patch needs to be signed by a remote signing server
ENV_VARIABLES=''
if [ ! -z "${SIGN_PATCH}" ]; then
# Variables usually set on build.conf
require_job_env SIGNING_SERVER
require_job_env SIGNING_USER
EXTRA_ARGS+=("--remote-sign")
ENV_VARIABLES="export SIGNING_SERVER=${SIGNING_SERVER};export SIGNING_USER=${SIGNING_USER};"
fi
# Build the patch
stx_docker_cmd $DRY_RUN_ARG "${ENV_VARIABLES}patch-builder --recipe ${RECIPE_PATH} ${EXTRA_ARGS[*]}"