Skip to content

Commit

Permalink
[PHEE-679] Update env-template pipline to use ph-ee-g2p-sandbox-ci ch…
Browse files Browse the repository at this point in the history
…art. (#459)

* [PHEE-679] Update env-template pipline to use ph-ee-g2p-sandbox-ci chart.

* test
  • Loading branch information
logoutdhaval authored Jul 2, 2024
1 parent 3107467 commit 44fc3f1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 21 deletions.
98 changes: 79 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,51 @@ orbs:
mifos-orb: mifos/docker-image-availability-check-and-upgrade@1.0.0

jobs:
build-g2p-sandbox-ci-chart:
docker:
- image: cimg/python:3.10
working_directory: ~/repo
environment:
TERM: dumb
steps:
- checkout
- run: git clone https://github.com/openmf/ph-ee-env-labs
- run: rm -f ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/Chart.lock ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/requirements.lock ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/charts/*
- helm/install-helm-client:
version: "v3.8.2"
# - run: "sed -i '12s/.*/version: 0.0.0/' helm/ph-ee-g2p-sandbox-ci/Chart.yaml"
- run:
name: build-and-host-ph-ee-g2p-sandbox-ci
environment:
JIRA_STORY: ''
JIRA_STORY_DIR: ''
command: |
if [ "$CIRCLE_BRANCH" != "develop" ]; then
PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST)
PR_TITLE=$(curl -sSL "https://api.github.com/repos/fynafin/$CIRCLE_PROJECT_REPONAME/pulls/$PR_NUMBER" | jq -r '.title')
JIRA_STORY=-$(echo $PR_TITLE | cut -d "[" -f2 | cut -d "]" -f1 | tr '[A-Z]' '[a-z]')
if [ -z "$JIRA_STORY" ]; then echo "Invalid PR title" && exit 1; else echo "Ticket NO: $JIRA_STORY" && JIRA_STORY_DIR=$(echo /jira-story-version); fi
echo Charts will save in https://fynarfin.io/images$JIRA_STORY_DIR
fi
CHART_URL="https://fynarfin.io/images$JIRA_STORY_DIR/ph-ee-g2p-sandbox-ci-0.0.0$JIRA_STORY"
if curl --output /dev/null --silent --head --fail "$CHART_URL"; then
sed -i "11s@^ *repository:.*\$@ repository: $CHART_URL@" ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/Chart.yaml
sed -i "12s@^ *version:.*\$@ version: 0.0.0$JIRA_STORY@" ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/Chart.yaml
echo "chart used: < $CHART_URL >"
else
CHART_URL="https://fynarfin.io/images/fynafin/ph-ee-g2p-sandbox-ci-0.0.0"
echo "chart used: < $CHART_URL >"
fi
sed -i "6s/.*/version: 0.0.0$JIRA_STORY/" ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/Chart.yaml
cat ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci/Chart.yaml
helm dep up ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci
helm package ph-ee-env-labs/helm/ph-ee-g2p-sandbox-ci
helm repo index .
echo "$CERT_FILE" | base64 --decode > b64encoded.pem
chmod 400 b64encoded.pem
ssh -i b64encoded.pem -o StrictHostKeyChecking=No ec2-user@13.233.68.128 sudo mkdir -p /apps/apache-tomcat-7.0.82/webapps/ROOT/images/fynafin$JIRA_STORY_DIR/ph-ee-g2p-sandbox-ci$JIRA_STORY
scp -o StrictHostKeyChecking=No -i b64encoded.pem index.yaml ph-ee-g2p-sandbox-ci-0.0.0$JIRA_STORY.tgz ec2-user@13.233.68.128:~/
ssh -i b64encoded.pem -o StrictHostKeyChecking=No ec2-user@13.233.68.128 sudo mv -t /apps/apache-tomcat-7.0.82/webapps/ROOT/images/fynafin$JIRA_STORY_DIR/ph-ee-g2p-sandbox-ci$JIRA_STORY index.yaml ph-ee-g2p-sandbox-ci-0.0.0$JIRA_STORY.tgz
build-and-host-engine:
docker:
- image: cimg/python:3.10
Expand Down Expand Up @@ -174,7 +219,7 @@ jobs:
machine:
image: ubuntu-2004:current
docker_layer_caching: true
resource_class: xlarge
resource_class: large
environment:
TERM: dumb
parameters:
Expand All @@ -198,12 +243,14 @@ jobs:
default: https://fynarfin.io/images
type: string
chart-name:
default: ph-ee-g2psandbox
default: ph-ee-g2p-sandbox-ci
type: string
chart-version:
default: 0.0.0
type: string
steps:
- helm/install-helm-client:
version: "v3.8.2"
- run:
name: run minikube
no_output_timeout: 40m
Expand All @@ -226,14 +273,14 @@ jobs:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
echo minikube waiting
minikube config set cpus 6
minikube config set memory 25600
minikube start #--extra-config=kubelet.max-pods=60
minikube config set cpus 4
minikube config set memory 15721
minikube start #--extra-config=kubelet.max-pods=60 --cpus max --memory max --disk-size 50g
echo "Minikube started-----------------------------------------------------"
minikube addons enable metrics-server
# To check the allocated values
minikube config get cpus
minikube config get memory
#minikube config get cpus
#minikube config get memory
MINIKUBE_IP=`minikube ip`
echo $MINIKUBE_IP
Expand Down Expand Up @@ -310,8 +357,11 @@ jobs:
sudo apt-get update
sudo apt-get install helm
kubectl create namespace paymenthub || echo namespace already exists
minikube ssh -- free -m
echo ------------MEMORY CHECK -----------

