-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added dynamic macros into Jenkins config #20
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f728d72
added a check whether the user is trying to escape directory when loo…
patrikcerbak caafcbb
fixed a bug, where the values in the dropdown menu were not saved whe…
patrikcerbak 904f7a2
added more macros into Jenkins comparator link settings - for values …
patrikcerbak ed66398
reworked the argument parsing, so the dynamic argument can be used be…
patrikcerbak 54e807e
updated the help in Jenkins reflecting the macros changes
patrikcerbak 9fc9016
updated the comparator help to reflect changes to the argument parsing
patrikcerbak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
254 changes: 135 additions & 119 deletions
254
...main/java/io/jenkins/plugins/report/jtreg/main/comparator/arguments/ArgumentsParsing.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
<p> | ||
On top of the normal arguments, there is also a type of <b>macro system</b>. This macro system is powerful and | ||
can be used for making the link dynamic. These macros represent each part of the split job name (split by the | ||
spliterator) and when loading the report page, they are replaced by it. | ||
spliterator) or a value from config defined in the <i>config items</i> section, and when loading the report | ||
page, they are replaced by it. | ||
</p> | ||
<i>The macros have this syntax:</i><br> | ||
<ul> | ||
|
@@ -20,20 +21,27 @@ | |
|
||
<li>"<code>%{S}</code>" or "<code>%{SPLIT}</code>" will be replaced with the spliterator specified in the field | ||
above.</li> | ||
|
||
<li>"<code>%{dynamic}</code>", where you replace <code>dynamic</code> with a name of an item specified in the | ||
<i>config items</i> section (specifically the name from the <i>Name of the item to find</i> field). | ||
It will be replaced by a value from the corresponding config file from the current job and build.</li> | ||
</ul> | ||
<p> | ||
<i>Example of the macros:</i><br> | ||
For the job name "<code>jtreg~full-jp11-ojdk11~rpms-f36.x86_64-fastdebug.sdk-f36.x86_64.testfarm-x11.defaultgc.legacy.lnxagent.jfroff</code>",<br> | ||
and spliterator set to "<code>[.-]</code>", the macros "<code>%{2}%{S}%{N-1}_something_%{N}</code>" will be | ||
replaced with "<code>jp11[.-]lnxagent_something_jfroff</code>". | ||
There is a job with the job name "<code>jtreg~full-jp11-ojdk11~rpms-f36.x86_64-fastdebug.sdk-f36.x86_64.testfarm-x11.defaultgc.legacy.lnxagent.jfroff</code>",<br> | ||
spliterator set to "<code>[.-]</code>" and a config item with the <i>Name of the item to find</i> field set | ||
to "<code>nvr</code>" and its evaluation in the config file being "<code>java-17-openjdk-17.0.6.0.9-0.4.ea.el8</code>". | ||
</p> | ||
<p> | ||
The macros "<code>%{2}%{S}%{N-1}_something_%{N} - %{nvr}</code>" will be | ||
replaced with "<code>jp11[.-]lnxagent_something_jfroff - java-17-openjdk-17.0.6.0.9-0.4.ea.el8</code>". | ||
</p> | ||
<p> | ||
<i>So an example of the whole prompt with arguments can look like this:</i><br> | ||
<code> | ||
--compare<br> | ||
--history 5<br> | ||
--build-config-find changelog.xml:nvr:/build/nvr<br> | ||
--nvr ".*"<br> | ||
--nvr "%{nvr}"<br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it maybe worthy to keep also the --nvr ".*" example. Otherwise users may fell to assumption, that it is the final form, and no xtensions possible |
||
--formatting html<br> | ||
--regex %{1}%{S}%{2}%{S}%{3}%{S}.*%{S}%{5}%{S}%{6}%{S}%{7}%{S}.*%{S}%{9}%{S}%{10}%{S}%{11}%{S}%{12}%{S}%{13}%{S}%{14}%{S}%{15}<br> | ||
</code> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt better to simply check, that the fully resolved filename, the final abs path (java have methods for that), is simply still in desired workspace/cwd/app dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wil merge this as it is. But the rework of shoudl be needed.
Again,. from my own experiments, checking input like this may be missleading.
eg correctdir/correctdir/../fileInFirstCorrectDir is pretty correct
Eg I'm checking the bash injection in the CGI wrapper by checking for "|" and thus literally killing this tool. Btrw, any ideas how to fix that "|" (https://github.com/jenkinsci/report-jtreg-plugin/blob/master/report-jtreg-service/src/main/java/io/jenkins/plugins/report/jtreg/main/web/ContextExecutingHandler.java#L114)