add support for custom project domain in user identity.#165
add support for custom project domain in user identity.#165olivergondza merged 1 commit intojenkinsci:masterfrom
Conversation
|
I must admit I am confused by all the OS domains. So the Can you please link relevant documentation to the field help to avoid the confusion? |
|
In Openstack, both projects (tenant) and users must belong to a domain. The fact that projects and users must be linked to a domain is documented in the Openstack documentation. Nothing specifies that they have to share the same domain. In the code of the pull-request, I have decided to make the project's domain optional to maintain compatibility with the current implementation. |
| <ul> | ||
| <li>For v2 authentication use syntax <tt>TENANT_NAME:USER_NAME</tt></li> | ||
| <li>For v3 authentication use syntax <tt>PROJECT_NAME:USER_NAME:DOMAIN_NAME</tt></li> | ||
| <li>For v3 authentication use syntax <tt>[PROJECT_DOMAIN\]PROJECT_NAME:USER_NAME:DOMAIN_NAME</tt> PROJECT_DOMAIN is optional, use only when DOMAIN_NAME and PROJECT_DOMAIN differs</li> |
b0c2194 to
3528f21
Compare
|
typo fixed, thank you @Guillaumichaud for the review |
|
Right, that was my understanding too. Is there a specific reason to use backslash as a separator and not a |
|
fine by me, I will update the PR accordingly. |
|
I think that all this foo:bar:optional stuff is just highlighting some tech-debt that we really ought to stuff all this in its own multi-field class. Not as part of this PR but I think we ought to do it... When it becomes difficult to explain everything in the online help text, that indicates that it's overdue for being refactored ;-) |
|
@pjdarton, certainly. Though, I hesitate to do it because of all the ajax method signatures getting nasty. IIRC, one of yours that would be painfully affected. |
|
Yes, the doCheck.../doFill... methods will get a lot more arguments but it's only us that'll see that - the end user will get a much cleaner experience. |
3528f21 to
3464964
Compare
|
the updated version simplifies the identity string (as so the documentation) as the domain name for the project is now mandatory. |
|
Hello there, any comment/remark on the latest version ? |
3464964 to
90edaee
Compare
|
PR updated to the latest version of master. |
|
I just tried these changes and they solved my authentication issues! I hope this can get merged and released soon? |
|
I agree with @pjdarton, that this is best refactored into (at least) 2 fields for project and username. |
|
@acontes Was the "Unresolveable build extension" error expected? :) |
90edaee to
b38fa20
Compare
|
rather than just adding a second field, I updated the code to use Jenkins' credentials and create two implementations ( one for v2 and one for v3 ). Adding a second field has the same impact on the API but is far less extensible. |
b38fa20 to
06d85c0
Compare
olivergondza
left a comment
There was a problem hiding this comment.
Great idea! I have added few minor comment on implementations side.
Is there some test that explicitly verifies the migration is performed correctly? IMO it is enough to extend existing "migration" tests to check the credentials object.
| ) throws FormValidation { | ||
| final String fingerprint = Util.getDigestOf(endPointUrl + '\n' + identity + '\n' + credential + '\n' + region); | ||
| if (auth == null) { | ||
| throw new RuntimeException("authentication is null"); |
There was a problem hiding this comment.
Why not keeping the parameters @Nonnull then?
| @@ -0,0 +1,3 @@ | |||
| <div> | |||
| The credential to start the machine. | |||
There was a problem hiding this comment.
This is the credential to talk to openstack.
| <?jelly escape-by-default='true'?> | ||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" | ||
| xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
| </j:jelly> No newline at end of file |
There was a problem hiding this comment.
Do we need a config.jelly for the abstract class if it is overridden by all implementations?
| @@ -0,0 +1,3 @@ | |||
| <div> | |||
| The tenant associated to the user to start the machine. | |||
There was a problem hiding this comment.
I find the "to start the machine" part in auth helps a bit confusing - it is needed for any interaction with openstack. I guess we can leave it out.
| @@ -0,0 +1,3 @@ | |||
| <div> | |||
| User name of the user to start the machine. | |||
There was a problem hiding this comment.
"to start the machine" is extremely confusing here.
| public class JCloudsCloud extends Cloud implements SlaveOptions.Holder { | ||
|
|
||
| private static final Logger LOGGER = Logger.getLogger(JCloudsCloud.class.getName()); | ||
| public String credentialId; |
| public final @Nonnull String identity; | ||
| public final @Nonnull Secret credential; | ||
|
|
||
| public /*final*/ @Nonnull String identity; |
There was a problem hiding this comment.
This one should be @Deprecated as well, right?
| OpenstackCredentials.add(migratedOpenstackCredential); | ||
| OpenstackCredentials.save(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); |
The changes add the ability to connect to openstack instances having the project's domain name different from the domain name by changing the format of the identity string. The identity string using the new format are converted into the new one using when the plugin is loaded.
06d85c0 to
fd0f931
Compare
|
revised version of the PR to address all the comments.
|
add support for custom project domain in user identity.
|
Merged, thanks! |
|
👍 |
The changes add the ability to connect to openstack instances having
the project's domain name different from the domain name.
It introduces an optional format for the user identity field while
remaining compatible with previous configurations of the
plugin.