#!/bin/bash # Deploy External Buildah Build System # Sets up complete external build environment for Drone CI set -e echo "๐Ÿš€ Deploying External Buildah Build System" echo "=============================================" NAMESPACE="apps--droneio--prd" # Check if namespace exists if ! kubectl get namespace $NAMESPACE >/dev/null 2>&1; then echo "โŒ Namespace $NAMESPACE not found!" exit 1 fi echo "โœ… Namespace $NAMESPACE verified" # Deploy RBAC if not exists echo "๐Ÿ” Setting up RBAC..." if kubectl get serviceaccount drone-buildah-sa -n $NAMESPACE >/dev/null 2>&1; then echo "โœ… ServiceAccount already exists" else kubectl apply -f buildah-rbac.yaml echo "โœ… RBAC deployed" fi # Deploy external Buildah service echo "๐Ÿ—๏ธ Deploying external Buildah service..." kubectl apply -f buildah-external-deployment.yaml echo "โณ Waiting for Buildah pod to be ready..." kubectl wait --for=condition=ready pod -l app=buildah-external -n $NAMESPACE --timeout=60s # Update pod references echo "๐Ÿ”„ Updating configuration files..." ./update-buildah-pod.sh # Test the setup echo "๐Ÿงช Testing build system..." ./manage-external-buildah.sh test # Show status echo "" echo "๐Ÿ“Š Deployment Status" echo "====================" kubectl get pods -n $NAMESPACE | grep -E "(NAME|buildah|drone)" echo "" echo "โœ… External Buildah Build System deployed successfully!" echo "" echo "๐ŸŽฏ Next Steps:" echo "1. Test with: ./manage-external-buildah.sh status" echo "2. Use config: cp .drone.yml.external-buildah-production .drone.yml" echo "3. Commit and push to trigger build" echo "" echo "๐Ÿ“‹ Available configurations:" echo " .drone.yml.external-buildah - Basic external build" echo " .drone.yml.external-buildah-advanced - Advanced with error handling" echo " .drone.yml.external-buildah-production - Production-ready version"