From 171cad3aa249001123a6b0907edfb0330bcd61a1 Mon Sep 17 00:00:00 2001 From: Mohan E Date: Mon, 7 Oct 2024 17:54:01 +0530 Subject: [PATCH] [MOSIP-35421] Moved installtion scripts of prereg apitestrig. Signed-off-by: Mohanraj209 --- deploy/prereg-apitestrig/README.md | 20 ++++++++++- deploy/prereg-apitestrig/install.sh | 52 ++++++++++++++++++++++++++++ deploy/prereg-apitestrig/values.yaml | 48 +++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 deploy/prereg-apitestrig/install.sh diff --git a/deploy/prereg-apitestrig/README.md b/deploy/prereg-apitestrig/README.md index cece826ae1..512b3d19c8 100644 --- a/deploy/prereg-apitestrig/README.md +++ b/deploy/prereg-apitestrig/README.md @@ -1,6 +1,24 @@ # PREREG APITESTRIG -This directory contains `values.yaml` file which contains the latest prereg apitestrig release changes with latest released Docker image and tag. +# INSTALL + +This `install.sh` script automates the process of cloning `mosip-functional-tests` repository from a user-defined specific branch from a Git repository, running an installation script to deploy prereg apitestrig within the cluster, and cleaning up the repository afterward. + +Note: This directory contains `values.yaml` file which contains the latest prereg apitestrig release changes with latest released Docker image and tag. The above install script uses this `values.yaml` by default to deploy apitestrig with latest changes. + +## Prerequisites + +- Ensure you have **git** installed on your machine. +- You need access to the Kubernetes cluster configuration file (`kubeconfig`). +- Ensure you have the necessary permissions to execute shell scripts. + +## Script Usage + +1. **Clone this script to your local machine**. +2. **Run the script using the following command**: + ```bash + ./script.sh + ``` ## TL;DR diff --git a/deploy/prereg-apitestrig/install.sh b/deploy/prereg-apitestrig/install.sh new file mode 100644 index 0000000000..6f6d778593 --- /dev/null +++ b/deploy/prereg-apitestrig/install.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Prompt the user for the branch name +read -p "Enter the Git branch (default is 'develop'): " GIT_BRANCH +GIT_BRANCH=${GIT_BRANCH:-develop} # Default to 'develop' if no input is provided + +echo "set kubeconfig" +export KUBECONFIG=$1 + +# Set variables +REPO_URL="https://github.com/mosip/mosip-functional-tests.git" +INSTALL_SCRIPT="install.sh" +VALUES_FILE="../../../values.yaml" # Path to your custom values.yaml file + +# Clone the repository +echo "Cloning repository from $REPO_URL on branch $GIT_BRANCH..." +if git clone -b "$GIT_BRANCH" "$REPO_URL" ; then + echo "Repository cloned successfully." +else + echo "Failed to clone repository." + exit 1 +fi + +# Navigate to the deployment directory +echo "Navigating to deploy directory..." +git_repo_name="$(basename "$REPO_URL" .git)" + +cd $git_repo_name + +git sparse-checkout init --cone && git sparse-checkout set deploy/apitestrig + +find . -type f ! -path "./deploy/*" -exec rm -f {} \; + +cd deploy/apitestrig || { echo "apitestrig directory not found."; exit 1; } +cp $VALUES_FILE values.yaml + +# Check if the install script exists and is executable +if [ -x "$INSTALL_SCRIPT" ]; then + echo "Running install script with values file $VALUES_FILE..." + source ./"$INSTALL_SCRIPT" + echo "Install script executed successfully." +else + echo "Install script not found or not executable." + exit 1 +fi + +# Cleanup cloned repository +echo "Cleaning up..." +cd ../../.. +rm -rf $git_repo_name + +echo "Deployment complete!" diff --git a/deploy/prereg-apitestrig/values.yaml b/deploy/prereg-apitestrig/values.yaml index 2c9f8e9e13..2c6133ed55 100644 --- a/deploy/prereg-apitestrig/values.yaml +++ b/deploy/prereg-apitestrig/values.yaml @@ -1,7 +1,55 @@ modules: + masterdata: + enabled: false + image: + repository: mosipqa/apitest-masterdata + tag: develop + pullPolicy: Always prereg: enabled: true image: repository: mosipqa/apitest-prereg tag: develop pullPolicy: Always + idrepo: + enabled: false + image: + repository: mosipqa/apitest-idrepo + tag: develop + pullPolicy: Always + partner: + enabled: false + image: + repository: mosipqa/apitest-partner + tag: develop + pullPolicy: Always + resident: + enabled: false + image: + repository: mosipqa/apitest-resident + tag: develop + pullPolicy: Always + auth: + enabled: false + image: + repository: mosipqa/apitest-auth + tag: develop + pullPolicy: Always + esignet: + enabled: false + image: + repository: mosipqa/apitest-esignet + tag: develop + pullPolicy: Always + mimoto: + enabled: false + image: + repository: mosipqa/apitest-mimoto + tag: develop + pullPolicy: Always + pms: + enabled: false + image: + repository: mosipqa/apitest-pms + tag: develop + pullPolicy: Always