Skip to content

Commit

Permalink
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml … (
Browse files Browse the repository at this point in the history
#1103)

* [MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml to Continue docker build only if the SNAPSHOT is present in parent pom otherwise skip

Signed-off-by: techno-467 <[email protected]>

* [MOSIP-38705] & [38705] added installation script for esignet-with-plugins and for esignet.

Signed-off-by: techno-467 <[email protected]>

* [MOSIP-38705] & [38705] added installation script for esignet-with-plugins and for esignet.

Signed-off-by: techno-467 <[email protected]>

* [MOSIP-38705] & [38705] added installation script for esignet-with-plugins and for esignet.

Signed-off-by: techno-467 <[email protected]>

---------

Signed-off-by: techno-467 <[email protected]>
Co-authored-by: techno-467 <[email protected]>
  • Loading branch information
praful-technoforte and Prafulrakhade authored Jan 16, 2025
1 parent b07daa3 commit 64b9415
Show file tree
Hide file tree
Showing 9 changed files with 363 additions and 80 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/manual-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Manual Docker Build for without -SNAPSHOT

on:
workflow_dispatch:
inputs:
message:
description: 'Message for manually triggering'
required: false
default: 'Triggered for Updates'
type: string

jobs:

build_maven_esignet_with_plugins:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./esignet-with-plugins
BUILD_ARTIFACT: esignet-with-plugins
MAVEN_NON_EXEC_ARTIFACTS: "esignet-mock-plugin.jar,mosip-identity-plugin.jar,sunbird-rc-plugin.jar"
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_with_esignet_plugins:
needs: build_maven_esignet_with_plugins
if: ${{ github.event_name == 'workflow_dispatch' }} # Runs only when triggered manually
strategy:
matrix:
include:
- SERVICE_LOCATION: 'esignet-with-plugins'
SERVICE_NAME: 'esignet-with-plugins'
BUILD_ARTIFACT: 'esignet-with-plugins'
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 }}
120 changes: 106 additions & 14 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,80 @@ on:
- ES-842

jobs:
build-maven-esignet:
build_maven_esignet:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./
BUILD_ARTIFACT: esignet
MAVEN_NON_EXEC_ARTIFACTS: esignet-plugins
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 }}

check_snapshot_version:
runs-on: ubuntu-latest
outputs:
is_condition: ${{ steps.check_output.outputs.is_condition }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Check for -SNAPSHOT version in pom.xml files
id: check_output
shell: bash
run: |
# Initialize the flag that will hold the result
condition_met=false
echo "Initial condition_met: $condition_met"
# Loop through each pom.xml file and check if -SNAPSHOT version is present in the parent block
for pom_file in $(find . -name "pom.xml"); do
echo "Processing $pom_file"
# Extract the <parent> block from the pom.xml
parent_block=$(awk '/<parent>/,/<\/parent>/' "$pom_file")
# If there's no <parent> block, skip this file and move to the next one
if [ -z "$parent_block" ]; then
echo "No <parent> block found in $pom_file, skipping this file."
continue
fi
# Debug: Print the entire parent block for verification
echo "Checking the following parent block in $pom_file:"
echo "$parent_block"
# Extract the <version> field from the <parent> block
version_in_parent=$(echo "$parent_block" | grep -oP '<version>\K.*(?=</version>)')
# Debug the extracted version
echo "Extracted version in $pom_file: $version_in_parent"
# Check if the version contains '-SNAPSHOT'
if [[ "$version_in_parent" == *"-SNAPSHOT"* ]]; then
echo "Found '-SNAPSHOT' version in $pom_file."
condition_met=true
break # Stop checking further files once we find '-SNAPSHOT'
else
echo "No '-SNAPSHOT' version found in $pom_file."
fi
done
# Debug the final condition_met value
echo "Final condition_met value: $condition_met"
# Set the output for the next step
echo "::set-output name=is_condition::$condition_met"
- name: Debug Condition Output
run: |
echo "Condition Met: ${{ steps.check_output.outputs.is_condition }}"
publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
needs: build-maven-esignet
needs: build_maven_esignet
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
with:
SERVICE_LOCATION: ./
Expand All @@ -50,9 +108,8 @@ jobs:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}


