Skip to content
Merged
58 changes: 57 additions & 1 deletion .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build postgres-init and masterdata-loader
name: Build postgres-init, postgres-upgrade and masterdata-loader

on:
release:
Expand All @@ -18,6 +18,7 @@ on:
- 1.*
- develop
- release*
- MOSIP*

jobs:
build-dockers:
Expand All @@ -39,3 +40,58 @@ jobs:
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }}
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }}

get-db-upgrade-scripts:
runs-on: ubuntu-latest
env:
SERVICE_LOCATION: 'postgres-upgrade'
BUILD_ARTIFACT: 'postgres-upgrade-scripts'
steps:
- name: checkout
uses: actions/checkout@v3

- name: Setup branch and env
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV

- name: Clone DB upgrade scripts
run: |
cd ${{ env.SERVICE_LOCATION }}
bash ./get_db_data.sh ${{ env.BRANCH_NAME }}
- name: Ready the DB upgrade scripts
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }}
run: |
cd ${{ env.SERVICE_LOCATION }}
find ./repos/*/db_upgrade_scripts/ -type f -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} +

- name: Upload the upgrade scripts
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT }}
path: ${{ env.SERVICE_LOCATION }}/${{ env.BUILD_ARTIFACT }}.zip

build-upgrade-dockers:
needs: get-db-upgrade-scripts
strategy:
matrix:
include:
- SERVICE_LOCATION: 'postgres-upgrade'
SERVICE_NAME: 'postgres-upgrade'
BUILD_ARTIFACT: 'postgres-upgrade-scripts'
ONLY_DOCKER: true
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 }}
BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }}
ONLY_DOCKER: ${{ matrix.ONLY_DOCKER }}
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_DEVOPS }}
54 changes: 51 additions & 3 deletions postgres-upgrade/get_db_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,61 @@ while IFS= read -r line; do
fi
if [ $REPO_NAME == "mosip-compliance-toolkit" ]
then
branch=release-1.3.0
branch=v1.3.2
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "esignet" ]
branch=release-1.2.x
then
branch=v1.6.2
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "commons" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "id-authentication" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "keymanager" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "audit-manager" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "admin-services" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "id-repository" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "partner-management-services" ]
then
branch=v1.2.2.2
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "pre-registration" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "registration" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "resident-services" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "digital-card-service" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
elif [ $REPO_NAME == "otp-manager" ]
then
branch=release-1.3.x
git clone -b $branch https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
else
git clone -b $1 https://github.com/mosip/$REPO_NAME.git ./repos/$REPO_NAME
fi
done < ./repo-list.txt

4 changes: 2 additions & 2 deletions postgres-upgrade/repo-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ id-repository
partner-management-services
pre-registration
registration
resident
otp-manager
resident-services
digital-card-service
otp-manager