- run:
no_output_timeout: 20m
name: fetch docker images and helm upgrade
environment:
ORB_CHART_BASE_URL: << parameters.chart-base-url >>
Expand Down Expand Up @@ -356,7 +406,7 @@ jobs:
wget $SERVICE_FILE_PATH
filename=$(basename "$SERVICE_FILE_PATH")
#Using sed replace ph-ee-g2psandbox. with empty string
sed -i 's/ph-ee-g2psandbox\.p/p/g' $filename
sed -i 's/ph-ee-g2p-sandbox-ci\.p/p/g' $filename
echo $filename
get_services_from_file $filename
Expand All @@ -373,17 +423,16 @@ jobs:
fi
# Generating the chart url for deployment
# chart: "https://fynarfin.io/images/ph-ee-g2psandbox-0.0.0/ph-ee-g2psandbox-0.0.0.tgz"
ORB_PARAM_CHART=$(echo "$ORB_CHART_BASE_URL$JIRA_STORY_DIR/$ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY/$ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY.tgz")
# chart: "https://fynarfin.io/images/ph-ee-g2p-sandbox-ci/ph-ee-g2p-sandbox-ci-0.0.0.tgz"
ORB_PARAM_CHART=$(echo "$ORB_CHART_BASE_URL$JIRA_STORY_DIR/$ORB_CHART_NAME$JIRA_STORY/$ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY.tgz")
CHART_URL="$ORB_PARAM_CHART"
if curl --output /dev/null --silent --head --fail "$CHART_URL"; then
echo "chart used: < $CHART_URL >"
# add-repo: "https://fynarfin.io/images/ph-ee-g2psandbox-0.0.0"
ORB_PARAM_REPO=$(echo "$ORB_CHART_BASE_URL$JIRA_STORY_DIR/$ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY")
# add-repo: "https://fynarfin.io/images/ph-ee-g2p-sandbox-ci"
ORB_PARAM_REPO=$(echo "$ORB_CHART_BASE_URL$JIRA_STORY_DIR/$ORB_CHART_NAME$JIRA_STORY")
else
CHART_URL="https://fynarfin.io/images/ph-ee-g2psandbox-0.0.0/ph-ee-g2psandbox-0.0.0.tgz"
ORB_PARAM_REPO=$(echo "$ORB_CHART_BASE_URL/$ORB_CHART_NAME-$ORB_CHART_VERSION")
CHART_URL="https://fynarfin.io/images/ph-ee-g2p-sandbox-ci/ph-ee-g2p-sandbox-ci-0.0.0.tgz"
ORB_PARAM_REPO=$(echo "$ORB_CHART_BASE_URL/$ORB_CHART_NAME")
echo "chart used: < $CHART_URL >"
fi
Expand All @@ -394,10 +443,22 @@ jobs:
helm repo update
echo "helm upgrade --install ${VALUES_TO_OVERRIDE} ${ORB_PARAM_RELEASE_NAME} ${ORB_PARAM_CHART} ${ORB_PARAM_NAMESPACE}"
echo helm chart install starts
helm upgrade --install --timeout=1h --set ph-ee-engine.kafka.global.storageClass=standard --set ph-ee-engine.kafka.provisioning.enabled=false --set ph-ee-engine.elasticsearch.volumeClaimTemplate.storageClassName=standard ${VALUES_TO_OVERRIDE} ${ORB_PARAM_RELEASE_NAME} ${ORB_PARAM_CHART} ${ORB_PARAM_NAMESPACE} --set ph-ee-engine.ph_ee_connector_ams_mifos.ams_local_interop_host="https://fynams.sandbox.fynarfin.io/",ph-ee-engine.ph_ee_connector_ams_mifos.ams_local_account_host="https://fynams.sandbox.fynarfin.io/",ph-ee-engine.ph_ee_connector_ams_mifos.ams_local_customer_host="https://fynams.sandbox.fynarfin.io/",ph-ee-engine.ph_ee_connector_ams_mifos.ams_local_auth_host="https://fynams.sandbox.fynarfin.io/" #--set ph-ee-engine.kafka.provisioning.enabled=false
# Download ph-ee-g2p-sandbox-ci-chart and extract
curl -O $ORB_CHART_BASE_URL$JIRA_STORY_DIR/$ORB_CHART_NAME$JIRA_STORY/$ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY.tgz && tar xvf $ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY.tgz
rm -rf $ORB_CHART_NAME-$ORB_CHART_VERSION$JIRA_STORY.tgz
ORB_PARAM_REPO=$(echo "$ORB_CHART_BASE_URL/$ORB_CHART_NAME")
EXTRA_VALUES=$(echo "-f ph-ee-g2p-sandbox-ci/values_p1.yaml")
helm upgrade ${EXTRA_VALUES} --install --timeout=1h ${VALUES_TO_OVERRIDE} ${ORB_PARAM_RELEASE_NAME} ${ORB_PARAM_CHART} ${ORB_PARAM_NAMESPACE}
echo --------------------helm upgrade in Phase 1 done---------------------
EXTRA_VALUES=$(echo "-f ph-ee-g2p-sandbox-ci/values_p2.yaml")
helm upgrade ${EXTRA_VALUES} --install --timeout=1h ${VALUES_TO_OVERRIDE} ${ORB_PARAM_RELEASE_NAME} ${ORB_PARAM_CHART} ${ORB_PARAM_NAMESPACE}
echo --------------------helm upgrade in Phase 2 done---------------------
echo --------------------helm upgrade is done---------------------
sleep 1m;
# ----------------------Post-Installation-Steps-starts---------------------------
# #ES and Kibana secret creation
# git clone -b 7.17 https://github.com/elastic/helm-charts.git elastic/helm-charts
Expand Down Expand Up @@ -544,4 +605,3 @@ workflows:
- Ngrok
requires:
- build-host-g2p-fyn-chart

3 changes: 3 additions & 0 deletions helm/ph-ee-engine/templates/post-installation-job/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ spec:
cat deployBpmn.sh
cd ..
timeout 180s sh orchestration/deployBpmn.sh && sleep 5 || echo 'deploy Bpmn done'
echo "Removing ph-ee-env-labs directory"
cd ..
rm -rf ph-ee-env-labs
echo ---------------------------successful--------------------------

restartPolicy: Never
Expand Down
2 changes: 1 addition & 1 deletion helm/ph-ee-engine/templates/tests/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ It directly provides values.
- name: "BILLPAY_CONTACTPOINT"
value: "http://ph-ee-connector-bill-pay:8080"
- name: "awaitly_maxWaitTime"
value: "30"
value: "60"
- name: "GLOBAL_WAIT_TIME_MS"
value: "5000"
{{- end }}
2 changes: 1 addition & 1 deletion helm/ph-ee-engine/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ operations_app:
cpu: "500m"
requests:
memory: "512M"
cpu: "100m"
cpu: "100m"
# Enabling this will publicly expose your operations_app instance.
# Only enable this if you have security enabled on your cluster
ingress:
Expand Down

0 comments on commit 44fc3f1

Please sign in to comment.