Skip to content

[MOSIP-37901]: Exclude mosip services being published to nexus (develop)#1701

Open
NidhiKumari0201 wants to merge 1 commit into
mosip:developfrom
NidhiKumari0201:MOSIP-37901-develop-nexus
Open

[MOSIP-37901]: Exclude mosip services being published to nexus (develop)#1701
NidhiKumari0201 wants to merge 1 commit into
mosip:developfrom
NidhiKumari0201:MOSIP-37901-develop-nexus

Conversation

@NidhiKumari0201
Copy link
Copy Markdown

@NidhiKumari0201 NidhiKumari0201 commented Apr 10, 2026

Summary by CodeRabbit

  • Chores
    • Updated continuous integration workflow configuration to use a revised release endpoint for managing artifact publishing operations across deployment scenarios.
    • Enhanced Maven project build configuration with explicit plugin version definitions and refined artifact publishing process to improve release workflow management and operational control.

Signed-off-by: Nidhi0201 <nidhi.k@cyberpwn.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Walkthrough

The pull request updates the GitHub Actions workflow to use a different OSSRH URL secret for publishing steps and adds Maven plugin configurations to manage artifact deployment and central publishing with lifecycle controls to prevent automatic deployment during standard builds.

Changes

Cohort / File(s) Summary
CI/CD Publishing Configuration
.github/workflows/push-trigger.yml
Updated two workflow calls to reference ${{ secrets.RELEASE_URL }} instead of ${{ secrets.OSSRH_SNAPSHOT_URL }} for the OSSRH secret input.
Maven Build Publishing Setup
esignet-service/pom.xml
Added Maven plugin properties for maven-deploy-plugin and central-publishing-maven-plugin versions. Configured maven-deploy-plugin to skip deployment during normal lifecycle and added central-publishing-maven-plugin with publishing disabled by default (phase=none, autoPublish=false).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The pipeline hops with secrets new,
Maven plugins keep deploy in view,
Snapshots fade, releases take the stage,
A publish dance upon the page!
hop hop 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: preventing MOSIP services from being published to Nexus by modifying workflow secrets and adding Maven plugin configurations to disable deployment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/push-trigger.yml:
- Line 117: Both publish jobs currently set OSSRH_URL to secrets.RELEASE_URL
unconditionally, risking snapshot/dev builds being pushed to release endpoint;
update the publish job definitions in push-trigger.yml that set OSSRH_URL to
instead: 1) gate the job with a release-only condition (e.g., if:
github.event_name == 'release' || github.ref == 'refs/heads/master') or 2)
choose the URL based on the artifact version/branch (use secrets.RELEASE_URL for
real releases and a separate secrets.SNAPSHOT_URL for -SNAPSHOT builds or
non-release branches). Locate the places that assign OSSRH_URL (the lines using
OSSRH_URL: ${{ secrets.RELEASE_URL }}) and modify the job conditions or replace
the value with a conditional expression that checks release context or version
suffix to select RELEASE_URL vs SNAPSHOT_URL.

In `@esignet-service/pom.xml`:
- Around line 114-132: Remove the unconditional skip settings on the
maven-deploy-plugin so the reusable workflow can run mvn deploy: delete the
plugin-level <skip>true</skip> and the execution-level <skip>true</skip> in the
maven-deploy-plugin configuration (leave the <phase>none</phase> and the
<execution id="default-deploy"> block intact to avoid automatic lifecycle
deploy); ensure the plugin artifactId "maven-deploy-plugin" and the execution
with id "default-deploy" remain but no longer contain any <skip>true</skip>
entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 98e41219-c25c-49c9-8a66-72a4c92afa2f

📥 Commits

Reviewing files that changed from the base of the PR and between 24e0c88 and 45372ad.

📒 Files selected for processing (2)
  • .github/workflows/push-trigger.yml
  • esignet-service/pom.xml

OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_URL: ${{ secrets.RELEASE_URL }}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Local workflow checks =="
rg -n -C2 "publish_to_nexus:|publish_to_nexus_apitest_esignet:|if:|OSSRH_URL:" .github/workflows/push-trigger.yml

echo
echo "== Confirm snapshot versions currently used in repo =="
rg -n "<version>.*-SNAPSHOT</version>" pom.xml '**/pom.xml'

Repository: mosip/esignet

Length of output: 3738


Both publish jobs use RELEASE_URL while allowing SNAPSHOT versions on non-release branches.

Line 109 publishes to release URL on any non-master branch (excluding PRs). Line 240 publishes to release URL while explicitly excluding actual release events. With SNAPSHOT versions in the codebase (1.8.0-SNAPSHOT), this risks publishing development builds to production endpoints or failures from release URL rejecting snapshots. Tighten job conditions to gate publish jobs by release context, or use conditional URL selection based on version/branch.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/push-trigger.yml at line 117, Both publish jobs currently
set OSSRH_URL to secrets.RELEASE_URL unconditionally, risking snapshot/dev
builds being pushed to release endpoint; update the publish job definitions in
push-trigger.yml that set OSSRH_URL to instead: 1) gate the job with a
release-only condition (e.g., if: github.event_name == 'release' || github.ref
== 'refs/heads/master') or 2) choose the URL based on the artifact
version/branch (use secrets.RELEASE_URL for real releases and a separate
secrets.SNAPSHOT_URL for -SNAPSHOT builds or non-release branches). Locate the
places that assign OSSRH_URL (the lines using OSSRH_URL: ${{ secrets.RELEASE_URL
}}) and modify the job conditions or replace the value with a conditional
expression that checks release context or version suffix to select RELEASE_URL
vs SNAPSHOT_URL.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest fix?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NidhiKumari0201, here's a concrete fix. The core problem is:

  • publish_to_nexus_apitest_esignet already excludes release events in its if: condition, yet uses RELEASE_URL — so SNAPSHOT artifacts would hit a release endpoint on every develop push.
  • publish_to_nexus runs on non-master non-PR branches (including develop with SNAPSHOT versions), same issue.

Since GitHub Actions doesn't allow conditional secret selection inline in secrets: blocks of reusable workflow calls, the cleanest approach is to split each publish job into two — one for release, one for snapshots — with appropriate conditions:

  # ── Release publish (triggered only on GitHub release events) ──────────────
  publish_to_nexus:
    if: "${{ github.event_name == 'release' }}"
    needs: build_maven_esignet
    uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
    with:
      SERVICE_LOCATION: ./
    secrets:
      OSSRH_USER: ${{ secrets.OSSRH_USER }}
      OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
      OSSRH_URL: ${{ secrets.RELEASE_URL }}
      OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
      GPG_SECRET: ${{ secrets.GPG_SECRET }}
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

  # ── Snapshot publish (develop / feature branches, not PRs, not releases) ───
  publish_snapshot_to_nexus:
    if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' }}"
    needs: build_maven_esignet
    uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
    with:
      SERVICE_LOCATION: ./
    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 }}

  # ── Release publish for api-test (only on release events) ──────────────────
  publish_to_nexus_apitest_esignet:
    if: "${{ github.event_name == 'release' }}"
    needs: build_maven_apitest_esignet
    uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
    with:
      SERVICE_LOCATION: ./api-test
    secrets:
      OSSRH_USER: ${{ secrets.OSSRH_USER }}
      OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
      OSSRH_URL: ${{ secrets.RELEASE_URL }}
      OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
      GPG_SECRET: ${{ secrets.GPG_SECRET }}
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

  # ── Snapshot publish for api-test (develop / feature branches) ─────────────
  publish_snapshot_to_nexus_apitest_esignet:
    if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' }}"
    needs: build_maven_apitest_esignet
    uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
    with:
      SERVICE_LOCATION: ./api-test
    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 }}

Note: Also update the build_dockers_esignet_with_plugins job's needs: array — it currently depends on publish_to_nexus. After the split, change it to:

