Add pipeline script for create_release_notes and link to master instead of backport issue - #229
Add pipeline script for create_release_notes and link to master instead of backport issue#229smlambert wants to merge 7 commits into
Conversation
|
Testing via https://ci.adoptium.net/job/build-scripts/job/release/job/create_rel_notes_v2/ json produced the original job: json produced via this PR: Not sure its quite right 'yet', when we link to the master issue, should we be changing type and backportOf values. |
Yeah, I think for the new format, it would ideally be: And I think it's nicer to highlight the main issue as that is the ID used in the commit message. E.g. openjdk/jdk11u@9a1fbf6 has 8385390, the backport issue ID is not in the codebase anywhere. |
Signed-off-by: smlambert <slambert@gmail.com>
Signed-off-by: smlambert <slambert@gmail.com>
jerboaa
left a comment
There was a problem hiding this comment.
I cannot really say anything about the change. No idea what it does. I can say that I'm +1 on backportedBy.
|
Thanks @jerboaa - yes, I mainly wanted you to look at the json output and be okay with the update to use backportedBy. The rest of it takes the script that was previously not in source control and moves its functionality into a groovy script. |
There was a problem hiding this comment.
🟡 Changes recommended
The new Jenkinsfile likely fails at runtime due to an unguarded manager.createSummary(...) call, and the backport canonicalization sets backportedBy incorrectly and inconsistently across output entries.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR brings the create_release_notes Jenkins job into source control as a declarative Pipeline and updates release-notes generation to prefer the canonical bugs.openjdk.org links and (for backports) the master bug ID rather than the backport issue.
Changes:
- Add a new
generate-release-notes/Jenkinsfilepipeline to run commit fetching, release-note generation, and artifact archiving, and to emit a pre-populated “publish” URL. - Switch JIRA REST/search and browse links from
bugs.openjdk.java.nettobugs.openjdk.org. - Adjust release-notes mapping to rewrite Backport entries to the master bug ID/link, and improve GitHub compare error messaging.
File summaries
| File | Description |
|---|---|
| generate-release-notes/Jenkinsfile | New Jenkins Pipeline for generating and archiving release-notes artifacts and surfacing a publish link. |
| generate-release-notes/generate-release-notes/lib/fetchJiraIssues.js | Update JIRA REST API base URL and browse links to bugs.openjdk.org. |
| generate-release-notes/generate-release-notes/lib/fetchGitHubCommits.js | Add a more actionable hint for 404 errors when comparing tags. |
| generate-release-notes/generate-release-notes/fetchReleaseNotes.js | Update browse links and rewrite Backport entries to use the master bug ID/link (with an added backport-tracking field). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Add a clickable summary badge to the Jenkins build page, matching the | ||
| // pattern used in ci-jenkins-pipelines/build_base_file.groovy. | ||
| def summary = manager.createSummary('document.svg') | ||
| appendSummaryText(summary, "<b>Release notes generated: ${env.RESOLVED_FILENAME}</b><br/>") | ||
| appendSummaryText(summary, "<a href='${releaseToolUrl}'>Publish release notes for ${params.JDK_TAG}</a>") |
| nvmIoJsOrgMirror: 'https://iojs.org/dist', | ||
| nvmInstallDir: '$HOME/.nvm') { | ||
| sh 'node --version' | ||
| sh 'npm install' |
| // Build a pre-populated link to the release-tool publish job so the operator | ||
| // can publish the generated JSON with a single click. | ||
| // Mirrors the parambuild pattern used in ci-jenkins-pipelines/build_base_file.groovy. | ||
| def publishJobPath = 'build-scripts/release/refactor_openjdk_release_tool' |
| } else if (releaseNote.type === 'Backport' && releaseNote.backportOf) { | ||
| // For backport issues, use the master bug ID and link so that the release | ||
| // notes refer to the canonical bug with a description rather than the | ||
| // backport ticket which is usually empty. | ||
| const canonicalId = releaseNote.backportOf; | ||
| releaseNote = { | ||
| ...releaseNote, | ||
| id: canonicalId, | ||
| link: `https://bugs.openjdk.org/browse/${canonicalId}`, | ||
| type: null, | ||
| backportOf: null, | ||
| backportedBy: commit.id, | ||
| }; |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
andrew-m-leonard
left a comment
There was a problem hiding this comment.
looks good to me
|
|
||
| // 4. Split version on '.' → [FEATURE, INTERIM, UPDATE] or [FEATURE, INTERIM, UPDATE, PATCH] | ||
| def versionParts = parts[0].tokenize('.') | ||
| if (versionParts.size() < 3) { |
There was a problem hiding this comment.
Comment for function says jdk-26-ga is a supported format. However versionParts is size 1 (just 26) and this would error out on that input.
Maybe a special case is needed for versionParts size 1?
| nvmInstallDir: '$HOME/.nvm') { | ||
| sh """ | ||
| echo "Generating release notes for ${params.JDK_TAG}" | ||
| node ./fetchCommitList.js \ |
There was a problem hiding this comment.
Code review from IBM Bob:
Parameters passed directly into sh """...""" blocks without quoting are vulnerable to shell injection — and will also break for tags that contain special characters like +, which JEP-322 tags regularly do (e.g. jdk-21.0.1+12).
// Current — unsafe and fragile
node ./fetchCommitList.js \
--repository ${env.RESOLVED_GITHUB_REPOSITORY} \
--baseTag ${params.BASE_JDK_TAG} \
--tag ${params.JDK_TAG} \
--filename ${params.JDK_TAG}-commits.json
sh "cat ${params.JDK_TAG}-commits.json"The + in jdk-21.0.1+12 will be treated by the shell as a no-op only by coincidence here, but $() or backtick sequences injected via parameters could execute arbitrary code. All parameter references inside sh blocks must be single-quoted shell variables or passed via withEnv.
// Recommended fix
withEnv([
"JDK_TAG=${params.JDK_TAG}",
"BASE_JDK_TAG=${params.BASE_JDK_TAG}",
"GITHUB_REPO=${env.RESOLVED_GITHUB_REPOSITORY}"
]) {
sh '''
node ./fetchCommitList.js \
--repository "$GITHUB_REPO" \
--baseTag "$BASE_JDK_TAG" \
--tag "$JDK_TAG" \
--filename "${JDK_TAG}-commits.json"
'''
sh 'cat "${JDK_TAG}-commits.json"'
}
Fixes #228
Fixes #200