gpgupdate-masterj21 changes so we can test the changes in master-java21 branch. - #354
Conversation
- Replace file-based gpg2 import with secret-based import via GPG_PRIVATE_KEY - Add GPG key age check: warn at 2 years, hard stop at 3 years (bypassable with FORCE_BUILD=true) - Add simplify4u pgpverify step (non-blocking) in maven-build to audit external dependency signatures - Remove unnecessary GPG_TTY setup - Skip GPG in sonar analysis (analysis-only, no publishing) via -Dgpg.skip=true - Applied to maven-build, maven-publish-to-nexus, maven-publish-android, maven-sonar-analysis Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mahesh.Binayak <mahesh.binayak@technoforte.co.in>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mahesh.Binayak <mahesh.binayak@technoforte.co.in>
WalkthroughFour GitHub Actions Maven workflows are updated to import GPG signing keys from a new ChangesMaven/Sonar Workflow GPG Handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Workflow
participant Secrets
participant GPG as gpg CLI
participant Maven
Workflow->>Secrets: read GPG_PRIVATE_KEY, GPG_SECRET
Workflow->>GPG: import private key with passphrase
Workflow->>GPG: list-keys to determine creation date
GPG-->>Workflow: key age
alt key older than 3 years and FORCE_BUILD != true
Workflow->>Workflow: fail workflow
else key older than 2 years
Workflow->>Workflow: emit warning
else key within threshold
Workflow->>Maven: proceed with build/signing
end
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/maven-build.yml:
- Around line 15-18: The FORCE_BUILD input is defaulting to the non-enforcing
path, which makes stale keys only warn instead of stopping the build. Update the
workflow input definition for FORCE_BUILD so the default reflects enforcement
mode, and make sure any logic that reads FORCE_BUILD continues to treat the
default as the hard-stop behavior unless callers explicitly override it.
- Around line 136-139: The Maven step is interpolating inputs.SERVICE_LOCATION
directly inside the shell command, which should be avoided. Update the workflow
step in the maven build job to pass SERVICE_LOCATION through env and reference
that variable in the run block, quoting it when used with cd; this keeps the
shell from treating caller-controlled input as command syntax. Refer to the
maven-build workflow step that invokes mvn with the pgpverify-maven-plugin.
In @.github/workflows/maven-publish-android.yml:
- Around line 15-18: The workflow input FORCE_BUILD is defaulting to the
override path, which bypasses the key-age enforcement by default. Update the
workflow’s FORCE_BUILD input definition in the maven-publish-android pipeline to
default to 'false' so enforcement is the default behavior, and keep any existing
logic that checks FORCE_BUILD aligned with this value.
In @.github/workflows/maven-publish-to-nexus.yml:
- Around line 9-12: The workflow input FORCE_BUILD is defaulting to the wrong
mode, which makes the enforcement path opt-out instead of deliberate. Update the
workflow input definition so the FORCE_BUILD default is set to false, and keep
the existing input name and type in the maven-publish-to-nexus workflow so
callers must explicitly opt in to force builds.
In @.github/workflows/maven-sonar-analysis.yml:
- Line 67: The Maven sonar step is interpolating caller-controlled values
directly in the shell command, which can lead to shell template injection. Move
the `${{ inputs.SERVICE_LOCATION }}`, `${{ inputs.PROJECT_KEY }}`, `${{
inputs.SONAR_URL }}`, `${{ secrets.ORG_KEY }}`, `${{ secrets.SONAR_TOKEN }}`,
and `${{ github.event.repository.name }}` values into `env` for the workflow
step, then reference those environment variables in the `run` command with
quoted shell variables. Keep the existing `mvn` invocation in the same workflow
job, but ensure the `run` script uses only `$VAR` references so the shell treats
the values as data.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c3dd745a-36cd-453d-9ab9-f5822aae020b
📒 Files selected for processing (4)
.github/workflows/maven-build.yml.github/workflows/maven-publish-android.yml.github/workflows/maven-publish-to-nexus.yml.github/workflows/maven-sonar-analysis.yml
Summary by CodeRabbit
Chores
Bug Fixes