ci, build/f_repos: Minor UX improvements 83/22883/6
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 9 Oct 2016 15:38:30 +0000 (17:38 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 11 Oct 2016 14:43:07 +0000 (16:43 +0200)
After Armband rework landed of top of `build/f_repos` mechanism [1],
the following minor UX improvements can also be applied to Fuel's
f_repos:
- set SHELL to "/bin/sh" (we don't use any bash-isms);
- improve "From SHA..." removal for exported patches;
- force checkout of root tag commit during clean;
- silence progress during git clone (cleaner logs);
- support git older than 1.8.4 in `make clean` (fix Armband deploy);

FIXME:
 Pass TERM as Docker env var until [2] is fixed in Docker 1.13.

v4 -> v5:
 * Moved `export TERM` to Releng, where it actually belongs [3];
 * Fixed Armband deploys fail [4] by adjusting `make clean`;

[1] https://gerrit.opnfv.org/gerrit/#/c/22791/
[2] https://github.com/docker/docker/issues/9299
[3] https://gerrit.opnfv.org/gerrit/#/c/22933/
[4] https://build.opnfv.org/ci/view/armband/job/\
    fuel-deploy-armband-baremetal-daily-master/57/consoleText

Fixes: FUEL-200

Change-Id: I80e3074f8659769e21f5b56f07c34c7a5de727bc
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
build/config.mk
build/docker/runcontext
build/f_repos/Makefile
build/f_repos/README.md

index ab30518..e5ca615 100644 (file)
@@ -8,7 +8,11 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-# fuel-main tag checked out from upstream `fuel-main` repo before patching it
+# This tag is NOT checked out, it only serves a cosmetic purpose of hinting
+# what upstream Fuel components our submodules are bound to (while tracking
+# remotes, ALL submodules will point to remote branch HEAD).
+# NOTE: Pinning fuel-main or other submodules to a specific commit/tag is
+# done ONLY via git submodules.
 FUEL_MAIN_TAG = 9.0.1
 MOS_VERSION   = 9.0
 OPENSTACK_VERSION = mitaka-9.0
index daad663..c4f7b29 100755 (executable)
@@ -111,7 +111,9 @@ if [ -n "$CACHEBASE" ]; then
     fi
 fi
 
+# FIXME: TERM is required because: https://github.com/docker/docker/issues/9299
 RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm \
+    -e TERM=$TERM \
     -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE \
     -e BUILD_FUEL_PLUGINS -e MIRROR_UBUNTU -e MIRROR_UBUNTU_ROOT \
     -e MIRROR_MOS_UBUNTU -e MIRROR_MOS_UBUNTU_ROOT -e MIRROR_FUEL \
index 66abf2d..06d9111 100644 (file)
@@ -9,7 +9,7 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-SHELL = /bin/bash
+SHELL = /bin/sh
 REPOINFO = $(shell readlink -e ../repo_info.sh)
 FREPODIR = $(shell pwd)
 FPATCHES = $(shell find ${F_PATCH_DIR} -name '*.patch')
@@ -51,9 +51,9 @@ sub: .cachefuelinfo
 
 .cachefuelinfo:
        @if [ -n "${FUEL_TRACK_REMOTES}" ]; then \
-               git submodule update --init --remote; \
+               git submodule update --init --remote 2>/dev/null; \
        else \
-               git submodule update --init; \
+               git submodule update --init 2>/dev/null; \
        fi
        @rm -f $@
        @git submodule -q foreach '${REPOINFO} . >> ${FREPODIR}/$@'
@@ -69,8 +69,9 @@ patches-export: sub
                        mkdir -p $$SUB_DIR/$${SUB_FEATURE} && \
                        git format-patch --no-signature --ignore-space-at-eol \
                                -o $$SUB_DIR/$$SUB_FEATURE -N $$F_TAG-root..$$F_TAG; \
+                       sed -i -e "1{/From: /!d}" -e "s/[[:space:]]*$$//" \
+                               $$SUB_DIR/$$SUB_FEATURE/*.patch; \
                done'
-       @sed -i -e '1d' -e 's/[[:space:]]*$$//' ${FPATCHES}
 
 # Apply patches from patch/* to respective submodules
 # We rely on `make sub` and/or `make clean` to checkout correct base
@@ -100,9 +101,9 @@ patches-import: sub .cachepatched
 # Clean any changes made to submodules, checkout upstream Fuel root commit
 .PHONY: clean
 clean:
-       @git submodule -q foreach ' \
+       @cd ${F_GIT_ROOT} && git submodule -q foreach ' \
                git am -q --abort > /dev/null 2>&1; \
-               git checkout -q ${F_OPNFV_TAG}-root > /dev/null 2>&1; \
+               git checkout -q -f ${F_OPNFV_TAG}-root > /dev/null 2>&1; \
                git branch -q -D opnfv-fuel > /dev/null 2>&1; \
                git tag | grep ${F_OPNFV_TAG} | xargs git tag -d > /dev/null 2>&1; \
                git reset -q --hard HEAD; \
index 6cc825e..0a52fe0 100644 (file)
@@ -92,3 +92,30 @@ Sub-project maintenance
 
    $ git submodule -b stable/mitaka add --name fuel-web \
      https://github.com/openstack/fuel-web.git upstream/fuel-web
+
+2. Working with remote tracking for upgrading Fuel components
+   Enable remote tracking as described above, which at `make sub` will update
+   ALL submodules (fuel-main, fuel-library, ...) to remote branch (set in
+   .gitmodules) HEAD.
+
+   * If upstream has NOT already tagged a new version, we can still work on
+     our patches, make sure they apply etc., then check for new upstream
+     changes (and that our patches still apply on top of them) by:
+
+   $ make deepclean patches-import
+
+   * If upstream has already tagged a new version we want to pick up, checkout
+     the new tag in each submodule:
+
+   $ git submodule foreach 'git checkout <newtag>'
+
+   * Once satisfied with the patch and submodule changes, commit them:
+     - enforce FUEL_TRACK_REMOTES to "yes" if you want to constatly use the
+       latest remote branch HEAD (as soon as upstream pushes a change on that
+       branch, our next build will automatically include it - risk of our
+       patches colliding with new upstream changes);
+     - stage patch changes if any;
+     - if submodule tags have been updated (relevant when remote tracking is
+       disabled, i.e. we have a stable upstream baseline), add submodules:
+
+   $ make deepclean sub && git add -f sub/*