From 8bac3446d55833b45698424dceed54a1b006434f Mon Sep 17 00:00:00 2001 From: PRAFUL RAKHADE <99539100+Prafulrakhade@users.noreply.github.com> Date: Thu, 5 Oct 2023 23:35:47 +0530 Subject: [PATCH] [MOSIP-29249] updated reusable workflow format (#29) * [MOSIP-29249] updated reusable workflow format * [MOSIP-29249] updated reusable workflow format --- .github/keys/mosipgpgkey_pub.gpg | Bin 0 -> 1270 bytes .github/keys/mosipgpgkey_sec.gpg | Bin 0 -> 2663 bytes .github/workflows/mediator_push_trigger.yml | 102 ------------ .github/workflows/push-trigger.yml | 89 +++++++++++ .../workflows/regproc_stage_push_trigger.yml | 102 ------------ .github/workflows/tag.yml | 35 +++++ mediator/pom.xml | 146 ++++++++++++++++++ registration-processor-opencrvs-stage/pom.xml | 78 ++++++++++ 8 files changed, 348 insertions(+), 204 deletions(-) create mode 100644 .github/keys/mosipgpgkey_pub.gpg create mode 100644 .github/keys/mosipgpgkey_sec.gpg delete mode 100644 .github/workflows/mediator_push_trigger.yml create mode 100644 .github/workflows/push-trigger.yml delete mode 100644 .github/workflows/regproc_stage_push_trigger.yml create mode 100644 .github/workflows/tag.yml diff --git a/.github/keys/mosipgpgkey_pub.gpg b/.github/keys/mosipgpgkey_pub.gpg new file mode 100644 index 0000000000000000000000000000000000000000..4bdb1a947beaa877a93b56a2074580cdd9bf0578 GIT binary patch literal 1270 zcmbQq$jcHZy2y@^gW*i(B_ZoOO}xok8QrJ7Cf&}qetdqLrPuP}`P;)T-Y(VI_HkO_ z1{{w_f#RHj!qd-^bJoQmWM7;XW@lbzf|A4J(W)_uZi-T`J_?5k8I!A{8+V6Y2-?iCh1xP-B zIq6E*9lP}7Ro)kBJiO-Q-t)Wj;Fy-k3!e44+^24G7$(eOmrP(w-?^yl?-s_Lj~{U? z|Iz2Tvh0=vd*g}qnQnX5u8!QgWqQ&|20=y!#w{MX`Nf$93K}69nZ*h~1mWf;mZjz? zB&X(;6eZ>;6r~pAYbw})rSwvB6Ek!2@=G$)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iVx)hWwg)zdwrEa{_G%_ z68Tp`giRFXQ_-f#h=?wT!d?kWbu-nR(edIm3M}h0=65#1d;N)74v&nWsbc$;;htvro%w;%G@v${ z*xxkDfW&$JAAsQh1+d5t!cvf!{3_=ofw(Xpom#0t9iu(hPFsH83m4iS5Xy;ra{iP~ z?1`I{(IE{)wYI0 zp?Lro`tclyiF&K_MBTH9kbUsg=yu-maA!*_U*}`HPj-_Wbh&ke5YP9M2PwKR~+0n z`yU!zDyk)lFb4N<72OjB)L)J#F`fE*5><~{u0AZpb_3h}4U&GS>wU*FJ#yt)=4Y@a SkkiE(Bh1Lh;14qU=Klc8TJt&p literal 0 HcmV?d00001 diff --git a/.github/workflows/mediator_push_trigger.yml b/.github/workflows/mediator_push_trigger.yml deleted file mode 100644 index 6b6c175..0000000 --- a/.github/workflows/mediator_push_trigger.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Mediator Maven Package and docker upon a push - -on: - push: - paths: - - mediator/** - branches: - - '!release-branch' - - release-1* - - master - - 1.* - - develop* -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Build Mediator with Maven - run: | - cd mediator - mvn -B clean package - - - name: Ready the springboot artifacts - run: find -name '*.jar' -type f -exec zip release.zip {} + - - - name: Upload the springboot jars - uses: actions/upload-artifact@v1 - with: - name: release - path: ./release.zip - - docker-opencrvs-mediator: - needs: build - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} - SERVICE_NAME: mosip-opencrvs-mediator - SERVICE_LOCATION: mediator - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch and version - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the resident-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - if [[ $BRANCH_NAME == main || $BRANCH_NAME == master ]]; then - VERSION=latest - else - VERSION=$BRANCH_NAME - fi - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml new file mode 100644 index 0000000..3f9797f --- /dev/null +++ b/.github/workflows/push-trigger.yml @@ -0,0 +1,89 @@ +name: Maven Package upon a push + +on: + release: + types: [published] + pull_request: + types: [opened] + workflow_dispatch: + inputs: + message: + description: 'Message for manually triggering' + required: false + default: 'Triggered for Updates' + type: string + push: + branches: + - '!release-branch' + - master + - 1.* + - develop + - MOSIP* + - release* + +jobs: + build-maven-opencrvs-mediator: + uses: mosip/kattu/.github/workflows/maven-build.yml@master + with: + SERVICE_LOCATION: mediator + BUILD_ARTIFACT: opencrvs-mediator + secrets: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + build-dockers: + needs: build-maven-opencrvs-mediator + strategy: + matrix: + include: + - SERVICE_LOCATION: 'mediator' + SERVICE_NAME: 'mosip-opencrvs-mediator' + BUILD_ARTIFACT: 'opencrvs-mediator' + 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 }} + 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 }} + + build-maven-regproc-opencrvs-stage: + uses: mosip/kattu/.github/workflows/maven-build.yml@master + with: + SERVICE_LOCATION: registration-processor-opencrvs-stage + BUILD_ARTIFACT: registration-processor-opencrvs-stage + secrets: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + build-dockers-regproc-opencrvs-stage: + needs: build-maven-regproc-opencrvs-stage + strategy: + matrix: + include: + - SERVICE_LOCATION: 'registration-processor-opencrvs-stage' + SERVICE_NAME: 'registration-processor-opencrvs-stage' + BUILD_ARTIFACT: 'registration-processor-opencrvs-stage' + 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 }} + 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 }} \ No newline at end of file diff --git a/.github/workflows/regproc_stage_push_trigger.yml b/.github/workflows/regproc_stage_push_trigger.yml deleted file mode 100644 index 0f72ea1..0000000 --- a/.github/workflows/regproc_stage_push_trigger.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Regproc Opencrvs Stage Maven Package and docker upon a push - -on: - push: - paths: - - registration-processor-opencrvs-stage/** - branches: - - '!release-branch' - - release-1* - - master - - 1.* - - develop* -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.BRANCH_NAME }} - - - name: Build Regproc Stage with Maven - run: | - cd registration-processor-opencrvs-stage - mvn -B clean package - - - name: Ready the springboot artifacts - run: find -name '*.jar' -type f -exec zip release.zip {} + - - - name: Upload the springboot jars - uses: actions/upload-artifact@v1 - with: - name: release - path: ./release.zip - - docker-repgroc-opencrvs-stage: - needs: build - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} - SERVICE_NAME: registration-processor-opencrvs-stage - SERVICE_LOCATION: registration-processor-opencrvs-stage - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v1 - with: - name: release - path: ./ - - - name: Setup branch and version - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - name: Get version info from pom - id: getPomVersion - uses: mavrosxristoforos/get-xml-info@1.0 - with: - xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml - xpath: /*[local-name()="project"]/*[local-name()="version"] - - - name: Unzip and extract the resident-service - run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target" - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo "push version ${{steps.getPomVersion.outputs.info}}" - if [[ $BRANCH_NAME == main || $BRANCH_NAME == master ]]; then - VERSION=latest - else - VERSION=$BRANCH_NAME - fi - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..9a5b079 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,35 @@ +name: Tagging of repos + +on: + workflow_dispatch: + inputs: + TAG: + description: 'Tag to be published' + required: true + type: string + BODY: + description: 'Release body message' + required: true + default: 'Changes in this Release' + type: string + PRE_RELEASE: + description: 'Pre-release? True/False' + required: true + default: False + type: string + DRAFT: + description: 'Draft? True/False' + required: false + default: False + type: string + +jobs: + tag-branch: + uses: mosip/kattu/.github/workflows/tag.yml@master + with: + TAG: ${{ inputs.TAG }} + BODY: ${{ inputs.BODY }} + PRE_RELEASE: ${{ inputs.PRE_RELEASE }} + DRAFT: ${{ inputs.DRAFT }} + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/mediator/pom.xml b/mediator/pom.xml index a57d0f7..ff4788b 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -8,6 +8,29 @@ opencrvs-mediator opencrvs-mediator 1.2.1-SNAPSHOT + + + + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ + + + + scm:git:git://github.com/mosip/mosip-opencrvs.git + scm:git:ssh://github.com:mosip/mosip-opencrvs.git + https://github.com/mosip/mosip-opencrvs + HEAD + + + + + Mosip + mosip.emailnotifier@gmail.com + io.mosip + https://github.com/mosip/mosip-opencrvs + + + 1.2.0 1.2.0 @@ -141,6 +164,51 @@ 11 + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + get-the-git-infos + + revision + + validate + + + + true + ${project.build.outputDirectory}/git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + + + maven-surefire-plugin 2.22.1 @@ -163,6 +231,84 @@ + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + ZIP + + + + + build-info + repackage + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + ZIP + + + + pre-integration-test + + start + + + + src/test/resources + + + openapi-profile + + + --server.port=8090 + --server.servlet.path=/app/generic + + + + + post-integration-test + + stop + + + + + build-info + repackage + + + + + + org.springdoc + springdoc-openapi-maven-plugin + 0.2 + + + integration-test + + generate + + + + + http://localhost:8090/app/generic/v3/api-docs + ${name}-openapi.json + + ${project.build.directory} + false + + diff --git a/registration-processor-opencrvs-stage/pom.xml b/registration-processor-opencrvs-stage/pom.xml index 6291d35..9889a3f 100644 --- a/registration-processor-opencrvs-stage/pom.xml +++ b/registration-processor-opencrvs-stage/pom.xml @@ -8,6 +8,29 @@ registration-processor-opencrvs-stage registration-processor-opencrvs-stage 1.2.1-SNAPSHOT + + + + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ + + + + scm:git:git://github.com/mosip/mosip-opencrvs.git + scm:git:ssh://github.com:mosip/mosip-opencrvs.git + https://github.com/mosip/mosip-opencrvs + HEAD + + + + + Mosip + mosip.emailnotifier@gmail.com + io.mosip + https://github.com/mosip/mosip-opencrvs + + + 11 11 @@ -42,6 +65,16 @@ + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + org.mockito @@ -185,6 +218,51 @@ 11 + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + get-the-git-infos + + revision + + validate + + + + true + ${project.build.outputDirectory}/git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + + + org.springframework.boot spring-boot-maven-plugin