Skip to content

JAVA-7411 Create an automated workflow to update the JDT package - #202

Draft
aurelien-coet-sonarsource wants to merge 1 commit into
masterfrom
ac/JAVA-7411
Draft

aurelien-coet-sonarsource wants to merge 1 commit into
masterfrom
ac/JAVA-7411

Conversation

@aurelien-coet-sonarsource

@aurelien-coet-sonarsource aurelien-coet-sonarsource commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • New GitHub Actions workflow:
    • Added jdt-update.yml to prepare, verify, and publish JDT Core upgrades
  • Automation script:
    • Added ciUpdate.py to validate upgrades, open update PRs, and request Gitar repairs
  • Conflict handling:
    • Added PatchConflict handling and exit code 3 with --conflict-file output in jdt.py and patch.py
  • Documentation:
    • Documented the GitHub Actions update flow and conflict exit behavior in README.md

This will update automatically on new commits.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

JAVA-7411

@gitar-bot

gitar-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 🔴 High risk 0 closed / 2 findings

The workflow grants a GitHub App contents, issues, and pull-request write access and asks Gitar to push repairs, so mis-scoped automation could alter repository branches.

Adds a GitHub Actions workflow and ciUpdate.py script to automate JDT Core upgrades, opening update PRs and requesting Gitar repairs on patch conflicts. Two minor suggestions remain: the README describes the conflicting run as 'failed' though it finishes green, and the new workflow bypasses the SonarSource/mise-action-wrapper migration in #200, which should be aligned before merge.

💡 Quality: README calls the conflicting update run 'failed', but it finishes green

📄 README.md:163-167 📄 scripts/ciUpdate.py:77-81 📄 scripts/ciUpdate.py:268-269

When the updater hits a conflict, ciUpdate.prepare writes the target/pending_patch outputs and returns None, so sys.exit(main()) exits 0. Validation and Maven are skipped, and publishing opens the draft successfully. The dispatch run therefore ends green. The new README section says the workflow comments with "the failed run", and an operator may go looking for a red run that doesn't exist. The comment itself labels the link [Update run], which is accurate. Change the README wording to match, e.g. "the update run that stopped on the conflict".

Describe the linked run accurately
the `gitar-managed` label, and comments with the exact update command and a link to the update run that stopped on the conflict. Gitar recreates the workspace and
ℹ️ Cross-PR: New JDT update workflow skips the mise-action wrapper migration · #200

📄 .github/workflows/jdt-update.yml:59-63 📄 .github/workflows/jdt-update.yml:152

Breaks when this PR and #200 both merge, in either order. jdt-update.yml would then be the only workflow that still calls third-party jdx/mise-action directly.

How

  1. .github/workflows/jdt-update.yml:60 adds jdx/mise-action@924e7c586e33… (v5.3.0) through the &setup-mise anchor. verify-repair reuses that anchor at line 152.
  2. #200 replaces every jdx/mise-action use in .github/workflows/build.yml:29,89 and unified-dogfooding.yml:21 with SonarSource/mise-action-wrapper@f6366c8008c1 (2.1.0), passing persist_github_token: false.
  3. #200 only rewrites the files it touches, so it cannot cover the new workflow. Both update and verify-repair would keep running the action that #200 removes for supply-chain reasons.

Fix

  • This PR: Use SonarSource/mise-action-wrapper with persist_github_token: false in the &setup-mise step, as #200 does, or rebase after #200 merges and adopt it then.
  • #200: If it merges second, also migrate .github/workflows/jdt-update.yml.

Compared d676235 with #200 at e32a5d9

🤖 Prompt for agents
Code Review: Adds a GitHub Actions workflow and `ciUpdate.py` script to automate JDT Core upgrades, opening update PRs and requesting Gitar repairs on patch conflicts. Two minor suggestions remain: the README describes the conflicting run as 'failed' though it finishes green, and the new workflow bypasses the `SonarSource/mise-action-wrapper` migration in #200, which should be aligned before merge.

1. 💡 Quality: README calls the conflicting update run 'failed', but it finishes green
   Files: README.md:163-167, scripts/ciUpdate.py:77-81, scripts/ciUpdate.py:268-269

   When the updater hits a conflict, `ciUpdate.prepare` writes the `target`/`pending_patch` outputs and returns `None`, so `sys.exit(main())` exits 0. Validation and Maven are skipped, and publishing opens the draft successfully. The dispatch run therefore ends green. The new README section says the workflow comments with "the failed run", and an operator may go looking for a red run that doesn't exist. The comment itself labels the link `[Update run]`, which is accurate. Change the README wording to match, e.g. "the update run that stopped on the conflict".

   Fix (Describe the linked run accurately):
   the `gitar-managed` label, and comments with the exact update command and a link to the update run that stopped on the conflict. Gitar recreates the workspace and