sonar_analysis:
needs: build-maven-esignet
needs: build_maven_esignet
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
with:
Expand All @@ -66,8 +123,8 @@ jobs:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-dockers:
needs: build-maven-esignet
build_dockers:
needs: build_maven_esignet
strategy:
matrix:
include:
Expand All @@ -87,7 +144,42 @@ jobs:
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-dockers-oidc-ui:
build_maven_esignet_with_plugins:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./esignet-with-plugins
BUILD_ARTIFACT: esignet-with-plugins
MAVEN_NON_EXEC_ARTIFACTS: "esignet-mock-plugin.jar,mosip-identity-plugin.jar,sunbird-rc-plugin.jar"
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_esignet_with_plugins:
needs: [build_maven_esignet_with_plugins, check_snapshot_version, publish_to_nexus]
if: ${{ needs.check_snapshot_version.outputs.is_condition == 'true' }}
strategy:
matrix:
include:
- SERVICE_LOCATION: 'esignet-with-plugins'
SERVICE_NAME: 'esignet-with-plugins'
BUILD_ARTIFACT: 'esignet-with-plugins'
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_dockers_oidc_ui:
strategy:
matrix:
include:
Expand All @@ -105,7 +197,7 @@ jobs:
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-maven-apitest-esignet:
build_maven_apitest_esignet:
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./api-test
Expand All @@ -119,7 +211,7 @@ jobs:

publish_to_nexus_apitest_esignet:
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-esignet
needs: build_maven_apitest_esignet
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./api-test
Expand All @@ -131,8 +223,8 @@ jobs:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-apitest-esignet-local:
needs: build-maven-apitest-esignet
build_apitest_esignet_local:
needs: build_maven_apitest_esignet
runs-on: ubuntu-latest
env:
NAMESPACE: ${{ secrets.dev_namespace_docker_hub }}
Expand Down Expand Up @@ -177,8 +269,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: failure() # Pick up events even if the job fails or is canceled.

build-dockers_apitest_esignet:
needs: build-apitest-esignet-local
build_dockers_apitest_esignet:
needs: build_apitest_esignet_local
strategy:
matrix:
include:
Expand Down
18 changes: 6 additions & 12 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ This is the docker compose setup to run esignet UI and esignet-service with mock

1. Open terminal and go to "docker-compose" folder.
2. Run `docker compose --file dependent-docker-compose.yml up` to start all the dependent services.
3. Go to command line for the project root directory and run `mvn clean install -Dgpg.skip=true -DskipTests=true`
4. Add [esignet-mock-plugin.jar](../esignet-service/target/esignet-plugins/esignet-mock-plugin.jar) to esignet-service classpath in your IDE.
3. Go to [esignet-with-plugins](../esignet-with-plugins) folder and run `mvn clean install -Dgpg.skip=true` from the command line.
4. Add [esignet-mock-plugin.jar](../esignet-with-plugins/target/esignet-mock-plugin.jar) to esignet-service classpath in your IDE.
5. Start the [EsignetServiceApplication.java](../esignet-service/src/main/java/io/mosip/esignet/EsignetServiceApplication.java) from your IDE.
6. Import files under [postman-collection](../postman-collection) folder into your postman to test/validate OIDC flow.

Expand All @@ -18,10 +18,10 @@ This is the docker compose setup to run esignet UI and esignet-service with mock
3. Access eSignet UI at http://localhost:3000
4. Access eSignet backend services at http://localhost:8088/v1/esignet/swagger-ui.html
5. Onboard relying party in eSignet, import all files under [postman-collection](../postman-collection) folder into your postman. Choose `eSignet-with-mock` environment in the postman and invoke below requests under `OIDC Client Mgmt` -> `Mock` folder in postman.

a. `Get CSRF token`

b. `Create OIDC client` -> Make sure to update redirect Urls and logo URL as per your requirement in the request body.
a. `Get CSRF token`

b. `Create OIDC client` -> Make sure to update redirect Urls and logo URL as per your requirement in the request body.

