From 8a87a2d439fd864fa93f9d70649170b3e94b7944 Mon Sep 17 00:00:00 2001 From: VSIVAKALYAN Date: Fri, 19 Apr 2024 18:16:51 +0530 Subject: [PATCH] [DSD-5071] Updated push_trigger yml for mosip func tests Signed-off-by: VSIVAKALYAN --- .github/workflows/apitest-push-trigger.yml | 66 ++++++++ .github/workflows/authdemo-push-trigger.yml | 7 +- .../automationtests-push-trigger.yml | 147 ------------------ apitest-commons/Dockerfile | 63 -------- apitest-commons/entrypoint.sh | 4 - 5 files changed, 68 insertions(+), 219 deletions(-) create mode 100644 .github/workflows/apitest-push-trigger.yml delete mode 100644 .github/workflows/automationtests-push-trigger.yml delete mode 100644 apitest-commons/Dockerfile delete mode 100644 apitest-commons/entrypoint.sh diff --git a/.github/workflows/apitest-push-trigger.yml b/.github/workflows/apitest-push-trigger.yml new file mode 100644 index 00000000000..1f869396a95 --- /dev/null +++ b/.github/workflows/apitest-push-trigger.yml @@ -0,0 +1,66 @@ +name: Automationtests Build + +on: + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + workflow_call: + 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-apitest-commons: + uses: mosip/kattu/.github/workflows/maven-build.yml@master + with: + SERVICE_LOCATION: ./apitest-commons + BUILD_ARTIFACT: apitest-commons + 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 }} + + publish_to_nexus: + if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}" + needs: build-maven-apitest-commons + uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master + with: + SERVICE_LOCATION: ./apitest-commons + secrets: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + + sonar_analysis: + needs: build-maven-apitest-commons + if: "${{ github.event_name != 'pull_request' }}" + uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master + with: + SERVICE_LOCATION: ./apitest-commons + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + ORG_KEY: ${{ secrets.ORG_KEY }} + 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 }} diff --git a/.github/workflows/authdemo-push-trigger.yml b/.github/workflows/authdemo-push-trigger.yml index 905f833c0ff..23cfb02cc5c 100644 --- a/.github/workflows/authdemo-push-trigger.yml +++ b/.github/workflows/authdemo-push-trigger.yml @@ -17,7 +17,7 @@ on: - '!release-branch' - master - 1.* - - develop + - develop* - MOSIP* - release* - camdgc-* @@ -86,7 +86,4 @@ jobs: GPG_SECRET: ${{ secrets.GPG_SECRET }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - build-automation-tests: - needs: publish_to_nexus - uses: ./.github/workflows/automationtests-push-trigger.yml - secrets: inherit + diff --git a/.github/workflows/automationtests-push-trigger.yml b/.github/workflows/automationtests-push-trigger.yml deleted file mode 100644 index a5e5dd6823b..00000000000 --- a/.github/workflows/automationtests-push-trigger.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Automationtests Build - -on: - release: - types: [published] - pull_request: - types: [opened, reopened, synchronize] - workflow_call: - workflow_dispatch: - inputs: - message: - description: 'Message for manually triggering' - required: false - default: 'Triggered for Updates' - type: string - #release: - # types: [published] - #pull_request: - # types: [opened, reopened, synchronize] - #push: - # branches: - # - '!release-branch' - # - master - # - 1.* - # - develop - # - MOSIP* - # - release* - -jobs: - build-maven-automationtests: - uses: mosip/kattu/.github/workflows/maven-build.yml@master - with: - SERVICE_LOCATION: ./automationtests - BUILD_ARTIFACT: automationtests - 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-automationtests-local: - needs: build-maven-automationtests - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} - SERVICE_NAME: automationtests - SERVICE_LOCATION: automationtests - AUTH_SERVICE_LOCATION: authentication-demo-service - BUILD_ARTIFACT: automationtests-local - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - ref: ${{ github.ref }} - java-version: 11 - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Setup the settings file for ossrh server - run: echo " ossrh ${{secrets.ossrh_user}} ${{secrets.ossrh_secret}} ossrh true gpg2 ${{secrets.gpg_secret}} allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true releases-repo https://oss.sonatype.org/service/local/staging/deploy/maven2 true false sonar . https://sonarcloud.io false " > $GITHUB_WORKSPACE/settings.xml - - - name: Build Automationtests with Maven - run: | - cd ${{ env.SERVICE_LOCATION}} - mvn clean package -s $GITHUB_WORKSPACE/settings.xml - - - name: Copy configuration files to target directory. - run: | - cp -r ${{ env.SERVICE_LOCATION}}/target/classes/config ${{ env.SERVICE_LOCATION}}/target/config - cp -r ${{ env.SERVICE_LOCATION}}/testNgXmlFiles ${{ env.SERVICE_LOCATION}}/target/testNgXmlFiles - mv ${{ env.SERVICE_LOCATION}}/target/automationtests-*-dependencies.jar ${{ env.SERVICE_LOCATION}}/target/automationtests.jar - - - name: Ready the springboot artifacts - if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} - run: | - ## FIND JARS & COPY ONLY EXECUTABLE JARs STORED UNDER TARGET DIRECTORY - cd ${{ env.SERVICE_LOCATION }} && find ./ -path '*/target/*' -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + - - - name: Upload the springboot jars - if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} - uses: actions/upload-artifact@v3 - with: - name: ${{ env.BUILD_ARTIFACT }} - path: ./${{ env.SERVICE_LOCATION }}/${{ env.BUILD_ARTIFACT }}.zip - - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,author,commit,workflow,job # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required - if: failure() # Pick up events even if the job fails or is canceled. - - build-dockers: - needs: build-automationtests-local - strategy: - matrix: - include: - - SERVICE_LOCATION: 'automationtests' - SERVICE_NAME: 'automationtests' - BUILD_ARTIFACT: 'automationtests-local' - 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 }} - - publish_to_nexus: - if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}" - needs: build-maven-automationtests - uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master - with: - SERVICE_LOCATION: ./automationtests - secrets: - OSSRH_USER: ${{ secrets.OSSRH_USER }} - OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} - OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} - OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - - sonar_analysis: - needs: build-maven-automationtests - if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master - with: - SERVICE_LOCATION: ./automationtests - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - ORG_KEY: ${{ secrets.ORG_KEY }} - 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 }} diff --git a/apitest-commons/Dockerfile b/apitest-commons/Dockerfile deleted file mode 100644 index bc00e75899f..00000000000 --- a/apitest-commons/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM openjdk:11 - -ARG SOURCE -ARG COMMIT_HASH -ARG COMMIT_ID -ARG BUILD_TIME -LABEL source=${SOURCE} -LABEL commit_hash=${COMMIT_HASH} -LABEL commit_id=${COMMIT_ID} -LABEL build_time=${BUILD_TIME} - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_gid=1001 - -ARG KUBECTL_VERSION=1.22.9 - -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip jq \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ -&& chmod +x kubectl \ -&& mv kubectl /usr/local/bin/ - -# set working directory for the user -WORKDIR /home/${container_user} - -ENV work_dir=/home/${container_user} - -ADD ./target/ $work_dir - -ADD entrypoint.sh $work_dir/entrypoint.sh - -RUN chmod +x $work_dir/entrypoint.sh - -#ADD ./testNgXmlFiles/ $work_dir/testNgXmlFiles/ - -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-11/lib/security/cacerts - -RUN chmod 644 /usr/local/openjdk-11/lib/security/cacerts - -# select container user for all tasks -USER ${container_user_uid}:${container_user_gid} - -EXPOSE 8083 - -ENV MODULES= -ENV ENV_USER= -ENV ENV_ENDPOINT= -ENV ENV_TESTLEVEL=smokeAndRegression - -ENTRYPOINT ["./entrypoint.sh"] diff --git a/apitest-commons/entrypoint.sh b/apitest-commons/entrypoint.sh deleted file mode 100644 index b5650035359..00000000000 --- a/apitest-commons/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -## Run automationtests -java -jar -Dmodules="$MODULES" -Denv.user="$ENV_USER" -Denv.endpoint="$ENV_ENDPOINT" -Denv.testLevel="$ENV_TESTLEVEL" automationtests.jar;