Skip to content

Commit

Permalink
MOSIP-32418 Merging java21 with develop
Browse files Browse the repository at this point in the history
Signed-off-by: Mohanachandran S <[email protected]>
  • Loading branch information
mohanachandran-s committed Jun 11, 2024
1 parent 5eae011 commit 812c520
Show file tree
Hide file tree
Showing 4 changed files with 258 additions and 389 deletions.
97 changes: 50 additions & 47 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ on:
- develop*
- MOSIP*
- qa-develop
- injiweb-468*
- inji-606*

jobs:
build-mimoto:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./
BUILD_ARTIFACT: mimoto
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
needs: build-mimoto
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./
secrets:
Expand All @@ -89,7 +89,7 @@ jobs:
sonar_analysis:
needs: build-mimoto
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./
secrets:
Expand All @@ -110,7 +110,7 @@ jobs:
SERVICE_NAME: 'mimoto'
BUILD_ARTIFACT: 'mimoto-recreated'
fail-fast: false
uses: mosip/kattu/.github/workflows/docker-build.yml@master
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
name: ${{ matrix.SERVICE_NAME }}
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
Expand All @@ -123,7 +123,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }}

build-maven-apitest-mimoto:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./apitest
BUILD_ARTIFACT: apitest-mimoto
Expand All @@ -134,10 +134,10 @@ jobs:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus_apitest_mimoto:
publish_to_nexus_apitest:
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-mimoto
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./apitest
secrets:
Expand All @@ -157,16 +157,18 @@ jobs:
SERVICE_LOCATION: apitest
BUILD_ARTIFACT: apitest-mimoto-local
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
ref: ${{ github.ref }}
java-version: 11
distribution: 'temurin'
java-version: '21'
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 "<settings> <servers> <server> <id>ossrh</id> <username>${{secrets.ossrh_user}}</username> <password>${{secrets.ossrh_secret}}</password> </server> </servers> <profiles> <profile> <id>ossrh</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>${{secrets.gpg_secret}}</gpg.passphrase> </properties> </profile> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository> <id>snapshots-repo</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>releases-repo</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </profile> <profile> <id>sonar</id> <properties> <sonar.sources>.</sonar.sources> <sonar.host.url>https://sonarcloud.io</sonar.host.url> </properties> <activation> <activeByDefault>false</activeByDefault> </activation> </profile> </profiles> </settings>" > $GITHUB_WORKSPACE/settings.xml

- name: Build Automationtests with Maven
run: |
cd ${{ env.SERVICE_LOCATION}}
Expand All @@ -186,6 +188,7 @@ jobs:
with:
name: ${{ env.BUILD_ARTIFACT }}
path: ${{ env.BUILD_ARTIFACT }}.zip

- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
Expand All @@ -195,39 +198,39 @@ jobs:
if: failure() # Pick up events even if the job fails or is canceled.

build-dockers_apitest_mimoto:
needs: build-apitest-mimoto-local
strategy:
matrix:
include:
- SERVICE_LOCATION: 'apitest'
SERVICE_NAME: 'apitest-mimoto'
BUILD_ARTIFACT: 'apitest-mimoto-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 }}
needs: build-apitest-mimoto-local
strategy:
matrix:
include:
- SERVICE_LOCATION: 'apitest'
SERVICE_NAME: 'apitest-mimoto'
BUILD_ARTIFACT: 'apitest-mimoto-local'
ONLY_DOCKER: true
fail-fast: false
name: ${{ matrix.SERVICE_NAME }}
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
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 }}

sonar_analysis_apitest_mimoto:
needs: build-maven-apitest-mimoto
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
with:
SERVICE_LOCATION: ./apitest
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 }}
needs: build-maven-apitest-mimoto
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./apitest
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 }}
32 changes: 13 additions & 19 deletions apitest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11
FROM mosipdev/openjdk-21-jre:latest

ARG SOURCE
ARG COMMIT_HASH
Expand All @@ -23,15 +23,6 @@ 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}

Expand All @@ -41,14 +32,17 @@ ADD ./apitest/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
# install packages and create user
RUN apt-get -y update \
&& apt-get install -y unzip jq curl \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} \
&& curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
&& mkdir -p /home/${container_user} \
&& chmod +x kubectl $work_dir/entrypoint.sh \
&& mv kubectl /usr/local/bin/ \
&& chown -R ${container_user}:${container_user} /home/${container_user} /etc/ssl/certs/java/cacerts \
&& chmod 644 /etc/ssl/certs/java/cacerts

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
Expand All @@ -60,4 +54,4 @@ ENV ENV_USER=
ENV ENV_ENDPOINT=
ENV ENV_TESTLEVEL=smokeAndRegression

ENTRYPOINT ["./entrypoint.sh"]
ENTRYPOINT ["./entrypoint.sh"]
Loading

0 comments on commit 812c520

Please sign in to comment.