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

[PHEE-707] Generate dynamic file in bulk test cases and the Authenticate. #313

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
93 changes: 70 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
helm: circleci/[email protected]
aws-eks: circleci/[email protected]
kubernetes: circleci/[email protected]
mifos-orb: mifos/[email protected]
fynarfin-orb: fynarfin/[email protected]
executors:
docker-executor:
docker:
Expand Down Expand Up @@ -51,18 +51,18 @@ jobs:
IMAGE_TAG=$CIRCLE_TAG

# Check if the Docker image with the same tag already exists in Docker Hub
if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/openmf/ph-ee-integration-test/tags/$IMAGE_TAG" > /dev/null; then
if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/fynarfin/ph-ee-integration-test/tags/$IMAGE_TAG" > /dev/null; then
echo "Skipping the build and push as the tag $IMAGE_TAG already exists in Docker Hub."
exit 0
fi

# Build and tag the Docker image
./gradlew bootJar
docker build -t "openmf/ph-ee-integration-test:$IMAGE_TAG" .
docker build -t "fynarfin/ph-ee-integration-test:$IMAGE_TAG" .

# Push the Docker image to Docker Hub
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"
docker push "openmf/ph-ee-integration-test:$IMAGE_TAG"
docker push "fynarfin/ph-ee-integration-test:$IMAGE_TAG"

# when: always # The job will be executed even if there's no match for the tag filter

Expand All @@ -84,13 +84,13 @@ jobs:
./gradlew checkstyleMain
./gradlew checkstyleTest
./gradlew bootJar
docker build -t openmf/ph-ee-integration-test:latest .
if [ "$CIRCLE_BRANCH" != "master" ]; then
docker build -t fynarfin/ph-ee-integration-test:latest .
if [ "$CIRCLE_BRANCH" != "develop" ]; then
PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST)
PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title')
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"; fi
docker image tag openmf/ph-ee-integration-test:latest openmf/ph-ee-integration-test:$JIRA_STORY
docker image tag fynarfin/ph-ee-integration-test:latest fynarfin/ph-ee-integration-test:$JIRA_STORY
fi

# Log in to DockerHub using environment variables
Expand All @@ -102,28 +102,28 @@ jobs:
- run:
name: Push Docker image to DockerHub
command: |
if [ "$CIRCLE_BRANCH" = "master" ]; then
docker push openmf/ph-ee-integration-test:latest
if [ "$CIRCLE_BRANCH" = "develop" ]; then
docker push fynarfin/ph-ee-integration-test:latest
fi
if [ "$CIRCLE_BRANCH" != "master" ]; then
if [ "$CIRCLE_BRANCH" != "develop" ]; then
PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST)
PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title')
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]')
docker push openmf/ph-ee-integration-test:${JIRA_STORY}
docker push fynarfin/ph-ee-integration-test:${JIRA_STORY}
fi
docker-image-availability-check-and-upgrade:
docker:
- image: 'cimg/python:3.10'
steps:
- mifos-orb/docker-image-availability-check-and-upgrade:
- fynarfin-orb/docker-image-availability-check-and-upgrade:
namespace: paymenthub
chart-base-url: https://fynarfin.io/images
chart-base-url: https://fynarfin.io/images/fynarfin
chart-name: ph-ee-g2psandbox-fynarfin
chart-version: 0.2.0
release-name: g2p-sandbox
cluster-name: "sit"
aws-region: "$REGION"
service-file-path: https://raw.githubusercontent.com/openMF/ph-ee-env-labs/master/.circleci/services.txt
service-file-path: https://raw.githubusercontent.com/fynarfin/ph-ee-env-labs/develop/.circleci/services.txt

create-tls-secret-paymenthub-namespace:
docker:
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
- setup_remote_docker:
version: 20.10.14
- kubernetes/install-kubectl
- run: git clone https://github.com/openmf/ph-ee-env-labs
- run: git clone https://github.com/fynarfin/ph-ee-env-labs
- aws-eks/update-kubeconfig-with-authenticator:
cluster-name: "sit"
aws-region: "$REGION"
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
docker:
- image: 'cimg/base:2022.06'
steps:
- run: git clone https://github.com/openmf/ph-ee-env-labs
- run: git clone https://github.com/fynarfin/ph-ee-env-labs
- run: echo $AWS_PROFILE
- run: echo $AWS_DEFAULT_PROFILE
- run: |
Expand All @@ -202,7 +202,7 @@ jobs:
- image: cimg/openjdk:17.0.0-node
steps:
- checkout
#- run: git clone https://github.com/openmf/ph-ee-integration-test
#- run: git clone https://github.com/fynarfin/ph-ee-integration-test
- run:
name: Ngrok setup
command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
Expand Down Expand Up @@ -231,15 +231,54 @@ jobs:
echo -n "Test execution is completed, kill ngrok"
pkill ngrok
- store_test_results:
path: build/test-results/test/TEST-org.mifos.integrationtest.TestRunner.xml
path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml
- store_artifacts:
path: build/test-results

test-chart-e2e:
docker:
- image: cimg/openjdk:17.0.0-node
steps:
- checkout
#- run: git clone https://github.com/fynarfin/ph-ee-integration-test
- run:
name: Ngrok setup
command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
- run:
name: Test execution
no_output_timeout: 30m
command: |
ngrok config add-authtoken $AUTH_TOKEN
echo "web_addr: $LOCAL_PORT" >> /home/circleci/.config/ngrok/ngrok.yml
ngrok http 53013 > /dev/null &
echo -n "Extracting ngrok public url ."
NGROK_PUBLIC_URL=""
while [ -z "$NGROK_PUBLIC_URL" ]; do
# Run 'curl' against ngrok API and extract public (using 'sed' command)
export NGROK_PUBLIC_URL=$(curl --silent --max-time 10 --connect-timeout 5 \
--show-error http://127.0.0.1:$LOCAL_PORT/api/tunnels | \
sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p')
sleep 1
echo -n "."
done

export CALLBACK_URL="https://$NGROK_PUBLIC_URL"
echo -n "Public url ."
echo $CALLBACK_URL
./gradlew test -Dcucumber.filter.tags="@e2e"
echo -n "Test execution is completed, kill ngrok"
pkill ngrok
- store_test_results:
path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml
- store_artifacts:
path: build/test-results

test-chart-ams:
docker:
- image: cimg/openjdk:17.0.0
steps:
- checkout
#- run: git clone https://github.com/openmf/ph-ee-integration-test
#- run: git clone https://github.com/fynarfin/ph-ee-integration-test
- run:
name: Ngrok setup
command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
Expand Down Expand Up @@ -268,7 +307,7 @@ jobs:
echo -n "Test execution is completed, kill ngrok"
pkill ngrok
- store_test_results:
path: build/test-results/test/TEST-org.mifos.integrationtest.TestRunner.xml
path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml
- store_artifacts:
path: build/test-results
workflows:
Expand Down Expand Up @@ -317,14 +356,22 @@ workflows:
- AWS
- Helm
- slack
- test-chart-ams:
- test-chart-e2e:
requires:
- deploying-bpmns
context:
- AWS
- Helm
- slack
- Ngrok
- test-chart-ams:
requires:
- test-chart-e2e
context:
- AWS
- Helm
- slack
- Ngrok
- test-chart-gov:
requires:
- test-chart-ams
Expand Down
Loading