Faster Interactive Studio Builds by Avoiding Artifact Creation


#1

A chat with @Sirex in the community forums today yielded a nice hack to speed up development of packages in the local Studio (if you work in the Studio often you probably have felt the pain of waiting for artifact creation to complete after every build).

This hack makes use of the fact that each package is installed under under /hab/pkgs inside the Studio before the artifact is created. This means we can test packages and services from within the Studio before the time-consuming process of artifact creation begins. To implement the hack, add this callback to your plan.sh:

do_after() {
  if [ $HAB_CREATE_PACKAGE == 'false' ]
  then
    build_line "WARN: Skipping artifact creation because 'HAB_CREATE_PACKAGE=false'"

    _generate_artifact() {
      return 0
    }

    _prepare_build_outputs() {
      return 0
    }
  fi
}

To actually enable it, you should set HAB_CREATE_PACKAGE=false either on the command-line or in your .studiorc file before initializing the Studio.

Enjoy the speed boost!


#2

This sounds like a nice pattern to formalize. Maybe something like build --no-hart or build --local-install. Would you mind filing an issue and we can triage it?


#3

You mean https://github.com/habitat-sh/habitat/issues/6233 ? :wink: