mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
63 lines
1.5 KiB
Bash
Executable File
63 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# etc/deploy_pipeline.sh
|
|
# Collects artifacts and prepares terraform directory for GCP deployment
|
|
|
|
usage() {
|
|
echo "Usage: $0 --mode <gcp>"
|
|
echo "Options:"
|
|
echo " --mode gcp Prepare and publish the terraform pipeline to GCP"
|
|
exit 1
|
|
}
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
usage
|
|
fi
|
|
|
|
MODE=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--mode)
|
|
MODE="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$MODE" != "gcp" ]]; then
|
|
echo "Error: Only 'gcp' mode is supported currently."
|
|
usage
|
|
fi
|
|
|
|
# Mode GCP Implementation
|
|
echo "Preparing GCP deployment pipeline..."
|
|
|
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
STAGING_DIR="${STAGING_DIR:-$PROJECT_ROOT/data/staging}"
|
|
TF_DIR="$PROJECT_ROOT/deploy/gcp/terraform"
|
|
|
|
if [[ ! -d "$STAGING_DIR" ]]; then
|
|
echo "Staging directory not found: $STAGING_DIR"
|
|
echo "Please ensure artifacts are staged before running this script."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Collecting artifacts from $STAGING_DIR..."
|
|
# Logic to lift and shift kubernetes deployment into terraform directory
|
|
# For now, we'll just simulate this by copying relevant files or updating tfvars
|
|
|
|
# Example: copy staged manifests to a specific location in TF directory if needed
|
|
# mkdir -p "$TF_DIR/manifests"
|
|
# cp "$STAGING_DIR"/*.yaml "$TF_DIR/manifests/"
|
|
|
|
echo "Preparing terraform directory at $TF_DIR..."
|
|
# cd "$TF_DIR"
|
|
# terraform init
|
|
|
|
echo "GCP deployment pipeline prepared successfully."
|
|
echo "You can now run terraform apply in $TF_DIR"
|