Skip to content

Commit

Permalink
feat: add plugin manager input syntax to check run summary (#88)
Browse files Browse the repository at this point in the history
* feat: add plugin manager input syntax to check run

* render download links and plugin manager input format entries as a table instead of two lists

* Reduce first header lenght

* there can be only one link

* retrieve all info from pom (groupId, version, packaging)

* use info returned from pom, and show input format only for hpi

* better header for plugin manager column

* remove table

* titles and summary formating

* use fenced code block to get copy button

* pluralise

Co-authored-by: Tim Jacomb <[email protected]>

* add new line after link title

* lint, strings must use doublequote

---------

Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
lemeurherve and timja authored Feb 11, 2024
1 parent f16ecec commit 196d0b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions IncrementalsPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,10 @@ class IncrementalsPlugin {
const entriesForDisplay = entries.map(entry => {
return {
artifactId: entry.artifactId,
url: config.INCREMENTAL_URL + entry.path.replace(/[^/]+$/, ""),
version: entry.path.split("/").slice(-2)[0],
groupId: entry.path.split("/").slice(0, 3).join(".")
groupId: entry.groupId,
version: entry.version,
hpi: (entry.packaging == "hpi" ? `${entry.artifactId}:incrementals;${entry.groupId};${entry.version}&#xA;` : ""),
url: config.INCREMENTAL_URL + entry.path.replace(/[^/]+$/, "")
};
})

Expand Down
4 changes: 3 additions & 1 deletion lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default {
createStatus: async (owner, repo, head_sha, entries) => {
const github = await getRestClient();

const links = `### Download link${entries.length > 1 ? "s" : ""}:` + "\n" + entries.map(entry => `- [${entry.artifactId}](${entry.url})`).join("\n")
const inputFormat = "### Plugin Installation Manager input format:\n```" + entries.map(entry => entry.hpi).join("") + "```\n([documentation](https://github.com/jenkinsci/plugin-installation-manager-tool/#plugin-input-format))"
const metadata = entries.map(entry => `&#60;dependency>&#xA; &#60;groupId>${entry.groupId}&#60;/groupId>&#xA; &#60;artifactId>${entry.artifactId}&#60;/artifactId>&#xA; &#60;version>${entry.version}&#60;/version>&#xA;&#60;/dependency>`).join("&#xA;")

return github.rest.checks.create({
Expand All @@ -51,7 +53,7 @@ export default {
details_url: entries[0].url,
output: {
title: `Deployed version ${entries[0].version} to Incrementals`,
summary: entries.map(entry => `- [${entry.artifactId}](${entry.url})`).join("\n"),
summary: links + inputFormat,
text: `<pre>&#xA;${metadata}&#xA;</pre>`
}
});
Expand Down
4 changes: 4 additions & 0 deletions lib/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export default {
const groupId = result.project.groupId[0];
const artifactId = result.project.artifactId[0];
const version = result.project.version[0];
const packaging = result.project.packaging ? result.project.packaging[0] : ""
entries.push({
artifactId,
groupId,
version,
packaging,
path: entry.name
});
log.info(util.format("Parsed %s with url=%s tag=%s GAV=%s:%s:%s", entry.name, url, tag, groupId, artifactId, version));
Expand Down

0 comments on commit 196d0b7

Please sign in to comment.