root/build-tools
Scott Little b20ac0164d Build Avoidance
Purpose:
   Reduce build times after a repo sync by pulling in pre-generated
srpms and rpms and other build products created by a local reference build.

Usage:
  repo sync
  generate-cgcs-centos-repo.sh ...
  populate_downloads.sh ...
  build-pkgs --build-avoidance [--build-avoidance-user <user> \
     --build-avoidance-host <addr> --build-avoidance-dir <dir>]

Reference builds:
- A server performs a regular (daily?), automated builds using
  existing methods. Call these the reference builds.

- The builds are timestamped, and preserved for some time. (weeks?)
  The MY_WORKSPACE directory for the build shall have a common root
  directory, and a leaf directory that is a UTC time stamp of format
  YYYYMMDDThhmmssZ.
  e.g.
  MY_WORKSPACE=/localdisk/loadbuild/jenkins/StarlingX/20180719T113021Z

  Alternative formats are possible by setting values in ...
  "$MY_REPO/local-build-data/build_avoidance_source"
  e.g.
  BUILD_AVOIDANCE_DATE_FORMAT="%Y-%m-%d"
  BUILD_AVOIDANCE_TIME_FORMAT="%H-%M-%S"
  BUILD_AVOIDANCE_DATE_TIME_DELIM="_"
  BUILD_AVOIDANCE_DATE_TIME_POSTFIX=""
  BUILD_AVOIDANCE_DATE_UTC=0

  Which results in YYYY-MM-DD_hh-mm-ss format using local time.
  The one property that the timestamp must have is that they
  are sortable, and that the reference build and the consumer of
  the reference builds agree on the format.

- A build CONTEXT is captured, consisting of the SHA of each and every
  git that contributed to the build.

- For each package built, a file shall capture he md5sums of all the
  source code inputs to the build of that package.

- All these build products are accessible locally (e.g. a regional
  office) via rsync (other protocols can be added later).  ssh
  is also required to run remote query commands on the reference build.

  Initial ground work to support a selection variable ....
  BUILD_AVOIDANCE_FILE_TRANSFER="my-transfer-protocol"
  in $MY_REPO/local-build-data/build_avoidance_source"
  has been created, but "rsync" is the only valid value at this time.

- Location of the reference build can be specified via command line, or
  defaults can be put in $MY_REPO/local-build-data/build_avoidance_source.
  The local-build-data directory is gitignored by stx-root and so can be
  customized for local needs.
  e.g.
  cat $MY_REPO/local-build-data/build_avoidance_source
  BUILD_AVOIDANCE_USR="jenkins"
  BUILD_AVOIDANCE_HOST="stx-build-server.myco.com"
  BUILD_AVOIDANCE_DIR="/localdisk/loadbuild/jenkins/StarlingX"

Notes:
- Build avoidance is only used if requested.
- Build avoidance does not necessarily use the latest reference build.
  It compares the git context of all available reference builds vs your
  own git context, and chooses the most recent for which you gits have
  all the conent.  i.e. all your gits will be same or newer than that
  used by the reference build.  This also meens that some packages might
  still need to be rebuilt after the download step.
- Normally build avoidance remembers the last download context and will only
  consider reference builds newer than the last download.   You can reset
  using 'build-pkgs --build-avoidance --clear' to erase the download history.
  When might this matter to me?  If you change to an old branch that
  hasn't been synced recently and want to build in that context.
- The primary assumtion of Build Avoidance is that it is faster to
  download packages than to build them.  This is typically true of a
  good LAN, but likely not true of a WAN. This is why we emphasize the
  local nature of your reference build server.

Also in this update:
- reworked context generation to be relative to 'dirname $MY_REPO'
- Moved md5sum calculation to a common file, and fixed case where
  symlinks where canonacalized to paths outside of $MY_REPO.
  We'll make an exception to canonacalization to keep paths
  relative to $MY_REPO.
- In future other functions could be moved to the common file.

