Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] created pipline for fin-engine #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 77 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,103 @@ orbs:
helm: circleci/[email protected]
aws-eks: circleci/[email protected]
kubernetes: circleci/[email protected]
fynarfin-orb: fynarfin/[email protected]
jobs:
deploy-helm-chart:
build-and-host-fin-engine:
docker:
- image: cimg/python:3.10
parameters:
cluster-name:
description: "sit"
type: string
working_directory: ~/repo
environment:
TERM: dumb
steps:
- checkout
- kubernetes/install-kubectl
- aws-eks/update-kubeconfig-with-authenticator:
cluster-name: "sit"
aws-region: "us-east-2"
- run: rm -f helm/fineract/Chart.lock helm/fineract/requirements.lock helm/fineract/charts/*
- helm/install-helm-client:
version: "v3.8.2"
- run: helm ls --namespace=fineract
- run: echo $AWS_PROFILE
- run: echo $AWS_DEFAULT_PROFILE
- run: kubectl config use-context arn:aws:eks:us-east-2:419830066942:cluster/sit
- run: kubectl config get-contexts
- run: rm -f helm/g2pconnect-superset/Chart.lock helm/g2pconnect-superset/requirements.lock helm/g2pconnect-superset/charts/*
- run: helm dep up helm/g2pconnect-superset
- run: helm upgrade -f helm/g2pconnect-superset/values.yaml fineract helm/g2pconnect-superset --install --create-namespace --namespace fineract
migrating-tenants:
docker:
- image: 'cimg/base:2023.07'
steps:
- kubernetes/install-kubectl
- run: sleep 180
- run: echo $AWS_PROFILE
- run: echo $AWS_DEFAULT_PROFILE
- run: kubectl config use-context arn:aws:eks:us-east-2:419830066942:cluster/sit
- run: kubectl delete pods -n fineract `kubectl get pods -n fineract | grep fineract-server | cut -d " " -f1`
- run:
name: build-and-host-fin-engine
environment:
JIRA_STORY: ''
JIRA_STORY_DIR: ''
command: |
if [ "$CIRCLE_BRANCH" != "master" ]; then
PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST)
PR_TITLE=$(curl -sSL "https://api.github.com/repos/fynarfin/$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
sed -i "5s/.*/version: 0.0.0-SNAPSHOT$JIRA_STORY/" helm/fineract/Chart.yaml
helm dep up helm/fineract
helm package helm/fineract
helm repo index .
echo "$CERT_FILE" | base64 --decode > b64encoded.pem
chmod 400 b64encoded.pem
ssh -i b64encoded.pem -o StrictHostKeyChecking=No [email protected] sudo mkdir -p /apps/apache-tomcat-7.0.82/webapps/ROOT/images$JIRA_STORY_DIR/fin-engine-0.0.0-SNAPSHOT$JIRA_STORY
scp -o StrictHostKeyChecking=No -i b64encoded.pem index.yaml fin-engine-0.0.0-SNAPSHOT$JIRA_STORY.tgz [email protected]:~/
ssh -i b64encoded.pem -o StrictHostKeyChecking=No [email protected] sudo cp -t /apps/apache-tomcat-7.0.82/webapps/ROOT/images$JIRA_STORY_DIR/fin-engine-0.0.0-SNAPSHOT$JIRA_STORY index.yaml fin-engine-0.0.0-SNAPSHOT$JIRA_STORY.tgz
upgrade-fin-engine-helm-chart:
docker:
- image: cimg/python:3.10
environment:
TERM: dumb
steps:
- mifos-orb/docker-image-availability-check-and-upgrade:
namespace: fineract
chart-base-url: https://fynarfin.io/images
chart-name: fin-engine
chart-version: 0.0.0
# chart: "https://fynarfin.io/images/ph-ee-g2psandbox-fynarfin/ph-ee-g2psandbox-fynarfin-0.2.0.tgz"
release-name: fineract
# add-repo: "https://fynarfin.io/images/ph-ee-g2psandbox-fynarfin"
cluster-name: "sit"
aws-region: "$REGION"
service-file-path: https://raw.githubusercontent.com/fynarfin/ph-ee-env-labs/master/.circleci/services.txt
build_and_deploy:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run:
name: Install AWS CLI
command: sudo pip install awscli
- run:
name: Configure AWS Credentials
command: aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && aws configure set region $REGION
- run:
name: Install kubectl
command: |
sudo curl --silent --location -o /usr/local/bin/kubectl “https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl”
sudo chmod +x /usr/local/bin/kubectl
- run:
name: Authenticate kubectl with EKS Cluster
command: aws eks --region $REGION update-kubeconfig --name sit
- run:
name: Deploy Helm Chart
command: |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo “deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main” | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
#helm install
sudo apt-get update
sudo apt-get install helm
helm dep up helm/fineract
helm upgrade -f helm/fineract/values.yaml fineract helm/fineract --install --create-namespace --namespace fineract1
workflows:
version: 2
build-and-test:
build-and-deploy:
jobs:
- deploy-helm-chart:
- build-and-host-fin-engine:
cluster-name: sit
context:
- AWS
- Helm
- slack
- Secrets
- migrating-tenants:
- upgrade-fin-engine-helm-chart:
cluster-name: sit
requires:
- deploy-helm-chart
- build-and-host-fin-engine
context:
- AWS
- Helm
Expand Down