3 # Copyright (C) 2022 Wind River Systems, Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Ensure we fail the job if any steps fail.
20 #########################################################################
22 #########################################################################
24 SCRIPTS_DIR=$(dirname $(readlink -f $0))
25 TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
27 #########################################################################
29 #########################################################################
34 This is a wrapper script to build both Yocto based and CentOS based images
35 with default options, and tend to be used by ORAN CI build only.
37 $(basename $0) [-w WORKSPACE_DIR] [-n] [-h]
39 -w WORKSPACE_DIR is the path for the project
40 -n dry-run only for bitbake
49 [ -n "$1" ] && msg_step=$1
50 echo "#########################################################################################"
51 echo "## STEP START: ${msg_step}"
52 echo "#########################################################################################"
56 [ -n "$1" ] && msg_step=$1
57 echo "#########################################################################################"
58 echo "## STEP END: ${msg_step}"
59 echo "#########################################################################################"
74 echo "CMD: ${RUN_CMD}"
78 #########################################################################
80 #########################################################################
85 while getopts "w:b:e:r:unh" OPTION; do
88 WORKSPACE=`readlink -f ${OPTARG}`
101 if [ -z ${WORKSPACE} ]; then
102 echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
103 WORKSPACE=`readlink -f workspace`
106 #########################################################################
107 # Functions for each step
108 #########################################################################
109 WORKSPACE_YP=${WORKSPACE}/workspace_yocto
110 WORKSPACE_CENTOS=${WORKSPACE}/workspace_centos
111 SCRIPT_YP=${SCRIPTS_DIR}/build_inf_yocto/build_inf_yocto.sh
112 SCRIPT_CENTOS=${SCRIPTS_DIR}/build_inf_centos/build_inf_centos.sh
113 SCRIPT_CENTOS_PRE=${SCRIPTS_DIR}/build_inf_centos/build_inf_prepare_jenkins.sh
115 prepare_workspace () {
116 msg_step="Create workspace for the multi-os builds"
119 mkdir -p ${WORKSPACE_YP} ${WORKSPACE_CENTOS}
121 echo_info "The following directories are created in your workspace(${WORKSPACE}):"
122 echo_info "For Yocto buid: ${WORKSPACE_YP}"
123 echo_info "For CentOS buid: ${WORKSPACE_CENTOS}"
128 # debug for CI Jenkins build
130 msg_step="Get debug info for CI Jenkins build"
133 echo_info "=== Get env ==="
135 echo_info "==============="
153 #########################################################################
155 #########################################################################
158 if [ "$CI" = "true" ]; then
162 # dry-run is not supported yet for CentOS build
163 if [ -z "${DRYRUN}" ]; then
164 ${SCRIPT_CENTOS} -w ${WORKSPACE_CENTOS} ${DRYRUN}
165 if [ "$CI" = "true" ]; then
166 ${SCRIPT_CENTOS_PRE} -w ${WORKSPACE_CENTOS}
170 ${SCRIPT_YP} -w ${WORKSPACE_YP} ${DRYRUN} ${YP_ARGS}