Authentication issue with Gerrit Code Review plugin 0.4.1

49 views
Skip to first unread message

John Shield

unread,
May 26, 2020, 5:04:53 PM5/26/20
to Jenkins Users
Dear All,

Looking for some help understanding how to assign credentials for the Gerrit Code Review Plugin to work.

Aside from that specific plugin, we're able to build and get verification tags just fine. The git successfully checks out from gerrit using the credentials defined for the checkout SCM in a declarative pipeline, and Jenkins successfully posts the normal build verification.

When attempting to use commands from Gerrit Code Review Plugin "gerritComment" or "gerritReview labels", we get the following error message.
"Gerrit Review requires authentication, however there are no credentials defined or are empty."

It's unclear for me how the Gerrit Code Review Plugin accepts credentials. I haven't been able to find out any documentation about a special credentials id variable, or example for the plugin needing declaration of credentials.

I would be grateful for any help in understanding this problem.

Best Regards,

John Shield

Luca Milanesio

unread,
May 26, 2020, 10:00:41 PM5/26/20
to jenkins...@googlegroups.com, Luca Milanesio

On 26 May 2020, at 17:10, John Shield <john.k...@gmail.com> wrote:

Dear All,

Looking for some help understanding how to assign credentials for the Gerrit Code Review Plugin to work.

Aside from that specific plugin, we're able to build and get verification tags just fine. The git successfully checks out from gerrit using the credentials defined for the checkout SCM in a declarative pipeline, and Jenkins successfully posts the normal build verification.

When attempting to use commands from Gerrit Code Review Plugin "gerritComment" or "gerritReview labels", we get the following error message.
"Gerrit Review requires authentication, however there are no credentials defined or are empty."

It's unclear for me how the Gerrit Code Review Plugin accepts credentials.

You need to define the SCM credentials in the Gerrit SCM source of the pipeline, otherwise Jenkins won’t know what’s the credentials-id to use.

Please note that Gerrit repos have two URLs: one anonymous and one for authenticated access (prefixed by ‘/a/‘). You need to use the authenticated one for being able to post reviews.

I haven't been able to find out any documentation about a special credentials id variable, or example for the plugin needing declaration of credentials.

I would be grateful for any help in understanding this problem.

Let me know if the above guidance is enough.

HTH

Luca.

Best Regards,

John Shield


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/56812aa6-41f6-4434-837e-7ff54a4a276f%40googlegroups.com.

John Shield

unread,
May 26, 2020, 11:34:35 PM5/26/20
to Jenkins Users
Thanks Luca,

I had a look at the SCM credentials we're using for the pipeline and the "Repository URL" in the SCM. As far as I can tell it is setup correctly. The URL is the one for the authenticated access, and the credentials provided are being used by the SCM checkout.

The plugin still seems to think there are no credentials.

I've included a screenshot of the SCM definition.

SCM Settings.png


It would be great to finally get the Gerrit Code Review plugin working, as we want to separate regression builds into a separate tag. To be honest, we've been ignoring the problem for 6 months as we've focusing on the project work instead.

Best Regards,

John Shield

On Wednesday, May 27, 2020 at 7:30:41 AM UTC+9:30, Luca Milanesio wrote:


On 26 May 2020, at 17:10, John Shield <john....@gmail.com> wrote:

Dear All,

Looking for some help understanding how to assign credentials for the Gerrit Code Review Plugin to work.

Aside from that specific plugin, we're able to build and get verification tags just fine. The git successfully checks out from gerrit using the credentials defined for the checkout SCM in a declarative pipeline, and Jenkins successfully posts the normal build verification.

When attempting to use commands from Gerrit Code Review Plugin "gerritComment" or "gerritReview labels", we get the following error message.
"Gerrit Review requires authentication, however there are no credentials defined or are empty."

It's unclear for me how the Gerrit Code Review Plugin accepts credentials.

You need to define the SCM credentials in the Gerrit SCM source of the pipeline, otherwise Jenkins won’t know what’s the credentials-id to use.

Please note that Gerrit repos have two URLs: one anonymous and one for authenticated access (prefixed by ‘/a/‘). You need to use the authenticated one for being able to post reviews.

I haven't been able to find out any documentation about a special credentials id variable, or example for the plugin needing declaration of credentials.

I would be grateful for any help in understanding this problem.

Let me know if the above guidance is enough.

HTH

Luca.

Best Regards,

John Shield


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

Luca Milanesio

unread,
May 26, 2020, 11:41:57 PM5/26/20
to jenkins...@googlegroups.com, Luca Milanesio

On 27 May 2020, at 00:34, John Shield <john.k...@gmail.com> wrote:

Thanks Luca,

I had a look at the SCM credentials we're using for the pipeline and the "Repository URL" in the SCM. As far as I can tell it is setup correctly. The URL is the one for the authenticated access, and the credentials provided are being used by the SCM checkout.

The plugin still seems to think there are no credentials.

A few things:

1. The Gerrit Code Review plugin supports only Git/HTTP URLs at the moment
2. You should select “Gerrit” as SCM source (you have a “Git” SCM source at the moment)
3. Do not use any Gerrit Trigger strategy, as this plugin doesn’t use Gerrit stream events.

HTH

Luca.


I've included a screenshot of the SCM definition.

<SCM Settings.png>

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/994bd305-6a04-4c1b-bc53-9ac9bc234b7f%40googlegroups.com.
<SCM Settings.png>

John Shield

unread,
May 27, 2020, 12:29:27 AM5/27/20
to Jenkins Users
Hi Luca,

I took a look into these suggestions. It seems like I'll need to get back to you after asking for assistance from my work colleagues.

1. I switched to the https URL and got authentication failures in the Jenkins interface. I'm assuming that credentials weren't enabled for https, so I raised a query with our IT department.
2. We don't seem to have a Gerrit SCM source configured. Git is the only option available in that dropdown. I'll need to ask around on that one again and see what I can find out.
3. I attempted to switch the Trigger to Default. However, the build stopped working as the SCM pipeline didn't know which patch to download. I will have to look into this more after the first two issues are resolved.

Thanks for the pointers. I will spend some time chasing these up.

Best Regards,

John Shield

On Wednesday, May 27, 2020 at 9:11:57 AM UTC+9:30, Luca Milanesio wrote:

John Shield

unread,
May 27, 2020, 3:21:56 AM5/27/20
to Jenkins Users
Hi Luca,

I want to say I've greatly appreciated your help with finding out what was wrong.

The problem was because we were using the ssh credentials. When I got our IT department to make the https credentials and switched our build pipeline over to that, it all started working.

Can't thank you enough for helping me find it. The issue had been on my mind for the last 6 months.

Best Regards,

John Shield
Reply all
Reply to author
Forward
0 new messages