Skip to content

Commit

Permalink
Merge pull request #1094 from praful-technoforte/develop
Browse files Browse the repository at this point in the history
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
  • Loading branch information
ckm007 authored Jan 11, 2025
2 parents ef29186 + 9a7e401 commit bcc6f1a
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 18 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
9 changes: 9 additions & 0 deletions esignet-with-plugins/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
FROM mosipdev/esignet

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}

# copy all files under target/ to the plugins folder
COPY ./target/*.jar ${plugins_path_env}
90 changes: 86 additions & 4 deletions esignet-with-plugins/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 @@ -15,7 +15,9 @@
<version>1.5.1-SNAPSHOT</version>
<name>esignet-with-plugins</name>
<packaging>pom</packaging>

<description> Project of MOSIP e-Signet with Plugins</description>
<url>https://github.com/mosip/esignet</url>

<properties>
<java.version>11</java.version>
<esignet-plugins.location>target</esignet-plugins.location>
Expand All @@ -26,7 +28,40 @@
<sunbird-rc-plugin.version>1.3.1-SNAPSHOT</sunbird-rc-plugin.version>
<sunbird-rc-plugin.fileName>sunbird-rc-plugin.jar</sunbird-rc-plugin.fileName>
</properties>


<licenses>
<license>
<name>MPL 2.0</name>
<url>https://www.mozilla.org/en-US/MPL/2.0/</url>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/mosip/esignet.git</connection>
<developerConnection>scm:git:ssh://github.com:mosip/esignet.git</developerConnection>
<url>https://github.com/mosip/esignet</url>
<tag>HEAD</tag>
</scm>

<developers>
<developer>
<name>Mosip</name>
<email>[email protected]</email>
<organization>io.mosip</organization>
<organizationUrl>https://github.com/mosip/esignet</organizationUrl>
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<plugins>
Expand Down Expand Up @@ -75,7 +110,54 @@
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
</includeOnlyProperties>
<commitIdGenerationMode>full</commitIdGenerationMode>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<format>json</format>
</configuration>
</plugin>

</plugins>
</build>

</project>

0 comments on commit bcc6f1a

Please sign in to comment.