From b7423bcabb8d82ce2bf8342bbc20e3bf0a7fffd8 Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 29 Aug 2024 20:24:53 +0530 Subject: [PATCH 1/2] [MOSIP-35429] added push-trigger.yml and installation script for esignet-artifactory deployment. Signed-off-by: techno-467 --- .github/workflows/push-trigger.yml | 33 ++++++++++++++++++++++++++++ deploy/README.md | 8 +++++++ deploy/delete.sh | 30 +++++++++++++++++++++++++ deploy/install.sh | 35 ++++++++++++++++++++++++++++++ deploy/restart.sh | 25 +++++++++++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 .github/workflows/push-trigger.yml create mode 100644 deploy/README.md create mode 100755 deploy/delete.sh create mode 100755 deploy/install.sh create mode 100755 deploy/restart.sh diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml new file mode 100644 index 0000000..6d25bc4 --- /dev/null +++ b/.github/workflows/push-trigger.yml @@ -0,0 +1,33 @@ +name: Artifactory build upon a push + +on: + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + push: + branches: + - master + - develop + - 1.* + - MOSIP* + - release* + +jobs: + build-docker-artifactory-server: + strategy: + matrix: + include: + - SERVICE_LOCATION: 'artifacts' + SERVICE_NAME: 'esignet-artifactory-server' + fail-fast: false + name: ${{ matrix.SERVICE_NAME }} + uses: mosip/kattu/.github/workflows/docker-build.yml@master + with: + SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} + SERVICE_NAME: ${{ matrix.SERVICE_NAME }} + secrets: + DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} + ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} + RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..4f450ae --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,8 @@ +# Artifactory + +## Install +```sh +./install.sh +``` +### Note: +Please ensure the esignet-artifactory docker image is verified before initiating the deployment. \ No newline at end of file diff --git a/deploy/delete.sh b/deploy/delete.sh new file mode 100755 index 0000000..11d057e --- /dev/null +++ b/deploy/delete.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Uninstalls esignet-artifactory +# Usage: ./delete.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function deleting_esignet_artifactory() { + NS=esignet + while true; do + read -p "Are you sure you want to delete artifactory helm chart?(Y/n) " yn + if [ $yn = "Y" ] + then + helm -n $NS delete esignet-artifactory + break + else + break + fi + done + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errtrace # trace ERR through 'time command' and other functions +set -o pipefail # trace ERR through pipes +deleting_esignet_artifactory # calling function \ No newline at end of file diff --git a/deploy/install.sh b/deploy/install.sh new file mode 100755 index 0000000..c5308b1 --- /dev/null +++ b/deploy/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Installs esignet-artifactory +## Usage: ./install.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +NS=esignet +CHART_VERSION=0.0.1-develop + +echo Create $NS namespace +kubectl create ns $NS + +function installing_esignet_artifactory() { + echo Istio label + kubectl label ns $NS istio-injection=enabled --overwrite + helm repo update + + echo Installing esignet-artifactory + helm -n $NS install esignet-artifactory mosip/artifactory --set image.repository=mosipdev/esignet-artifactory-server --set image.tag=develop --version $CHART_VERSION + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Installed esignet-artifactory service + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errtrace # trace ERR through 'time command' and other functions +set -o pipefail # trace ERR through pipes +installing_esignet_artifactory # calling function diff --git a/deploy/restart.sh b/deploy/restart.sh new file mode 100755 index 0000000..4350ba0 --- /dev/null +++ b/deploy/restart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Restart the esignet-artifactory service +## Usage: ./restart.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function Restarting_esignet_artifactory() { + NS=esignet + kubectl -n $NS rollout restart deploy + + kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status + + echo Restarted esignet-artifactory services + return 0 +} + +# set commands for error handling. +set -e +set -o errexit ## set -e : exit the script if any statement returns a non-true return value +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errtrace # trace ERR through 'time command' and other functions +set -o pipefail # trace ERR through pipes +Restarting_esignet_artifactory # calling function \ No newline at end of file From 942058858baadb58adff13647b64452f476acd62 Mon Sep 17 00:00:00 2001 From: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:27:43 +0530 Subject: [PATCH 2/2] Update README.md Signed-off-by: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> --- deploy/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index 4f450ae..99c506e 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,8 +1,8 @@ -# Artifactory +# eSignet-artifactory ## Install ```sh ./install.sh ``` ### Note: -Please ensure the esignet-artifactory docker image is verified before initiating the deployment. \ No newline at end of file +Please ensure the esignet-artifactory docker image is verified before initiating the deployment.