private static void handleRegistryUnauthorizedException(
      RegistryUnauthorizedException registryUnauthorizedException,
      HelpfulSuggestions helpfulSuggestions)
      throws BuildStepsExecutionException {
    if (registryUnauthorizedException.getHttpResponseException().getStatusCode()
        == HttpStatusCodes.STATUS_CODE_FORBIDDEN) {
      // No permissions for registry/repository.
      throw new BuildStepsExecutionException(
          helpfulSuggestions.forHttpStatusCodeForbidden(
              registryUnauthorizedException.getImageReference()),
          registryUnauthorizedException);

    } else {
      throw new BuildStepsExecutionException(
          helpfulSuggestions.forNoCredentialsDefined(
              registryUnauthorizedException.getImageReference()),
          registryUnauthorizedException);
    }
  }
Creates a runner to build an image tarball. Creates a directory for the cache, if needed.

@param jibContainerBuilder the {@link JibContainerBuilder}
@param containerizer the {@link Containerizer}
@param logger consumer for handling log events
@param helpfulSuggestions suggestions to use in help messages for exceptions
@param outputPath the path to output the tarball to
@return a {@link JibBuildRunner} for building a tarball
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/JibBuildRunner.java