33 Commits

Author SHA1 Message Date
David Pursehouse
3947bc5b81 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Use the environment variables provided by the GerritCodeReview-plugin
  DeleteZombieCommentsRefsTest: Open RevWalk in try-with-resource
  Documentation: Mention unused_deps with buildifier
  Bazel: Remove bazel version check
  Documentation: Recommend Bazelisk to launch bazel
  Add a pgm to delete dead draft comments refs

Change-Id: I7ce0b91695a99cbfc630ba5fd69ba1cf20e84f7a
2020-01-29 08:19:37 +09:00
Thomas Draebing
91d62c0776 Use the environment variables provided by the GerritCodeReview-plugin
So far the pipeline described in the Jenkinsfile queried Gerrit to get
the change metadata. By now the GerritCodeReview provides this data as
environment variables. This reduces the boilerplate code needed in the
Jenkinsfile.

Change-Id: Ibc18d7f1b350e6070e93164cea6a5ff3fd826ae3
2020-01-28 13:47:40 +01:00
Luca Milanesio
ec52360df1 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Avoid use of switch on String for Checks API results

Change-Id: Id22561af05dee10df371c56cc6f965932115c87d
2020-01-10 23:04:01 +00:00
Luca Milanesio
97caed1d34 Avoid use of switch on String for Checks API results
After the recent upgrades of Jenkins and the pipeline-related
plugins, the Groovy switch on string for the build results conversion
into the Checkers result returned null causing build failures.

Use the safer if/then/else construct that works also with
the latest Groovy/CPS sandbox.

Change-Id: Ibb4ea9d8b6669a548be1826519deaf008304dcf6
2020-01-10 22:34:32 +00:00
David Pursehouse
916aec7172 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Reduce change spamming from CI
  Link checker result to the proper console URL
  Remove unused createCheckPayload() method

Change-Id: I71f8209fcda072e5e06451db8ab2c403f45b0765
2020-01-09 09:32:10 +09:00
Luca Milanesio
cb5bdf7ebb Reduce change spamming from CI
Now that the checks integration is reliable and
clear enough in terms of messaging, the extra spamming
from the CI on the change log can be reduced to a minimum
avoiding the redundant feedback on validation and build
logs URLs.

Change-Id: Idd23d088c5238ecdcd1106a378cf65e198b77782
2020-01-05 23:06:33 +00:00
Luca Milanesio
8ffcf65ba6 Link checker result to the proper console URL
Point each individual checker to its associated
sub-job's console URL.

Change-Id: Ifbdb646ac0fec94420a68760c4847d52f97690ba
2020-01-05 23:06:19 +00:00
Luca Milanesio
c45278654b Remove unused createCheckPayload() method
The Checks API integration is now delegated to the
gerrit-code-review plugin and thus the createCheckPayload()
method isn't needed anymore.

Change-Id: I2479ec551c4dae85b83c504413e77405c327bd9f
2020-01-05 18:00:15 +00:00
David Ostrovsky
e7d93748d2 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Bump Bazel version to 2.0.0
  Set version in package.json to 2.16.16-SNAPSHOT
  Use gerritCheck API for posting checker result

Change-Id: I78c316055ff87bf8878fcbbfeeae723640b95bd2
2020-01-04 12:53:19 +01:00
Luca Milanesio
cfd870a8a6 Use gerritCheck API for posting checker result
Since the upgrade to the Gerrit Code Review plugin
v0.4.0, the integration with Checks is tighter and
it isn't needed anymore to make a direct invocation
of the Checks API to submit the checker result.

Change-Id: Icc06094e0a66d7a0b2e1428dcb605395d4027501
2020-01-01 20:57:14 +00:00
David Pursehouse
82ee9dc5ae Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Use reliable check for empty env.GERRIT_CHANGE_NUMBER
  Do not build on stable-2.14 branch

Change-Id: If60fc67b15f4b5090cbee6dd9c65f4dbe4b5fcba
2019-12-08 11:31:52 +09:00
Luca Milanesio
c5e879b8ad Use reliable check for empty env.GERRIT_CHANGE_NUMBER
Check for either null or empty variable when looking
for the current Gerrit change number under build in
Jenkinsfile.

