Skip to content

Support for multiple buildpack volumes

Customer is using the recently added feature to specify volumes via variable BUILDPACK_VOLUMES. GitLab team members can read more in the ticket.

However, it's not clear how multiple volumes are passed, either

Suspicion is that each volume is passed with it's own --volume parameter.

This being the case, our code won't support this. Contrasting passing --env and --volume it's clear that additional steps are needed to effect a loop:

  • --volume
  volume_args=()
  if [[ -n "$BUILDPACK_VOLUMES" ]]; then
    volume_args=('--volume' "$BUILDPACK_VOLUMES")
  fi
  • --env
  env_args=()
  if [[ -n "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" ]]; then
    mapfile -t env_arg_names < <(echo "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" | tr ',' "\n")
    for env_arg_name in "${env_arg_names[@]}"; do
      env_args+=('--env' "$env_arg_name")
    done
  fi

Customer has tried concatenating multiple volumes, with --volume into BUILDPACK_VOLUMES but this didn't work.

Edited by Ben Prescott (ex-GitLab)