Add Jenkins CI integration
Review Request #9507 — Created Jan. 27, 2018 and submitted
Jenkins is a continuous integration environment, widely used in industry
for running automated test suites, performing deployments, as well as
many other use cases.This change adds a Jenkins integration to Review Board. This will enable
users to add this integration and have new review requests trigger
builds on a Jenkins server.This additionally features a Jenkins plugin. This plugin features two
build steps. The first build step, to occur prior to the main job's
build steps, applies the review request's diff usingrbt patch
. The
second, post-build step notifies review board of the build's status.
rbintegrations/util/urlrequest.py
featured duplicate code from the
reviewboard repository,reviewboard.hostingsvcs.service.URLRequest
.
That class is currently an internal class, so rather than importing it
in all files that use it in this repository, for now we'll import it
once in this file. OnceURLRequest
is refactored in the reviewboard
repo, we can remove theurlrequest.py
file and import the original
class.
- Unit tests have been created and ran for the Jenkins java plugin
- Run
mvn test
in the base directory
- Run
- Unit tests have been created and ran for rbintegrations
- Manual testing of creating reviews, publishing them, triggering
builds on Jenkins server, and those builds updating the status
once complete.
Description | From | Last Updated |
---|---|---|
You are missing a lot of doc comments on methods. |
brennie | |
F401 'django.utils.http.urlquote_plus' imported but unused |
reviewbot | |
F401 'django.utils.translation.ugettext_lazy as _' imported but unused |
reviewbot | |
would be nice if the jobname could use some variables that will be replaced. Example: jobname = '{branch}_review_build' So it … |
misery | |
E123 closing bracket does not match indentation of opening bracket's line |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F401 'yaml' imported but unused |
reviewbot | |
F401 'django.core.urlresolvers.reverse' imported but unused |
reviewbot | |
F401 'reviewboard.admin.server.build_server_url' imported but unused |
reviewbot | |
is it possible to provide the parent diff also? |
misery | |
F841 local variable 'status_update' is assigned to but never used |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
I don't knwo that we have a style guide for Java, but 8 spaces as a continutation indent seems excessive. |
brennie | |
This should be a java.net.URL. |
brennie | |
If reviewBoardURL is a java.net.URL then we can do: URL url = new URL( reviewBoardURL, String.format("/api/review-requests/%s/status-updates/%s/", reviewId, statusId)); |
brennie | |
Comments should be full sentences and end in periods. |
brennie | |
I think this is inferrable from the SC_OK bit. |
brennie | |
F401 'base64' imported but unused |
reviewbot | |
F841 local variable 'repository' is assigned to but never used |
reviewbot | |
Do we want to just use reviewboard.hostingsvcs.service.URLRequest here? We are duplicating logic across projects. This is something we should address … |
brennie | |
Instead of just calling this "Review Board", can we be more specific? "Review Board plugin for Jenkins"? |
david | |
This blank line can go away. |
david | |
This blank line can go away. |
david | |
Args should be final here. |
david | |
Args should be final. |
david | |
final? |
david | |
Period at the end. |
david | |
final |
david | |
Can you put a blank line above this? |
david | |
Here's a somewhat nicer way to wrap this: ReviewBoardUtils.updateStatusUpdate( new URL(getReviewBoardURL()), getReviewBoardAPIToken(), reviewRequest.getReviewId(), reviewRequest.getStatusUpdateId(), state, description); |
david | |
final? |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
Extra lank line. |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
Needs a space between () and { |
david | |
This blank line can go away. |
david | |
Period at the end |
david | |
This blank line can go away. |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
final |
david | |
This blank line can go away. |
david | |
This blank line can go away. |
david | |
final |
david | |
final |
david | |
Blank lines aren't necessary here. |
david | |
Type should be "unicode" |
david | |
Needs a period and a blank line after. |
david | |
Type should be "unicode" |
david | |
Needs a period and a blank line after. |
david | |
Type should be "unicode" |
david | |
Needs a period and a blank line after. |
david | |
Type should be "unicode" |
david | |
Needs a period. |
david | |
Missing documentation for the patch_info arg. |
david | |
Docstring for this method should start with a summary line that explains what the function does. Justification like this can … |
david | |
This blank line isn't necessary. |
david | |
Missing a docstring |
david | |
Period at the end. |
david | |
Period at the end. |
david | |
Period at the end. |
david | |
When we have an apostrophe, it's fine to surround the string in double quotes instead of single. Also needs a … |
david | |
One more blank line here. |
david | |
I know we might have some docstrings like this, but going forward we're documenting properties like they were attributes instead … |
david | |
Can you add info in your change description about this part of the change? |
david | |
this will fail if URLAvatarService is disabled and no jenkins-ci is called at all. :-( |
misery | |
Jenkins? |
MA maram | |
is this still valid since this issue was fixed for jenkins LTS? https://issues.jenkins-ci.org/browse/JENKINS-22474 |
misery | |
Can we use "URL" instead of "Url"? |
david | |
And here. |
david | |
Should there be logging if there is a MalformedURLException? |
JT jtrang | |
And here. |
david | |
And here. |
david | |
Can we use "URL" instead of "Url"? |
david | |
And here. |
david | |
And here. |
david | |
And here. |
david | |
Can we use "URL" instead of "Url"? |
david | |
I'm not sure what RB's Java convention is here, but I think credentials.isEmpty() would be more expressive here. |
JT jtrang | |
j before l |
david | |
Docstrings should have one line, then a blank line, then any additional paragraphs (as necessary). |
david | |
Summary line of the docstring should be just one line. Additional details can be provided in subsequent paragraphs. |
david | |
Should be "kwargs" instead of "kwarg" |
david | |
Blank docstring |
JT jtrang | |
This docstring needs a "Returns:" section explaining the returned value. |
david | |
We have an improved version of this as djblets.util.decorators.cached_property, which should probably be used instead. |
david | |
Property docstrings should be documented like attributes rather than methods. So just """The icons used for the integration.""" |
david | |
typo: suppored -> supported |
david | |
Add a trailing comma. |
david | |
There are two potentially better ways to wrap this: status_update.description = \ 'failed to communicate with Jenkins' or status_update.description = … |
david | |
Add a blank line above this. |
david | |
Please use single quotes instead of double. |
david | |
Add a blank line above this. Also, the u prefix on the string isn't necessary because you're importing unicode_literals |
david | |
Please use single quotes instead of double. |
david | |
So that output is consistent when running the suite, all test docstrings should start with "Testing" |
david | |
So that output is consistent when running the suite, all test docstrings should start with "Testing" |
david | |
So that output is consistent when running the suite, all test docstrings should start with "Testing" |
david | |
Can you add a comment explaining why people shouldn't import this directly? (basically just copy from your review request description). |
david |
- Change Summary:
-
This change adds the Jenkins plugin. This provides a basic build step for applying the patch provided by Review Board.
- Commit:
-
8eaa20efa48cbb3cd5353f4c5be6dc0203f7707af5c992e3ec9130330cc6812ae6cbdb0891708681
- Diff:
-
Revision 2 (+757 -1)
Checks run (2 succeeded)
- Change Summary:
-
This change features the notification part of the Jenkins plugin. Now
this has a complete end-to-end workflow. New review requests will
trigger builds on Jenkins, the builds will apply the patch for that
given review request, and then Jenkins will notify RB of the success
or failure of the build. - Description:
-
~ Preliminary work on Jenkins integration. This is enough to have the
~ integration configurable on Review Board, as well as enough to trigger a ~ remote Jenkins build. This doesn't support notifications yet (so builds ~ are always in progress), nor does it have any tests. The code is based ~ off the travis-ci integration and shares a good chunk of it. ~ Jenkins is a continuous integration environment, widely used in industry
~ for running automated test suites, performing deployments, as well as ~ many other use cases. ~ ~ This change adds a Jenkins integration to Review Board. This will enable
+ users to add this integration and have new review requests trigger + builds on a Jenkins server. + + This additionally features a Jenkins plugin. This plugin features two
+ build steps. The first build step, to occur prior to the main job's + build steps, applies the review request's diff using rbt patch
. The+ second, post-build step notifies review board of the build's status. + + There is still additional work to be done. Notably, there are no unit
+ tests. There was also the request of having variable in job names (i.e. + {branch}), which still needs to be added. - Testing Done:
-
~ Minimal testing has been done. This is mostly a POC for triggering Jenkins builds.
~ Some testing has been done. All testing has been using a git repository,
+ so I still need to test other repositories to see how they will function. + This is mostly a POC for triggering Jenkins builds. Future revisions will + feature unit tests. - Commit:
-
f5c992e3ec9130330cc6812ae6cbdb08917086813d153125b6425c1e56b0251fabec84b1a41d6e03
- Diff:
-
Revision 3 (+968 -1)
-
-
-
I don't knwo that we have a style guide for Java, but 8 spaces as a continutation indent seems excessive.
-
-
If
reviewBoardURL
is ajava.net.URL
then we can do:URL url = new URL( reviewBoardURL, String.format("/api/review-requests/%s/status-updates/%s/", reviewId, statusId));
-
-
-
Do we want to just use
reviewboard.hostingsvcs.service.URLRequest
here? We are duplicating logic across projects.This is something we should address with Christian and David.
- Change Summary:
-
This change is mostly style refactoring, clean up of duplicated code
and new doc comments. - Commit:
-
3d153125b6425c1e56b0251fabec84b1a41d6e03e1506158ca349f7196591b54caea41af39103619
- Diff:
-
Revision 4 (+1217 -38)
Checks run (2 succeeded)
- Change Summary:
-
- Added in job name variables. So far this includes {repository} and
{branch}. - Begun work on unit tests in the rbintegrations codebase.
- Added in job name variables. So far this includes {repository} and
- Description:
-
Jenkins is a continuous integration environment, widely used in industry
for running automated test suites, performing deployments, as well as many other use cases. This change adds a Jenkins integration to Review Board. This will enable
users to add this integration and have new review requests trigger builds on a Jenkins server. This additionally features a Jenkins plugin. This plugin features two
build steps. The first build step, to occur prior to the main job's build steps, applies the review request's diff using rbt patch
. Thesecond, post-build step notifies review board of the build's status. ~ There is still additional work to be done. Notably, there are no unit
~ tests. There was also the request of having variable in job names (i.e. ~ There is still additional work to be done, such as completion of unit
~ tests for rbintegrations and creating unit tests for rbjenkins. - {branch}), which still needs to be added. - Commit:
-
e1506158ca349f7196591b54caea41af39103619ee3da305bffd1c2a2beaa59069a64983324c35c9
- Diff:
-
Revision 5 (+1417 -38)
Checks run (2 succeeded)
-
This looks like a lot of comments, but they're all pretty tiny things (your change is looking so good I reviewed it as if there were no "[WIP]" tag).
-
Instead of just calling this "Review Board", can we be more specific? "Review Board plugin for Jenkins"?
-
-
-
-
-
-
-
-
-
Here's a somewhat nicer way to wrap this:
ReviewBoardUtils.updateStatusUpdate( new URL(getReviewBoardURL()), getReviewBoardAPIToken(), reviewRequest.getReviewId(), reviewRequest.getStatusUpdateId(), state, description);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Docstring for this method should start with a summary line that explains what the function does. Justification like this can go in a second paragraph.
-
-
-
-
-
-
When we have an apostrophe, it's fine to surround the string in double quotes instead of single. Also needs a period at the end.
-
-
I know we might have some docstrings like this, but going forward we're documenting properties like they were attributes instead of functions. This can therefore just be "The icons used for the integration" as a single-line docstring.
-
- Change Summary:
-
- Incorporated changes as per David's review.
- Description:
-
Jenkins is a continuous integration environment, widely used in industry
for running automated test suites, performing deployments, as well as many other use cases. This change adds a Jenkins integration to Review Board. This will enable
users to add this integration and have new review requests trigger builds on a Jenkins server. This additionally features a Jenkins plugin. This plugin features two
build steps. The first build step, to occur prior to the main job's build steps, applies the review request's diff using rbt patch
. Thesecond, post-build step notifies review board of the build's status. + rbintegrations/util/urlrequest.py
featured duplicate code from the+ reviewboard repository, reviewboard.hostingsvcs.service.URLRequest
.+ That class is currently an internal class, so rather than importing it + in all files that use it in this repository, for now we'll import it + once in this file. Once URLRequest
is refactored in the reviewboard+ repo, we can remove the urlrequest.py
file and import the original+ class. + There is still additional work to be done, such as completion of unit
tests for rbintegrations and creating unit tests for rbjenkins. - Commit:
-
ee3da305bffd1c2a2beaa59069a64983324c35c96cc3ee7da37351438fefea9928fbefdc0bbf0f90
- Diff:
-
Revision 6 (+1437 -38)
Checks run (2 succeeded)
- Change Summary:
-
Added unit tests to the rbjenkins code.
- Commit:
-
6cc3ee7da37351438fefea9928fbefdc0bbf0f904317549719e45780e7b3d9bf623658d98b54ff2f
- Diff:
-
Revision 7 (+1580 -38)
Checks run (2 succeeded)
- Change Summary:
-
This change is mostly about refactoring the Jenkins code so we move the server
configurations to the global configuration page. This allows the build steps
to simply reference a server configuration by name, rather than having to
specify a URL and API token every time. Unit tests are working, but I will
have to add more tests to account for the new configuration as well as fix
credentials in unit tests.Additionally, a bug related to accessing URLAvatarService was fixed.
- Commit:
-
4317549719e45780e7b3d9bf623658d98b54ff2f0ec22f84d7e200f1ad87eabeb7747b71a2550501
- Diff:
-
Revision 8 (+1497 -38)
Checks run (2 succeeded)
- Change Summary:
-
- The
jenkins-ci
user API token is now displayed in the integration configuration page. - Jenkins configuration workflow has been tweaked again, now there's no name required for each RB server, nor do you have to provide a server when adding a build step. RB now sends its URL to Jenkins, so Jenkins can just look up which server details to use.
- Also, my last revision accidentally removed the Setup/Notifier java files. This one adds them back!
- The
- Commit:
-
0ec22f84d7e200f1ad87eabeb7747b71a25505014cb481d0bb902c1506ac8ba1c09b4b54a65af1b1
- Diff:
-
Revision 9 (+2030 -38)
Checks run (2 succeeded)
- Change Summary:
-
- Some slight tweaks to code
- New unit test for rbintegration codebase
- Commit:
-
4cb481d0bb902c1506ac8ba1c09b4b54a65af1b1277adf7fc8010fd353a5d8b5dd59148109b178c7
- Diff:
-
Revision 10 (+2090 -38)
Checks run (2 succeeded)
- Change Summary:
-
- Created unit tests to verify global configuration related behaviour
- WIP tag removed!
- Summary:
-
[WIP] Add Jenkins CI integrationAdd Jenkins CI integration
- Description:
-
Jenkins is a continuous integration environment, widely used in industry
for running automated test suites, performing deployments, as well as many other use cases. This change adds a Jenkins integration to Review Board. This will enable
users to add this integration and have new review requests trigger builds on a Jenkins server. This additionally features a Jenkins plugin. This plugin features two
build steps. The first build step, to occur prior to the main job's build steps, applies the review request's diff using rbt patch
. Thesecond, post-build step notifies review board of the build's status. rbintegrations/util/urlrequest.py
featured duplicate code from thereviewboard repository, reviewboard.hostingsvcs.service.URLRequest
.That class is currently an internal class, so rather than importing it in all files that use it in this repository, for now we'll import it once in this file. Once URLRequest
is refactored in the reviewboardrepo, we can remove the urlrequest.py
file and import the originalclass. - - There is still additional work to be done, such as completion of unit
- tests for rbintegrations and creating unit tests for rbjenkins. - Testing Done:
-
~ Some testing has been done. All testing has been using a git repository,
~ so I still need to test other repositories to see how they will function. ~ This is mostly a POC for triggering Jenkins builds. Future revisions will ~ - Unit tests have been created and ran for the Jenkins java plugin
- Run
mvn test
in the base directory
- Run
~ - Unit tests have been created and ran for rbintegrations
~ - Manual testing of creating reviews, publishing them, triggering
builds on Jenkins server, and those builds updating the status
once complete.
- feature unit tests. - Unit tests have been created and ran for the Jenkins java plugin
- Commit:
-
277adf7fc8010fd353a5d8b5dd59148109b178c7b82588e39bc681cdcd408568c817a5743f0dcd92
- Diff:
-
Revision 11 (+2289 -38)
Checks run (2 succeeded)
-
This is fantastic. I have a few small, very trivial comments, but I'd say this is amount 99% there.
-
-
-
-
-
-
-
-
-
-
-
-
Summary line of the docstring should be just one line. Additional details can be provided in subsequent paragraphs.
-
-
-
We have an improved version of this as
djblets.util.decorators.cached_property
, which should probably be used instead. -
Property docstrings should be documented like attributes rather than methods. So just
"""The icons used for the integration."""
-
-
-
There are two potentially better ways to wrap this:
status_update.description = \ 'failed to communicate with Jenkins'
or
status_update.description = ('failed to communicate with ' 'Jenkins.')
-
-
-
Add a blank line above this.
Also, the
u
prefix on the string isn't necessary because you're importingunicode_literals
-
-
So that output is consistent when running the suite, all test docstrings should start with "Testing"
-
So that output is consistent when running the suite, all test docstrings should start with "Testing"
-
So that output is consistent when running the suite, all test docstrings should start with "Testing"
-
Can you add a comment explaining why people shouldn't import this directly? (basically just copy from your review request description).
- Change Summary:
-
- Tweaked code, thanks Janice and David for your reviews!
- Updated the version to Java 8, allowing for use of lambda functions.
- Commit:
-
b82588e39bc681cdcd408568c817a5743f0dcd9206cc334df7cd15fbec72208b5aa4d01980d16012
- Diff:
-
Revision 12 (+2362 -39)
Checks run (2 succeeded)
- Change Summary:
-
Fix incorrect import.
- Commit:
-
06cc334df7cd15fbec72208b5aa4d01980d160123d0d2e88aebb0a409836306e9e40d98d83f13278
- Diff:
-
Revision 13 (+2362 -39)