#!/usr/bin/env bash

TYP=$1

. $(dirname $0)/util
set -e

usage() {
  echo "usage: ./hack/build_ci_first_pass <binaries|integration-tests>"
  exit 1
}

if [ -z "$TYP" ]; then
  usage
fi

case $TYP in
  "binaries")
    buildxCmd build $cacheFromFlags $cacheToFlags \
      --target "binaries" \
      $currentcontext
    ;;
  "integration-tests")
    buildxCmd build $cacheFromFlags $cacheToFlags \
      --target "integration-tests-base" \
      $currentcontext
    ;;
  *)
    echo >&2 "Unknown type $TYP"
    exit 1
    ;;
esac