needs: [build_maven_esignet_with_plugins, check_snapshot_version, publish_to_nexus, publish_snapshot_to_nexus]

Summary of the fix:

Job Condition URL used
publish_to_nexus event == release RELEASE_URL
publish_snapshot_to_nexus non-master, non-PR, non-release OSSRH_SNAPSHOT_URL
publish_to_nexus_apitest_esignet event == release RELEASE_URL
publish_snapshot_to_nexus_apitest_esignet non-master, non-PR, non-release OSSRH_SNAPSHOT_URL

Comment thread esignet-service/pom.xml
Comment on lines +114 to +132
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.deploy.plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Inspect external reusable workflow =="
curl -fsSL https://raw.githubusercontent.com/mosip/kattu/master-java21/.github/workflows/maven-publish-to-nexus.yml \
  | nl -ba | sed -n '1,260p'

echo
echo "== Find Maven publish command + deploy skip override presence =="
curl -fsSL https://raw.githubusercontent.com/mosip/kattu/master-java21/.github/workflows/maven-publish-to-nexus.yml \
  | rg -n "mvn|deploy|central-publishing|maven.deploy.skip|OSSRH_URL|settings.xml"

Repository: mosip/esignet

Length of output: 188


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Fetching external reusable workflow =="
WORKFLOW=$(curl -fsSL https://raw.githubusercontent.com/mosip/kattu/master-java21/.github/workflows/maven-publish-to-nexus.yml)

if [ -z "$WORKFLOW" ]; then
  echo "Failed to fetch workflow. Trying alternative path..."
  curl -fsSL https://raw.githubusercontent.com/mosip/kattu/refs/heads/master-java21/.github/workflows/maven-publish-to-nexus.yml 2>&1 | head -50
  exit 1
fi

echo "$WORKFLOW" | head -100

echo
echo "== Searching for Maven deploy invocations =="
echo "$WORKFLOW" | grep -n "mvn\|deploy\|central-publishing\|maven.deploy\|OSSRH\|settings" || echo "(no matches found)"

echo
echo "== Full workflow content (first 300 lines) =="
echo "$WORKFLOW" | head -300

Repository: mosip/esignet

Length of output: 10169


maven-deploy-plugin skip configuration blocks release publishing—the maven-publish-to-nexus workflow will fail.

The reusable workflow calls mvn deploy explicitly (line 68 of maven-publish-to-nexus.yml) without overriding the deploy skip flag. However, line 118 of pom.xml sets plugin-level <skip>true</skip>, which suppresses the deploy plugin unconditionally. This prevents any release deployment to Nexus, regardless of the workflow's intent.

To fix, remove both the plugin-level <skip>true</skip> (line 118) and the execution-level <skip>true</skip> (line 131). Keep <phase>none</phase> (line 123) to prevent automatic lifecycle deploy on develop:

Required fix
 <plugin>
   <artifactId>maven-deploy-plugin</artifactId>
   <version>${maven.deploy.plugin.version}</version>
-  <configuration>
-    <skip>true</skip>
-  </configuration>
   <executions>
     <execution>
       <id>default-deploy</id>
       <phase>none</phase>
       <goals>
         <goal>deploy</goal>
       </goals>
-      <configuration>
-        <skip>true</skip>
-      </configuration>
     </execution>
   </executions>
 </plugin>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.deploy.plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.deploy.plugin.version}</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@esignet-service/pom.xml` around lines 114 - 132, Remove the unconditional
skip settings on the maven-deploy-plugin so the reusable workflow can run mvn
deploy: delete the plugin-level <skip>true</skip> and the execution-level
<skip>true</skip> in the maven-deploy-plugin configuration (leave the
<phase>none</phase> and the <execution id="default-deploy"> block intact to
avoid automatic lifecycle deploy); ensure the plugin artifactId
"maven-deploy-plugin" and the execution with id "default-deploy" remain but no
longer contain any <skip>true</skip> entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant