diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 1cbc66f..9587322 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -1,4 +1,4 @@ -name: Build postgres-init and masterdata-loader +name: Build postgres-init, postgres-upgrade and masterdata-loader on: release: @@ -18,6 +18,7 @@ on: - 1.* - develop - release* + - MOSIP* jobs: build-dockers: @@ -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 }} diff --git a/postgres-upgrade/get_db_data.sh b/postgres-upgrade/get_db_data.sh index 94b02d8..cbb3609 100755 --- a/postgres-upgrade/get_db_data.sh +++ b/postgres-upgrade/get_db_data.sh @@ -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 - diff --git a/postgres-upgrade/repo-list.txt b/postgres-upgrade/repo-list.txt index 7d83c57..d14c836 100644 --- a/postgres-upgrade/repo-list.txt +++ b/postgres-upgrade/repo-list.txt @@ -9,6 +9,6 @@ id-repository partner-management-services pre-registration registration -resident -otp-manager +resident-services digital-card-service +otp-manager