Skip to content

Commit aa1f816

Browse files
author
Yu Hu
committed
make path required field
1 parent e0e21db commit aa1f816

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

startupscript/butane/gcp/docker-auth.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
#!/bin/bash
22
# Script to extract Artifact Registry regions from image URLs in files and authenticate with docker
3-
# Usage: ./docker-auth.sh [path] [default-regions]
4-
# path: optional subdirectory under /home/core/devcontainer
3+
# Usage: ./docker-auth.sh <path> [default-regions]
4+
# path: subdirectory under /home/core/devcontainer (required)
55
# default-regions: comma-separated list of regions to always include (defaults to us-central1)
66

77
set -o errexit
88
set -o nounset
99
set -o pipefail
1010
set -o xtrace
1111

12-
# Use /home/core/devcontainer as prefix for the input
13-
DEVCONTAINER_PATH="/home/core/devcontainer${1:+/$1}"
12+
# Validate required parameter
13+
if [ $# -lt 1 ] || [ -z "${1:-}" ]; then
14+
echo "Error: path parameter is required" >&2
15+
echo "Usage: $0 <path> [default-regions]" >&2
16+
exit 1
17+
fi
18+
19+
DEVCONTAINER_PATH="/home/core/devcontainer/$1"
1420

1521
# Default regions to always include (comma-separated)
1622
DEFAULT_REGIONS="${2:-us-central1}"

0 commit comments

Comments
 (0)