Skip to content

chore(QTDI-3796): copy settings.xml for Trivy scan - #1322

Merged
lxia-talend merged 2 commits into
masterfrom
ozhelezniak/QTDI-3796_trivy_copy_settings_xml
Nov 11, 2026
Merged

lxia-talend merged 2 commits into
masterfrom
ozhelezniak/QTDI-3796_trivy_copy_settings_xml

Conversation

@ozhelezniak-talend

Copy link
Copy Markdown
Contributor

Summary

Trivy scans in Jenkinsfile and ci/Jenkinsfile-trivy do not use the Nexus mirror. The Trivy pom resolver ignores MAVEN_ARGS and -s. It reads only ~/.m2/settings.xml.

This PR copies .jenkins/settings.xml to ~/.m2/settings.xml before trivyTools.generateTrivyReport. Same approach as QTDI-3279.

Jira: QTDI-3796

Checklist

  • CI Groovy change only; no Java code, so no unit tests apply
  • Verify in a Trivy scan run on Jenkins (must be triggered by a human)

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

AI contribution metrics

  • Code Generation % (this PR): 100%
  • Code Generation % (ticket-wide cumulative): 100%
  • Technical Design % (ticket-wide cumulative): 100%

Trivy pom resolver ignores MAVEN_ARGS and -s. It reads only
~/.m2/settings.xml. Copy .jenkins/settings.xml there before the scan
so the Nexus mirror is used.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ozhelezniak-talend

Copy link
Copy Markdown
Contributor Author

Scope & design review — QTDI-3796

# Severity File Description
1 MINOR Jenkinsfile, ci/Jenkinsfile-trivy Overwrites an existing ~/.m2/settings.xml on the agent; acceptable on an ephemeral CI pod, same as QTDI-3279.
2 MINOR both Assumes trivyTools shares the sh workspace/HOME. Confirm in a Trivy scan run.

Approval gate: APPROVED — no Blocker or Major findings.

Signed: Claude Sonnet 5.5

@ozhelezniak-talend

Copy link
Copy Markdown
Contributor Author

Code Review — QTDI-3796

Reviewed 2 files: Jenkinsfile, ci/Jenkinsfile-trivy. Both are CI Groovy files; no Java, TCK, or test rules apply. Cause comment present, no secrets, license headers untouched.

Severity counts: Critical fixed: 0, Warnings: 0, Info: 0.

Signed: Claude Sonnet 5.5

@ozhelezniak-talend ozhelezniak-talend changed the title fix(QTDI-3796): Copy settings.xml for Trivy scan chore(QTDI-3796): Copy settings.xml for Trivy scan Nov 10, 2026
@ozhelezniak-talend

Copy link
Copy Markdown
Contributor Author

To copy the setting.xml into the pod we needed to create an artifical mount inside yml

https://github.com/Talend/connectors-lib/blob/main/.jenkins/jenkins_pod.yml

   { name: jenkins-m2-temp, mountPath: /home/jenkins/.m2 },

I think this one needs it too

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ozhelezniak-talend

Copy link
Copy Markdown
Contributor Author

Review round 1 — summary

Comment Class Action
#6778249887 — needs jenkins-m2-temp mount at /home/jenkins/.m2 Code fix Fixed in 0fb25d0

Fixes pushed: 0fb25d0 — fix(QTDI-3796): address review round 1 — mount emptyDir on ~/.m2 (.jenkins/jenkins_pod.yml)
Pending clarifications: 0
Rebase: not needed. Maintenance-branch cherry-picks are left to the developer.

Round summary generated by AI. Please resolve threads after verifying the fixes.

Signed: Claude Sonnet 5.5

@ozhelezniak-talend
ozhelezniak-talend requested a lite review from Copilot November 10, 2026 20:22
@ozhelezniak-talend ozhelezniak-talend changed the title chore(QTDI-3796): Copy settings.xml for Trivy scan chore(QTDI-3796): copy settings.xml for Trivy scan Nov 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The Jenkins pod still has an unresolved moderate permission issue that may prevent copying to the root-owned emptyDir and stop Trivy from starting.

1 open issue
What changed in this PR

Updates both Jenkins Trivy pipelines so Trivy can resolve Maven dependencies through the Nexus mirror by copying .jenkins/settings.xml into the default Maven settings location.

Changes:

  • Copies .jenkins/settings.xml to ${HOME}/.m2/settings.xml before each Trivy scan.
  • Adds a temporary .m2 volume while retaining the persistent Maven repository mount.
  • Requires human-triggered Jenkins validation of the Trivy scan and volume permissions.
File Description
Jenkinsfile Copies the Maven settings file before the standard pipeline's Trivy report generation.
ci/​Jenkinsfile-trivy Copies the Maven settings file before the dedicated Trivy security scan.
.jenkins/​jenkins_pod.yml Adds temporary storage and a mount for the Maven settings directory while preserving the repository cache mount.

Review effort: Lite

Comment thread .jenkins/jenkins_pod.yml Resolved
@sonar-rnd

sonar-rnd Bot commented Nov 10, 2026

Copy link
Copy Markdown

@ozhelezniak-talend

Copy link
Copy Markdown
Contributor Author

Review round 1 — summary

Comment Class Action
#1 — emptyDir jenkins-m2-temp ownership Code fix (planned) Replied with evidence: connectors-lib uses the same pattern without fsGroup. No code change.

Fixes pushed: none
Pending clarifications: 0

Round summary generated by AI. Please resolve threads after verifying.

@lxia-talend
lxia-talend merged commit c27a205 into master Nov 11, 2026
11 checks passed
@lxia-talend
lxia-talend deleted the ozhelezniak/QTDI-3796_trivy_copy_settings_xml branch November 11, 2026 07:04
ozhelezniak-talend added a commit that referenced this pull request Nov 11, 2026
* fix(QTDI-3796): Copy settings.xml for Trivy scan

Trivy pom resolver ignores MAVEN_ARGS and -s. It reads only
~/.m2/settings.xml. Copy .jenkins/settings.xml there before the scan
so the Nexus mirror is used.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(QTDI-3796): address review round 1 — mount emptyDir on ~/.m2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit c27a205)
ozhelezniak-talend added a commit that referenced this pull request Nov 11, 2026
* fix(QTDI-3796): Copy settings.xml for Trivy scan

Trivy pom resolver ignores MAVEN_ARGS and -s. It reads only
~/.m2/settings.xml. Copy .jenkins/settings.xml there before the scan
so the Nexus mirror is used.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(QTDI-3796): address review round 1 — mount emptyDir on ~/.m2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit c27a205)
lxia-talend added a commit that referenced this pull request Nov 20, 2026
…COMP-api-test #1317)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants