Created
November 4, 2025 08:16
-
-
Save suresh-mahawar/90a203c0a8fef43299783bac6f63fe7f to your computer and use it in GitHub Desktop.
deployment-startup.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| if ! command -v git &> /dev/null; then | |
| echo "Error: Git command not found. Please install Git and configure GitHub authentication." | |
| exit 1 | |
| fi | |
| if ! command -v find &> /dev/null; then | |
| echo "Error: Find command not found. Please install Find." | |
| exit 1 | |
| fi | |
| if ! command -v curl &> /dev/null; then | |
| echo "Error: cURL command not found. Please install cURL." | |
| exit 1 | |
| fi | |
| if ! command -v jq &> /dev/null; then | |
| echo "Error: jq command not found. Please install jq." | |
| exit 1 | |
| fi | |
| if ! command -v gh &> /dev/null; then | |
| echo "Error: gh command not found. Please install gh and log in to your GitHub account using the gh CLI." | |
| exit 1 | |
| fi | |
| if command -v python3 &> /dev/null; then | |
| PYTHON=python3 | |
| elif command -v python &> /dev/null; then | |
| PYTHON=python | |
| else | |
| echo "Error: Python command not found. Please install Python." | |
| exit 1 | |
| fi | |
| RANDOM_NUM=$(echo $RANDOM) | |
| mkdir -p /tmp | |
| REPO_PATH=/tmp/template-manifests-$RANDOM_NUM | |
| APP_REPO_PATH=/tmp/new-app-$RANDOM_NUM | |
| ARGO_REPO_PATH=/tmp/argocd-$RANDOM_NUM | |
| PLT_GITOPS_REPO_PATH=/tmp/platform-gitops-$RANDOM_NUM | |
| TF_CF_BREVO_TECH_REPO_PATH=/tmp/tf-cloudflare-brevo-tech-$RANDOM_NUM | |
| echo "================================================================" | |
| curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py | |
| $PYTHON /tmp/get-pip.py | |
| rm /tmp/get-pip.py | |
| echo "================================================================" | |
| $PYTHON -m venv /tmp/.venv | |
| source /tmp/.venv/bin/activate | |
| cloneRepo() { | |
| echo "================================================================" | |
| echo "Please wait, this may take a few minutes." | |
| echo "Cloning repository: git@github.com:$1" | |
| if git clone --quiet "git@github.com:$1" $REPO_PATH; then | |
| $PYTHON -m pip uninstall -y -r $REPO_PATH/requirements.txt | |
| $PYTHON -m pip install -r $REPO_PATH/requirements.txt | |
| echo "================================================================" | |
| else | |
| echo "=====================================================================" | |
| echo "Repository: https://github.com/$1" | |
| echo "Please ask your manager for write access to the repository." | |
| echo "=====================================================================" | |
| fi | |
| } | |
| if ! find $(pwd) -type f -maxdepth 1 -name "generate-manifiest.sh" -maxdepth 1 | grep -q "generate-manifiest.sh"; then | |
| cloneRepo $1 | |
| else | |
| REPO_PATH=$(pwd); | |
| fi | |
| . $REPO_PATH/generate-manifiest.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment