From f9fe9440a77baae6e05d2ac6796e19502fb4dc2e Mon Sep 17 00:00:00 2001 From: Jose Carlos Venegas Munoz Date: Thu, 4 Jul 2019 14:44:58 -0500 Subject: [PATCH] ci: cd: Use the same obs script for CD. We want to use the same script for both PRs and new package CD. Depending if CI is set a release push will be done or a ci. Fixes: #617 Signed-off-by: Jose Carlos Venegas Munoz --- .ci/packaging/request_to_obs.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.ci/packaging/request_to_obs.sh b/.ci/packaging/request_to_obs.sh index 4c7653947b..145f4dd1dc 100755 --- a/.ci/packaging/request_to_obs.sh +++ b/.ci/packaging/request_to_obs.sh @@ -14,7 +14,7 @@ set -o nounset set -o pipefail set -o errtrace -[ -z "${DEBUG:-}" ] || set -x +[ -z "${DEBUG:-}" ] || set -x readonly script_dir=$(dirname $(readlink -f "$0")) readonly packaging_dir="${script_dir}/../.." @@ -30,10 +30,9 @@ fi # Push to anywhere, variable used by release scripts to push PUSH=1 -# dont use release kata image -BUILD_HEAD=true +BUILD_HEAD=${BUILD_HEAD:-${CI:-}} -if [ "${CI:-}" == "true" ];then +if [ "${CI:-}" == "true" ]; then SUBPROJECT_TYPE="ci" else SUBPROJECT_TYPE="releases" @@ -55,13 +54,25 @@ echo "INFO: BUILD_HEAD=${BUILD_HEAD}" echo "INFO: BRANCH=${BRANCH}" echo "INFO: OBS_BRANCH=${OBS_SUBPROJECT}" echo "INFO: PUSH=${PUSH}" +echo "INFO: SUBPROJECT_TYPE=${SUBPROJECT_TYPE}" # Export in all pipeline tasks -cd "${packaging_dir}/obs-packaging" || exit 1 -echo "Building for head gen versions ..." -./gen_versions_txt.sh --head "${BRANCH}" +cd "${packaging_dir}/obs-packaging" || exit 1 +gen_versions_cmd="./gen_versions_txt.sh" +if [ "${BUILD_HEAD}" = "true" ]; then + echo "Building for head gen versions ..." + gen_versions_cmd+=" --head" +fi + +${gen_versions_cmd} "${BRANCH}" + # print versions just for debug/info cat versions.txt export NEW_VERSION=$(curl -s -L https://raw.githubusercontent.com/kata-containers/runtime/${BRANCH}/VERSION) -script -qefc bash -c './create-repo-branch.sh --ci ${OBS_BRANCH}' +create_repo_cmd="./create-repo-branch.sh" +if [ "${CI:-}" = "true" ]; then + create_repo_cmd+=" --ci" +fi +create_repo_cmd+=" ${OBS_BRANCH}" +script -qefc bash -c "${create_repo_cmd}" script -qefc bash -c './build_from_docker.sh ${NEW_VERSION}'