2. ℹ️ Cross-PR: New JDT update workflow skips the mise-action wrapper migration · [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>)
   Files: .github/workflows/jdt-update.yml:59-63, .github/workflows/jdt-update.yml:152

   **Breaks when** this PR and [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) both merge, in either order. `jdt-update.yml` would then be the only workflow that still calls third-party `jdx/mise-action` directly.
   
   **How**
   
   1. `.github/workflows/jdt-update.yml:60` adds `jdx/mise-action@924e7c586e33…` (v5.3.0) through the `&setup-mise` anchor. `verify-repair` reuses that anchor at line 152.
   2. [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) replaces every `jdx/mise-action` use in `.github/workflows/build.yml:29,89` and `unified-dogfooding.yml:21` with `SonarSource/mise-action-wrapper@f6366c8008c1` (2.1.0), passing `persist_github_token: false`.
   3. [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) only rewrites the files it touches, so it cannot cover the new workflow. Both `update` and `verify-repair` would keep running the action that [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) removes for supply-chain reasons.
   
   **Fix**
   
   - **This PR:** Use `SonarSource/mise-action-wrapper` with `persist_github_token: false` in the `&setup-mise` step, as [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) does, or rebase after [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) merges and adopt it then.
   - **[#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>):** If it merges second, also migrate `.github/workflows/jdt-update.yml`.
   
   _Compared `d676235` with [#200](<https://github.com/SonarSource/sonar-java-jdt/pull/200>) at `e32a5d9`_

Verification Rules 4/5 met Knowledge ✅ 1 PRs 1 inspected
Rules 1 failed 4 passed 1 not applicable

❌ StepSecurity maintained GitHub Actions - jdt-update.yml line 60 adds jdx/mise-action at v5.3.0, below the v5.4.0 exemption threshold; use step-security/mise-action (SHA and version unverified here) or bump to v5.4.0+ as in build.yml.
✅ Approved GitHub Actions runners
✅ Internal artifact registries
✅ Release secrets usage
✅ Repository license compliance

Functional validation No results

Knowledge ✅ 1 expectation met

Expectation met Baseline documentation needs identifier guidance expectation met

Broader impact PRs 1 inspected
Cross-PR 1 PR inspected 1 open impact

PR 200: BUILD-13164 Replace third-party GitHub Actions with StepSecurity maintained actions Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

sonarqube-next Bot commented Dec 4, 2026

Copy link
Copy Markdown

Comment thread README.md
Comment on lines +163 to +167
The workflow reconstructs the patches and runs `mvn verify` before opening a PR. For previews it selects the required JDK and
installs the pinned JDT Core and ECJ artifacts before the Maven build. If a patch conflicts, the workflow opens a draft, applies
the `gitar-managed` label, and comments with the exact update command and the failed run. Gitar recreates the workspace and
pushes the completed update to the same PR. The workflow checks the selected source, reconstructs the patches, and runs Maven
verification again before marking the draft ready for review.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: README calls the conflicting update run 'failed', but it finishes green

When the updater hits a conflict, ciUpdate.prepare writes the target/pending_patch outputs and returns None, so sys.exit(main()) exits 0. Validation and Maven are skipped, and publishing opens the draft successfully. The dispatch run therefore ends green. The new README section says the workflow comments with "the failed run", and an operator may go looking for a red run that doesn't exist. The comment itself labels the link [Update run], which is accurate. Change the README wording to match, e.g. "the update run that stopped on the conflict".

Describe the linked run accurately:

the `gitar-managed` label, and comments with the exact update command and a link to the update run that stopped on the conflict. Gitar recreates the workspace and
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

Comment on lines +59 to +63
- &setup-mise
uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
if: steps.validate.outcome == 'success'
with:
version: 2026.11.14

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️ Cross-PR: New JDT update workflow skips the mise-action wrapper migration · #200

Breaks when this PR and #200 both merge, in either order. jdt-update.yml would then be the only workflow that still calls third-party jdx/mise-action directly.

How

  1. .github/workflows/jdt-update.yml:60 adds jdx/mise-action@924e7c586e33… (v5.3.0) through the &setup-mise anchor. verify-repair reuses that anchor at line 152.
  2. #200 replaces every jdx/mise-action use in .github/workflows/build.yml:29,89 and unified-dogfooding.yml:21 with SonarSource/mise-action-wrapper@f6366c8008c1 (2.1.0), passing persist_github_token: false.
  3. #200 only rewrites the files it touches, so it cannot cover the new workflow. Both update and verify-repair would keep running the action that #200 removes for supply-chain reasons.

Fix

  • This PR: Use SonarSource/mise-action-wrapper with persist_github_token: false in the &setup-mise step, as #200 does, or rebase after #200 merges and adopt it then.
  • #200: If it merges second, also migrate .github/workflows/jdt-update.yml.

Compared d676235 with #200 at e32a5d9

Was this helpful? React with 👍 / 👎

This branch has not been deployed

No deployments
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