#!/usr/bin/env bash
set -euo pipefail

# This script is triggered a manual pipeline run via the web interface
# shellcheck source=./util.shlib
source .ci/util.shlib

# This script is used to manually trigger a build via pipeline UI
# PACKAGES is a ":" separated list of package names and needs
# to be supplied via pipeline variables

# Read config file into global variables
UTIL_READ_CONFIG_FILE

if [ "$PACKAGES" == "all" ]; then
  .ci/schedule-packages.sh schedule all
  exit 0
fi

declare -a FINAL=()
UTIL_PARSE_PACKAGELIST FINAL "$PACKAGES"
.ci/schedule-packages.sh schedule "${FINAL[@]}"