Change-Id: Ia274647bb135dda61111845c970f5f4762093dcd
2019-12-08 11:30:47 +09:00
David Pursehouse
3648cbafa1 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Do not report verification status for branches

Change-Id: I4bc07ca2c5de5e78419be6f56afbe82f5df67987
2019-11-27 08:53:43 +09:00
David Pursehouse
c8a5f9c187 Merge "Do not report verification status for branches" into stable-2.16 2019-11-26 23:52:53 +00:00
David Pursehouse
975aa701c6 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Update paper-styles to dd0b13e186b9690d5e74a93f6e51e0835ea60495
  Fix reporting for flaky builds in Jenkinsfile

Change-Id: Ibcf36ab82b85684baf8c442eddc81fee66320341
2019-11-26 10:18:01 +09:00
David Pursehouse
e0d1d655c2 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Fix reporting for flaky builds in Jenkinsfile

Change-Id: Ie6e4a2e57aadd727990fc8dfa6e96dac34af1a1b
2019-11-26 10:16:21 +09:00
Luca Milanesio
fff6e5cf4a Do not report verification status for branches
When running on a regular branch, there is no need to
report any feedback to Gerrit because the commits are merged
already and any negative validation would be ignored.

Run the dedicated build for branches rather than invoking
the special validation jobs.

Change-Id: I6b9b8bbe41fc2763b48162c8fb9477e1a8807e0c
2019-11-25 09:30:22 +00:00
Thomas Draebing
bf79cd73eb Fix reporting for flaky builds in Jenkinsfile
The verification pipeline was not properly reporting the results of
builds that were suspect to being flaky. This happened, because the
build did not save the results in a variable, if the propagate option
was used, which had to be done for the pipeline plugin's retry command
to work.

Instead of using the retry-command provided by the pipeline plugin,
the Jenkinsfile implements this behaviour manually.

Bug: Issue 11927
Change-Id: I419a20f69cabc4c54d7f57fd04ad354563eafd71
2019-11-16 05:58:18 +00:00
David Ostrovsky
c96b17ccf8 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Jenkinsfile: Always build java sources if WORKSPACE file changed

Change-Id: Ic8232adf53cf287b9cc8db32ea5487d2ce5b923a
2019-11-13 08:17:27 -08:00
David Ostrovsky
b2127602d4 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Jenkinsfile: Always build java sources if WORKSPACE file changed

Change-Id: Icf16c395bbb87e9b758e6435a9a1976a23754126
2019-11-13 06:10:24 -08:00
David Ostrovsky
1a134ba6d4 Jenkinsfile: Always build java sources if WORKSPACE file changed
Bug: Issue 11916
Change-Id: I0d273f8536c3b2ee10f8a6f938bc8dc3374ce0a5
2019-11-13 05:33:56 -08:00
Paladox
f6aa2df3cf Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Jenkinsfile: don't use Map.remove() as it is forbidden

Change-Id: Id537b84b85d1abe223b04c411940015ee13da3e7
2019-11-09 20:00:35 +00:00
Paladox
6aee3b3715 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Jenkinsfile: don't use Map.remove() as it is forbidden

Change-Id: Ic592d2d3493cce9420deb0a0dc49fde8b610b938
2019-11-09 19:58:37 +00:00
Luca Milanesio
7637d661b9 Jenkinsfile: don't use Map.remove() as it is forbidden
When retriggering flaky builds, do not use the non-CPS method Map.remove()
and instead create a new Map.

