Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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 #1091

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
277eb69
[DSD-6895] Updated base image from node:12.18.4-alpine to node:18-alpine
Prafulrakhade Dec 18, 2024
c7679f7
Merge branch 'develop' of https://github.com/Prafulrakhade/esignet in…
Prafulrakhade Jan 8, 2025
2c51d56
[MOSIP-38703] updated push-trigger.yml to Continue docker build only …
Prafulrakhade Jan 8, 2025
ef1261d
[MOSIP-38703] updated push-trigger.yml to Continue docker build only …
Prafulrakhade Jan 8, 2025
9a42d39
[MOSIP-38703] updated push-trigger.yml to Continue docker build only …
Prafulrakhade Jan 8, 2025
67246d9
Merge branch 'mosip:develop' into develop
Prafulrakhade Jan 9, 2025
0563f67
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 9, 2025
e98f2e8
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 9, 2025
83e3ff8
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 9, 2025
ea00687
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 9, 2025
da94a6d
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
d850929
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
77fb36d
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
c728a43
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
8d01e6e
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
518781b
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
5117ef0
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
76b2383
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
4ccb610
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
20a5bbe
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
7e274da
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
f238861
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
be8e0a8
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
9178fe6
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
bfff78d
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
f506e58
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
e44cc88
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
cb4acbc
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
ec7e01a
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
0eb0cfd
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
2175496
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
297b6b3
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
2fee294
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
79ad947
[MOSIP-38703],[MOSIP-38704] & [MOSIP-38707] updated push-trigger.yml …
Prafulrakhade Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/manual-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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:
# uses: mosip/kattu/.github/workflows/maven-build.yml@master
# with:
# SERVICE_LOCATION: ./
# BUILD_ARTIFACT: esignet
# 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 the Docker image manually if you want it without "-SNAPSHOT"
# manual-build-dockers:
# needs: build-maven-esignet
# if: ${{ github.event_name == 'workflow_dispatch' }} # Runs only when triggered manually
# strategy:
# matrix:
# include:
# - SERVICE_LOCATION: 'esignet-service'
# SERVICE_NAME: 'esignet'
# BUILD_ARTIFACT: 'esignet'
# - SERVICE_LOCATION: 'esignet-with-plugins'
# SERVICE_NAME: 'esignet-with-plugins'
# BUILD_ARTIFACT: 'esignet'
# 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-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 }}
96 changes: 94 additions & 2 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,72 @@ jobs:
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
Expand All @@ -50,7 +108,6 @@ jobs:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}


sonar_analysis:
needs: build-maven-esignet
if: "${{ github.event_name != 'pull_request' }}"
Expand Down Expand Up @@ -87,6 +144,41 @@ jobs:
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

build-maven-esignet-with-plugins:
uses: Prafulrakhade/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"
Prafulrakhade marked this conversation as resolved.
Show resolved Hide resolved
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, 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:
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}
85 changes: 84 additions & 1 deletion esignet-with-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<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>
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>mosip.emailnotifier@gmail.com</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,6 +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>

Expand Down
Loading