6. Copy the client ID in the `Create OIDC client` response.
7. Add a `SignIn with eSignet` button in the relying party website and embed [eSignet authorize URL](http://localhost:3000/authorize?nonce=ere973eieljznge2311&state=eree2311&client_id=client_id&redirect_uri=redirect_uri&scope=openid&response_type=code&acr_values=mosip:idp:acr:generated-code&claims_locales=en&ui_locales=en-IN) in the button. Update the below query parameter in the eSignet authorize URL before embedding in the button.
Expand All @@ -30,17 +30,11 @@ This is the docker compose setup to run esignet UI and esignet-service with mock

b. `redirect_uri` -> As updated in step 5

8. Add a user in the mock-identity-system. Invoke `Creat User` request under `User Mgmt` -> `Mock` folder in the postman.
8. Add a user in the mock-identity-system. Invoke `Creat User` request under `User Mgmt` -> `Mock` folder in the postman.
9. Now the setup is completely ready to start the OIDC flow. [Refer eSignet user guides](https://docs.esignet.io/end-user-guide) for more information.

`Note: To know more about the relying party onboard and query parameters used in the eSignet authorize URL `[refer eSignet docs](https://docs.esignet.io/integration/relying-party)

## How to add user identity in the mock-identity-system?

1. Import files under [postman-collection](../postman-collection) folder into your postman. And invoke requests under `User Mgmt/Mock` folder in postman.






2 changes: 1 addition & 1 deletion docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
- database

esignet:
image: 'mosipdev/esignet:release-1.5.x'
image: 'mosipdev/esignet-with-plugins:release-1.5.x'
user: root
ports:
- 8088:8088
Expand Down
8 changes: 3 additions & 5 deletions esignet-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,13 @@ RUN apt-get -y update \
&& wget https://raw.githubusercontent.com/mosip/artifactory-ref-impl/v1.2.0.3/artifacts/src/hsm/client.zip -O client.zip \
&& chown -R ${container_user}:${container_user} /home/${container_user}

# copy all files under target/esignet-plugins to the plugins folder
COPY ./target/*-plugin.jar ${plugins_path}
COPY ./src/main/resources/amr_acr_mapping.json ${work_dir}/amr_acr_mapping.json

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}

EXPOSE 8088
EXPOSE 9010
EXPOSE 8088 9010

ENTRYPOINT [ "./configure_start.sh" ]
CMD java -jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" esignet-service.jar

CMD ["java", "-jar", "-Dloader.path=${loader_path_env}", "-Dspring.cloud.config.label=${spring_config_label_env}", "-Dspring.profiles.active=${active_profile_env}", "-Dspring.cloud.config.uri=${spring_config_url_env}", "esignet-service.jar"]
51 changes: 3 additions & 48 deletions esignet-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.mosip.esignet</groupId>
Expand All @@ -16,7 +16,7 @@
<version>1.5.0-SNAPSHOT</version>
<name>esignet-service</name>
<description>e-Signet OIDC Service</description>

<properties>
<java.version>11</java.version>
<jackson.version>2.9.5</jackson.version>
Expand All @@ -33,7 +33,7 @@
<esignet-digital-credential-wrapper.version>0.2.0</esignet-digital-credential-wrapper.version>
<esignet-digital-credential-wrapper.fileName>sunbird-rc-esignet-plugin.jar</esignet-digital-credential-wrapper.fileName>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -114,51 +114,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.mosip.esignet</groupId>
<artifactId>mosip-identity-plugin</artifactId>
<version>${mosip-identity-plugin.version}</version>
<outputDirectory>${esignet-plugins.location}</outputDirectory>
<destFileName>${mosip-identity-plugin.fileName}</destFileName>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>io.mosip.esignet</groupId>
<artifactId>mock-plugin</artifactId>
<version>${esignet-mock-plugin.version}</version>
<outputDirectory>${esignet-plugins.location}</outputDirectory>
<destFileName>${esignet-mock-plugin.fileName}</destFileName>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>io.mosip.esignet.sunbirdrc</groupId>
<artifactId>sunbird-rc-esignet-integration-impl</artifactId>
<version>${esignet-digital-credential-wrapper.version}</version>
<outputDirectory>${esignet-plugins.location}</outputDirectory>
<destFileName>${esignet-digital-credential-wrapper.fileName}</destFileName>
<type>jar</type>
</artifactItem>
</artifactItems>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit 64b9415

Please sign in to comment.