Add template for compare xml job#3
Conversation
bookwar
left a comment
There was a problem hiding this comment.
I was thinking on doing that comparison a bit differently.
Instead working in the same workdir with two different commits, we just checkout the same repo twice into two different subfolders.
destinationBranch to dest/ and PR to pr/ and then run tox two times in exh of the subfolders.
The trade-off is that we need to checkout the same repo twice, but then it will simplify the bash logic a lot and we get much cleaner logic in the end.
|
Well, I just ported stuff we had before. |
1166eb1 to
d9d7e58
Compare
This patch adds template and couple of useful macro for performing xml comparisements of JJ changes
| virtualenv venv | ||
| source venv/bin/activate | ||
| pip install pip --upgrade | ||
| pip install tox |
There was a problem hiding this comment.
IMHO: this is node configuration and it is not responsibility of this script.
| mv "./output/${ENV##*/}" "./output/jobs/new/${ENV##*/}" | ||
| done | ||
|
|
||
| compare_xml() { |
There was a problem hiding this comment.
the function declaration break flow of main logic, and it is hard to read this script.
It would be better to move this function in top of file or just remove it, because there is only one place where this function is called.
| @@ -0,0 +1,67 @@ | |||
| - job-template: | |||
There was a problem hiding this comment.
IMHO: this job is related to stash and its name or location should reflect this fact.
| host: '{host}' | ||
| username: '{username}' | ||
| password: '{password}' | ||
| credentials-id: '{credentials-id}' No newline at end of file |
| password: '' | ||
|
|
||
| jobs: | ||
| - library/compare-xml No newline at end of file |
| ADDED="[added]<br>" | ||
| REMOVED="[removed]<br>" | ||
|
|
||
| DIFF=$(diff -q -r -u "${OUT_DIR}/old" "${OUT_DIR}/new" &>"${LOGFILE}"; echo "${?}") |
There was a problem hiding this comment.
The layout of output folder is out of scope of the compare+xml function. Thus instead of ${OUT_DIR}, ${OUT_DIR}/old and ${OUT_DIR}/old we should have FROM_DIR and $TO_DIR or A_DIR and B_DIR as diff usually uses this naming.
I would also move comparison function to a separate utils/compare.sh script. And call it in the JJB step as ./utils/compare.sh output/new output/old > report.html
This patch adds template and couple of useful macro
for performing xml comparisements of JJ changes