diff --git a/RELEASE.sh b/RELEASE.sh index 90f5ac34e..1526ead5d 100755 --- a/RELEASE.sh +++ b/RELEASE.sh @@ -17,7 +17,7 @@ done usage () { echo "Usage: $0 --repo [GIT REPO TO EDIT] --version [VERSION TO RELEASE] [--trigger-release]" - echo "Example: $0 --repo git@github.com:eclipse/che-devfile-registry --version 7.7.0 --trigger-release"; echo + echo "Example: $0 --repo git@github.com:eclipse/che-subproject --version 7.7.0 --trigger-release"; echo } if [[ ! ${VERSION} ]] || [[ ! ${REPO} ]]; then @@ -28,21 +28,30 @@ fi # derive branch from version BRANCH=${VERSION%.*}.x +# if doing a .0 release, use master; if doing a .z release, use $BRANCH +if [[ ${VERSION} == *".0" ]]; then + BASEBRANCH="master" +else + BASEBRANCH="${BRANCH}" +fi + # work in tmp dir TMP=$(mktemp -d); pushd "$TMP" > /dev/null || exit 1 -# get sources from master branch +# get sources from ${BASEBRANCH} branch echo "Check out ${REPO} to ${TMP}/${REPO##*/}" git clone "${REPO}" -q cd "${REPO##*/}" || exit 1 -git fetch origin master:master -git checkout master +git fetch origin "${BASEBRANCH}":"${BASEBRANCH}" +git checkout "${BASEBRANCH}" -# create new branch off master (or check out latest commits if branch already exists), then push to origin -git branch "${BRANCH}" || git checkout "${BRANCH}" && git pull origin "${BRANCH}" -git push origin "${BRANCH}" -git fetch origin "${BRANCH}:${BRANCH}" -git checkout "${BRANCH}" +# create new branch off ${BASEBRANCH} (or check out latest commits if branch already exists), then push to origin +if [[ "${BASEBRANCH}" != "${BRANCH}" ]]; then + git branch "${BRANCH}" || git checkout "${BRANCH}" && git pull origin "${BRANCH}" + git push origin "${BRANCH}" + git fetch origin "${BRANCH}:${BRANCH}" + git checkout "${BRANCH}" +fi # change VERSION file + commit change into .x branch echo "${VERSION}" > VERSION @@ -63,22 +72,30 @@ if [[ $TRIGGER_RELEASE -eq 1 ]]; then git push origin "${VERSION}" fi -# now update master to the new snapshot version -git fetch origin master:master -git checkout master - -# change VERSION file + commit change into master branch -[[ $BRANCH =~ ^([0-9]+)\.([0-9]+).x ]] && BASE=${BASH_REMATCH[1]}; NEXT=${BASH_REMATCH[2]}; (( NEXT=NEXT+1 )) # for BRANCH=7.10.x, get BASE=7, NEXT=11 -echo "${BASE}.${NEXT}.0-SNAPSHOT" > VERSION -BRANCH=master -COMMIT_MSG="[release] Bump to ${BASE}.${NEXT}.0-SNAPSHOT in ${BRANCH}" +# now update ${BASEBRANCH} to the new snapshot version +git fetch origin "${BASEBRANCH}":"${BASEBRANCH}" +git checkout "${BASEBRANCH}" + +# change VERSION file + commit change into ${BASEBRANCH} branch +if [[ "${BASEBRANCH}" != "${BRANCH}" ]]; then + # bump the y digit + [[ $BRANCH =~ ^([0-9]+)\.([0-9]+)\.x ]] && BASE=${BASH_REMATCH[1]}; NEXT=${BASH_REMATCH[2]}; (( NEXT=NEXT+1 )) # for BRANCH=7.10.x, get BASE=7, NEXT=11 + NEXTVERSION="${BASE}.${NEXT}.0-SNAPSHOT" +else + # bump the z digit + [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]] && BASE="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"; NEXT="${BASH_REMATCH[3]}"; (( NEXT=NEXT+1 )) # for VERSION=7.7.1, get BASE=7.7, NEXT=2 + NEXTVERSION="${BASE}.${NEXT}-SNAPSHOT" +fi +echo "${NEXTVERSION}" > VERSION +BRANCH=${BASEBRANCH} +COMMIT_MSG="[release] Bump to ${NEXTVERSION} in ${BRANCH}" git commit -s -m "${COMMIT_MSG}" VERSION -git pull origin ${BRANCH} +git pull origin "${BRANCH}" -PUSH_TRY="$(git push origin ${BRANCH})" +PUSH_TRY="$(git push origin "${BRANCH}")" # shellcheck disable=SC2181 if [[ $? -gt 0 ]] || [[ $PUSH_TRY == *"protected branch hook declined"* ]]; then -PR_BRANCH=pr-master-to-${BASE}.${NEXT}.0-SNAPSHOT +PR_BRANCH=pr-master-to-${NEXTVERSION} # create pull request for master branch, as branch is restricted git branch "${PR_BRANCH}" git checkout "${PR_BRANCH}" @@ -93,4 +110,4 @@ fi # cleanup tmp dir cd /tmp && rm -fr "$TMP" -popd > /dev/null +popd > /dev/null || exit diff --git a/arbitrary-users-patch/build_images.sh b/arbitrary-users-patch/build_images.sh index d5e6f317e..9db09017c 100755 --- a/arbitrary-users-patch/build_images.sh +++ b/arbitrary-users-patch/build_images.sh @@ -31,9 +31,9 @@ while read -r line; do base_image_name=$(echo "$line" | tr -s ' ' | cut -f 1 -d ' ') base_image=$(echo "$line" | tr -s ' ' | cut -f 2 -d ' ') echo "Building ${NAME_FORMAT}/${base_image_name}:${TAG} based on $base_image ..." - docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --no-cache --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/ + docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --no-cache --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/ | cat if ${PUSH_IMAGES}; then echo "Pushing ${NAME_FORMAT}/${base_image_name}:${TAG}" to remote registry - docker push "${NAME_FORMAT}/${base_image_name}:${TAG}" + docker push "${NAME_FORMAT}/${base_image_name}:${TAG}" | cat fi done < "${SCRIPT_DIR}"/base_images diff --git a/arbitrary-users-patch/happy-path/build_happy_path_image.sh b/arbitrary-users-patch/happy-path/build_happy_path_image.sh index 773469b17..c67e2ecad 100755 --- a/arbitrary-users-patch/happy-path/build_happy_path_image.sh +++ b/arbitrary-users-patch/happy-path/build_happy_path_image.sh @@ -28,8 +28,8 @@ if [ "$1" == "--push" ]; then fi # Build image for happy-path tests with precashed mvn dependencies -docker build -t "${NAME_FORMAT}/happy-path:${TAG}" --no-cache --build-arg TAG="${TAG}" "${SCRIPT_DIR}"/ +docker build -t "${NAME_FORMAT}/happy-path:${TAG}" --no-cache --build-arg TAG="${TAG}" "${SCRIPT_DIR}"/ | cat if ${PUSH_IMAGES}; then echo "Pushing ${NAME_FORMAT}/happy-path:${TAG}" to remote registry - docker push "${NAME_FORMAT}/happy-path:${TAG}" + docker push "${NAME_FORMAT}/happy-path:${TAG}" | cat fi diff --git a/cico_functions.sh b/cico_functions.sh index 0f4eb1e98..cf6fff03e 100644 --- a/cico_functions.sh +++ b/cico_functions.sh @@ -40,9 +40,9 @@ function install_deps() { /usr/sbin/setenforce 0 || true # Get all the deps in - yum install -y yum-utils device-mapper-persistent-data lvm2 + yum install -d1 -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - yum install -y docker-ce \ + yum install -d1 -y docker-ce \ git service docker start @@ -64,7 +64,7 @@ function set_nightly_tag() { function tag_push() { local TARGET=$1 docker tag "${IMAGE}" "$TARGET" - docker push "$TARGET" + docker push "$TARGET" | cat } # Set appropriate environment variables and login to the docker registry @@ -99,7 +99,7 @@ function setup_environment() { # Build, tag, and push devfile registry, tagged with ${TAG} and ${GIT_COMMIT_TAG} function build_and_push() { # Let's build and push image to 'quay.io' using git commit hash as tag first - docker build -t ${IMAGE} -f ${DOCKERFILE_PATH} --target registry . + docker build -t ${IMAGE} -f ${DOCKERFILE_PATH} --target registry . | cat tag_push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${GIT_COMMIT_TAG}" echo "CICO: '${GIT_COMMIT_TAG}' version of images pushed to '${REGISTRY}/${ORGANIZATION}' organization" @@ -117,7 +117,7 @@ function build_and_push_release() { echo "CICO: building release '${TAG}' / '${GIT_COMMIT_TAG}' version of devfile registry" docker build -t ${IMAGE} -f ${DOCKERFILE_PATH} . \ --build-arg PATCHED_IMAGES_TAG=${TAG} \ - --target registry + --target registry | cat echo "CICO: '${GIT_COMMIT_TAG}' version of devfile registry built" tag_push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${GIT_COMMIT_TAG}"