Bug: Issue 11876
Change-Id: I383a2351ad907acd19d21c459a0fd660e8abe028
2019-11-07 08:39:34 +00:00
David Pursehouse
c42ba05917 Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
  Update highlight.js to include soy
  Update building docs for building highlight.js
  config-gerrit: Remove superfluous quote mark
  Stop query from executing if predicate is empty
  Highlight jinja2 syntax
  Highlight Jenkinsfile as groovy
  Update highlight.js
  Verify Gerrit changes also on NoteDb
  Don't sort messages returned by Jenkins
  Fix string formatting in Jenkinsfile
  Fix RejectedAccessException during posting checks in Jenkinsfile
  Remove unnecessary SCM checkout from Jenkinsfile
  Fix expected response code when posting checks in Jenkinsfile
  Use basic auth for posting checks
  Add Jenkinsfile for verification pipeline

Remove the reviewDb build from Jenkinsfile.

Change-Id: I48f1fd6c19f87a55cb838955c5edbfb40f7db68f
2019-10-22 10:58:12 +09:00
Luca Milanesio
b744cd1d14 Verify Gerrit changes also on NoteDb
All changes on stable-2.15 need to be verified against
both reviewdb and notedb.

Change-Id: I7328d419f4d0ea99e8cd4fd3706145995b981f8b
2019-10-17 21:25:35 +00:00
Thomas Draebing
92ef8948fa Don't sort messages returned by Jenkins
The sorting of messages Jenkins would send back after verifying
a change did not work anymore as it was implemented in the workflow script.

This change removes the sorting of the messages.

Change-Id: I9cb14308ed354c31fae08e3c7190a7f886f242bf
2019-10-17 18:38:08 +02:00
Thomas Draebing
5af8dad0ef Fix string formatting in Jenkinsfile
The string formatting in the Jenkinsfile during the post of the
checks was broken. Groovy did not accept the operator in a hanging
line.

Change-Id: Ica7e6e9dedde31ca90888e4288975f4a1e6e7a07
2019-10-17 18:37:49 +02:00
Thomas Draebing
70501f4531 Fix RejectedAccessException during posting checks in Jenkinsfile
Change-Id: I3e44fdb39487b81cfd853dfbba10a7990bdc381f
2019-10-17 11:29:16 +02:00
Thomas Draebing
f27c6bef5c Remove unnecessary SCM checkout from Jenkinsfile
Change-Id: Iae80a5faeb0973a02564a8c8db9ae1a7b589d236
2019-10-17 11:29:16 +02:00
Thomas Draebing
c82125dd17 Fix expected response code when posting checks in Jenkinsfile
The response code returned on success was 200, but the job described
in the Jenkinsfile expected 201. Now the job correctly expects 200.

Change-Id: I7f22484d98f399fa8dbebec1bdc73926bf8e4040
2019-10-17 11:29:16 +02:00
Thomas Draebing
dab2dcf6b9 Use basic auth for posting checks
The verification pipeline described in the Jenkinsfile was trying to
post checks without authentication. This led to a returned 401 status.

Change-Id: Ic3bf661373fe7a8b51416d900690c105c10987b3
2019-10-17 11:29:13 +02:00
Thomas Draebing
9730f0bcd1 Add Jenkinsfile for verification pipeline
So far the job for verifying changes in the `gerrit`-project was managed
in the repository of the CI itself. These jobs were still using the by
now deprecated workflow type.

This change adds a Jenkinsfile to this project, which describes the build
and test workflow to be executed by the CI. The job will be executed by a
multibranch pipeline in the CI.

Note, that the job described in the Jenkinsfile for now just starts
other jobs that will verify and check the code style of the change as it
was done so far in the `Gerrit-verifier-change`-job. It is planned to
change that in the future.

Notable changes to the `Gerrit-verifier-change`-job are:

- The job will not check on which branch it runs. The Jenkinsfiles present
  in the different branches will have to contain the branch-specific
  code.
- In pipelines Jenkins is very strict in which methods are allowed to be
  executed, since code can easily be added to a Jenkinsfile, which could
  execute malicious commands on the CI. To avoid to have to whitelist such
  methods in general, the code was adapted to only use allowed methods.
- The job is now triggered by the `verifier-trigger`-job in the CI.

Change-Id: I4d9ac3ebfd342243c6b7bf36186567e1b5175a4f
2019-10-15 15:03:23 +02:00