Story: 2002835
Task: 22754
Change-Id: I757780190cc6063d0a2d3ad9d0a6020ab5169e99
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-09-17 16:41:31 -04:00
..
branching Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
build_guest Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
build_iso Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
build_minimal_iso Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
certificates StarlingX open source release updates 2018-06-01 07:45:23 -07:00
mirror_rebase StarlingX open source release updates 2018-06-01 07:45:23 -07:00
mk Uprev grub2 and shim 2018-06-27 13:04:02 -04:00
repo_files Adding comps.xml and mock.proto default files. 2018-07-19 22:45:06 -05:00
signing StarlingX open source release updates 2018-06-01 07:45:23 -07:00
Cached_Data.txt StarlingX open source release updates 2018-06-01 07:45:23 -07:00
audit-pkgs StarlingX open source release updates 2018-06-01 07:45:23 -07:00
build-avoidance-utils.sh Build Avoidance 2018-09-17 16:41:31 -04:00
build-guest Make sure we are in the correct group to run build-guest. 2018-08-21 11:26:59 -04:00
build-img Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
build-iso build-iso: prevent use of host yum.conf when processing kickstart rpms 2018-08-21 11:26:21 -04:00
build-pkg-srpm StarlingX open source release updates 2018-06-01 07:45:23 -07:00
build-pkgs Build Avoidance 2018-09-17 16:41:31 -04:00
build-pkgs-parallel Build Avoidance 2018-09-17 16:41:31 -04:00
build-pkgs-serial Build Avoidance 2018-09-17 16:41:31 -04:00
build-rpms Build Avoidance 2018-09-17 16:41:31 -04:00
build-rpms-parallel Build Avoidance 2018-09-17 16:41:31 -04:00
build-rpms-serial Build Avoidance 2018-09-17 16:41:31 -04:00
build-sdk StarlingX open source release updates 2018-06-01 07:45:23 -07:00
build-srpms Build Avoidance 2018-09-17 16:41:31 -04:00
build-srpms-common.sh Build Avoidance 2018-09-17 16:41:31 -04:00
build-srpms-parallel Build Avoidance 2018-09-17 16:41:31 -04:00
build-srpms-serial Build Avoidance 2018-09-17 16:41:31 -04:00
classify Build: Improved logging, error handling, and other small fixes 2018-08-29 16:31:09 -04:00
create-cgcs-centos-repo StarlingX open source release updates 2018-06-01 07:45:23 -07:00
create-cgcs-tis-repo StarlingX open source release updates 2018-06-01 07:45:23 -07:00
create-yum-conf StarlingX open source release updates 2018-06-01 07:45:23 -07:00
create_dependancy_cache.py Python 3 compatibility: fix oldoctinteger 2018-09-01 15:38:19 +08:00
default_build_srpm StarlingX open source release updates 2018-06-01 07:45:23 -07:00
find_klm StarlingX open source release updates 2018-06-01 07:45:23 -07:00
find_patched_srpms_needing_upgrade StarlingX open source release updates 2018-06-01 07:45:23 -07:00
git-utils.sh Build Avoidance 2018-09-17 16:41:31 -04:00
image-utils.sh Tool changes to allow image.inc to be split across git repos. 2018-08-17 15:00:42 +00:00
ip_report.py StarlingX open source release updates 2018-06-01 07:45:23 -07:00
make-installer-images.sh Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
mock_cfg_to_yum_conf.py StarlingX open source release updates 2018-06-01 07:45:23 -07:00
mockchain-parallel Build: Improved logging, error handling, and other small fixes 2018-08-29 16:31:09 -04:00
modify-build-cfg Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
patch-iso Move content from stx-utils into stx-integ or stx-update 2018-08-01 16:12:17 -04:00
patch_rebase_1 Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
patch_rebase_2 Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
patch_rebase_3 Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
patch_rebase_4 Shorten "addons/wr-cgcs/layers/cgcs" to just "stx" 2018-07-04 15:12:58 -04:00
sign-rpms cleanup signing scripts 2018-09-07 14:44:37 -04:00
sign-secure-boot Build Avoidance 2018-09-17 16:41:31 -04:00
sign_iso_formal.sh cleanup signing scripts 2018-09-07 14:44:37 -04:00
sign_patch_formal.sh cleanup signing scripts 2018-09-07 14:44:37 -04:00
source_lookup.txt StarlingX open source release updates 2018-06-01 07:45:23 -07:00
spec-utils Build hangs on macro resolution in spec file 2018-08-13 13:52:35 -04:00
srpm-utils Build: Improved logging, error handling, and other small fixes 2018-08-29 16:31:09 -04:00
sync-jenkins StarlingX open source release updates 2018-06-01 07:45:23 -07:00
sync_jenkins.sh Fix linters issues and enable tox/zuul linters job as gate 2018-09-05 22:42:11 +08:00
tis.macros StarlingX open source release updates 2018-06-01 07:45:23 -07:00
update-efiboot-image Rename mwa-* subdirectories to match the git repo name 2018-07-04 13:17:17 -04:00
update-pxe-network-installer StarlingX open source release updates 2018-06-01 07:45:23 -07:00
wrs_orig.txt StarlingX open source release updates 2018-06-01 07:45:23 -07:00