Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-55813] Improve analysis of AD attributes #96

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jvz
Copy link
Member

@jvz jvz commented May 23, 2019

Reverts the revert of #89 to continue development.

@reviewbybees @Wadeck @fbelzunc

jvz added 4 commits May 23, 2019 15:19
This brings us up to date with the equivalent feature development in LDAP. This checks for some standard Active Directory user attributes for account validity checks along with adding an escape hatch to disable the behavior.

Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz jvz closed this Nov 9, 2020
@jvz jvz reopened this Nov 9, 2020
@jvz
Copy link
Member Author

jvz commented Nov 13, 2020

I managed to create a real Active Directory setup on GCP, so I'm going to manually test the changes here with the different account settings I can toggle (locked, expired, etc.)

Signed-off-by: Matt Sicker <boards@gmail.com>
An account expiration date of 1601-01-01 at midnight is documented as indicating that the account does not expire. This would be easier to notice if IADsUser.accountExpirationDate() returned a long instead of a Date because it would have been 0.

Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz jvz marked this pull request as ready for review November 18, 2020 19:47
@jvz
Copy link
Member Author

jvz commented Nov 18, 2020

I've tested this plugin in both ADSI mode and manually configured with Windows Server 2019 and Active Directory with the three featured attributes (expired, locked, disabled) all manually tested. It was during this testing that I discovered why the original PR had caused a regression: in ADSI mode, the com4j interfaces created for calling the ADSI native code were converting the timestamp into a Date which made it non-obvious to look for a logical 0 timestamp of 1601-01-01T00:00:00Z. Everything seems to be working fine in both modes. I'll be testing out the corresponding LDAP PR (jenkinsci/ldap-plugin#59) in this same Active Directory domain to ensure everything is consistent.

Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
@@ -382,12 +384,14 @@ public UserDetails call() throws AuthenticationException, NamingException {
// locate this user's record
final String domainDN = toDC(domain.getName());

Attributes user = new LDAPSearchBuilder(context, domainDN).subTreeScope().searchOne("(& (userPrincipalName={0})(objectCategory=user))", userPrincipalName);
Attributes user = new LDAPSearchBuilder(context, domainDN).subTreeScope().returns("*", "+")
.searchOne("(& (userPrincipalName={0})(objectCategory=user))", userPrincipalName);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm no AD admin, but theoretically, these two LDAP filters can be combined into one like so:

(&(objectCategory=user)(|(userPrincipalName={0})(sAMAccountName={0})))

No idea how that would affect or potentially destroy performance of LDAP indices that may be set up.

@jeffret-b
Copy link

@jvz, any reason why this test failure can be ignored?

@jvz
Copy link
Member Author

jvz commented Dec 8, 2020

Might need to re-run that. Let me try that.

@jvz jvz closed this Dec 8, 2020
@jvz jvz reopened this Dec 8, 2020
@jvz
Copy link
Member Author

jvz commented Dec 9, 2020

I can't reproduce the test failure locally.

@jeffret-b
Copy link

I can't reproduce the test failure locally either, but given the substantial implementation differences between Unix and Windows, we can't just ignore it. It might be part of general issues with Windows test machines or infra.

@fbelzunc
Copy link
Contributor

fbelzunc commented Dec 9, 2020

@jvz @jeffret-b I can easily reproduce the test failure.

To reproduce it, you need to have Docker Engine up and running and have in your DNS settings configured with something like this - adapted to your OS (take special attention to de 127.0.0.1 thing - IIRC this is the only important thing from the DNS to add)

Screenshot 2020-12-09 at 21 37 13

Then, run the following maven command

mvn clean test -P\!noIT

the -P\!noIT will disable this profile activated by default which DOES NOT run the docker test by default.

<profiles>
    <profile>
      <id>noIT</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

@jvz
Copy link
Member Author

jvz commented Dec 9, 2020

Seems as though one problem is that if docker isn't available, the tests pass with an error message.

@jvz
Copy link
Member Author

jvz commented Dec 9, 2020

Ok, when I make sure Docker is running, and after running with that profile, I get three test failures:

[ERROR] Tests run: 18, Failures: 2, Errors: 1, Skipped: 0, Time elapsed: 484.264 s <<< FAILURE! - in hudson.plugins.active_directory.docker.TheFlintstonesTest
[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.validateDomain  Time elapsed: 25.953 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[OK: Success]> but was:<[ERROR: samdom.example.com doesn&#039;t look like a valid domain name]>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.validateDomain(TheFlintstonesTest.java:222)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.checkDomainHealth  Time elapsed: 24.665 s  <<< ERROR!
java.lang.NullPointerException
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.checkDomainHealth(TheFlintstonesTest.java:206)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

[ERROR] hudson.plugins.active_directory.docker.TheFlintstonesTest.validateCustomDomainController  Time elapsed: 23.697 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[OK: Success]> but was:<[WARNING: Success - but samdom.example.com does not look like a valid domain name]>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at hudson.plugins.active_directory.docker.TheFlintstonesTest.validateCustomDomainController(TheFlintstonesTest.java:214)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.jenkinsci.test.acceptance.docker.DockerRule$1.evaluate(DockerRule.java:87)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:599)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)

I get the same exact failures running those tests on the master branch. Can you confirm that the tests are passing in master and on what OS?

@fbelzunc
Copy link
Contributor

I think those three tests will be fixed if you add in your /etc/hosts an entre for 127.0.0.1 samdom.example.com

  • TheFlintstonesTest.validateDomain
  • TheFlintstonesTest.checkDomainHealth
  • TheFlintstonesTest.validateCustomDomainController

However, the test I am worried about is TheFlintstonesTest.loadGroupFromAlias. It is failing here as well. Is it not failing on your computer?

@jvz
Copy link
Member Author

jvz commented Dec 10, 2020

That test seems to pass on my computer. I'm not sure if it's a timeout issue or docker-specific or what as the integration test itself has a lot of supporting infrastructure.

I'll retry the tests with that hosts file entry and get back to you.

@jvz
Copy link
Member Author

jvz commented Dec 10, 2020

Adding the hosts entries still have the tests failing. The assertion doesn't provide any information, either, so I'm not even sure how to go about debugging this, especially when running this test takes nearly 10 minutes on my machine for some reason.

@jvz
Copy link
Member Author

jvz commented Dec 10, 2020

Oh wait, I didn't try setting my network settings to match your DNS screenshot. Let me try that as well and see if it makes a difference.

Adding more actions in custom.sh causes the logs to be longer than expected by the test.

Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz
Copy link
Member Author

jvz commented Dec 10, 2020

Alright, I finally figured it out after much debugging. Turns out the log capturing wasn't capturing enough of the log anymore now that the setup was doing more things.

@jvz
Copy link
Member Author

jvz commented Dec 10, 2020

Alright, I give up on that failing test on CI. It works on my machine. Log as proof:

$ mvn -P'!noIT' clean test -Dtest=TheFlintstonesTest\#loadGroupFromAlias
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< org.jenkins-ci.plugins:active-directory >---------------
[INFO] Building Jenkins Active Directory plugin 2.21-SNAPSHOT
[INFO] --------------------------------[ hpi ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ active-directory ---
[INFO] Deleting /Users/matt/code/gh-jenkinsci/active-directory-plugin/target
[INFO]
[INFO] --- maven-hpi-plugin:3.15:validate (default-validate) @ active-directory ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:display-info (display-info) @ active-directory ---
[INFO] Maven Version: 3.6.3
[INFO] JDK Version: 1.8.0_222 normalized as: 1.8.0-222
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.16
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (display-info) @ active-directory ---
[INFO] Adding ignore: module-info
[INFO] Ignoring requireUpperBoundDeps in com.google.guava:guava
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (no-snapshots-in-release) @ active-directory ---
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:addTestSources (test-in-groovy) @ active-directory ---
[INFO]
[INFO] --- maven-localizer-plugin:1.26:generate (default) @ active-directory ---
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ active-directory ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 25 resources
[INFO]
[INFO] --- flatten-maven-plugin:1.2.5:flatten (flatten) @ active-directory ---
[INFO] Generating flattened POM of project org.jenkins-ci.plugins:active-directory:hpi:2.21-SNAPSHOT...
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ active-directory ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/classes
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[27,25] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[615,52] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[WARNING] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectorySecurityRealm.java:[647,48] com.sun.jndi.ldap.LdapCtxFactory is internal proprietary API and may be removed in a future release
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Some input files use or override a deprecated API.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/main/java/hudson/plugins/active_directory/ActiveDirectoryUnixAuthenticationProvider.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- access-modifier-checker:1.16:enforce (default-enforce) @ active-directory ---
[INFO]
[INFO] --- maven-hpi-plugin:3.15:insert-test (default-insert-test) @ active-directory ---
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:generateTestStubs (test-in-groovy) @ active-directory ---
[INFO] No sources specified for stub generation. Skipping.
[INFO] Generated 0 stubs.
[INFO]
[INFO] --- maven-antrun-plugin:3.0.0:run (createTempDir) @ active-directory ---
[INFO] Executing tasks
[INFO]     [mkdir] Created dir: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ active-directory ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 43 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ active-directory ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/test-classes
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/test/java/hudson/plugins/active_directory/ActiveDirectoryAuthenticationProviderTest.java: Some input files use or override a deprecated API.
[INFO] /Users/matt/code/gh-jenkinsci/active-directory-plugin/src/test/java/hudson/plugins/active_directory/ActiveDirectoryAuthenticationProviderTest.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-hpi-plugin:3.15:test-hpl (default-test-hpl) @ active-directory ---
[INFO] Generating /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/test-classes/the.hpl
Downloading from cert-snapshots: https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom
[WARNING] Error resolving project artifact: Could not transfer artifact com.sun:tools:pom:1.8.0 from/to cert-snapshots (https://repo.jenkins-ci.org/cert-snapshots/): Transfer failed for https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom 409 Conflict for project com.sun:tools:jar:1.8.0
[INFO]
[INFO] --- maven-hpi-plugin:3.15:resolve-test-dependencies (default-resolve-test-dependencies) @ active-directory ---
[WARNING] Error resolving project artifact: Failure to transfer com.sun:tools:pom:1.8.0 from https://repo.jenkins-ci.org/cert-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of cert-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact com.sun:tools:pom:1.8.0 from/to cert-snapshots (https://repo.jenkins-ci.org/cert-snapshots/): Transfer failed for https://repo.jenkins-ci.org/cert-snapshots/com/sun/tools/1.8.0/tools-1.8.0.pom 409 Conflict for project com.sun:tools:jar:1.8.0
[INFO]
[INFO] --- gmavenplus-plugin:1.10.0:compileTests (test-in-groovy) @ active-directory ---
[INFO] No sources specified for compilation. Skipping.
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ active-directory ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running hudson.plugins.active_directory.docker.TheFlintstonesTest
=== Starting loadGroupFromAlias(hudson.plugins.active_directory.docker.TheFlintstonesTest)
   0.127 [id=13]	INFO	o.jvnet.hudson.test.WarExploder#explode: Exploding /Users/matt/.m2/repository/org/jenkins-ci/main/jenkins-war/2.235.5/jenkins-war-2.235.5.war into /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/jenkins-for-test
   3.081 [id=13]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:61623/jenkins/
   4.920 [id=29]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
   5.576 [id=41]	WARNING	hudson.ClassicPluginStrategy#createClassJarFromWebInfClasses: Created /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/mailer/WEB-INF/lib/classes.jar; update plugin to a version created with a newer harness
   5.611 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/matrix-auth.jpi
   5.667 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/command-launcher.jpi
   5.710 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/jdk-tool.jpi
   5.745 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/trilead-api.jpi
   5.777 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/script-security.jpi
   5.872 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/windows-slaves.jpi
   5.968 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/antisamy-markup-formatter.jpi
   6.026 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/junit.jpi
   6.072 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/bouncycastle-api.jpi
   6.177 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/scm-api.jpi
   6.196 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/workflow-step-api.jpi
   6.209 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/structs.jpi
   6.226 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/matrix-project.jpi
   6.273 [id=41]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/jenkins6341267302019045133/plugins/workflow-api.jpi
   6.423 [id=28]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
   6.545 [id=42]	INFO	j.b.a.SecurityProviderInitializer#addSecurityProvider: Initializing Bouncy Castle security provider.
   6.797 [id=42]	INFO	j.b.a.SecurityProviderInitializer#addSecurityProvider: Bouncy Castle security provider initialized.
  10.054 [id=31]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
  10.071 [id=41]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
  10.074 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
  11.734 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
  11.735 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
  11.820 [id=30]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
  11.821 [id=42]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
  12.125 [id=28]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
Building Docker image `docker build -t jenkins/ad-dc:a793f48985af /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/Dockerfile1147026841366562504dir`: logfile is at /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/docker-TheFlintstones-build3211770901883481536.log
Launching Docker container `docker run -d -p 127.0.0.1:135:135 -p 127.0.0.1:138:138 -p 127.0.0.1:445:445 -p 127.0.0.1:39:39 -p 127.0.0.1:464:464 -p 127.0.0.1:389:389 -p 127.0.0.1:3268:3268 -p 127.0.0.1:53:53/udp jenkins/ad-dc:a793f48985af`: logfile will be at /Users/matt/code/gh-jenkinsci/active-directory-plugin/target/tmp/docker-TheFlintstones-run3198948238190233670.log
  48.295 [id=13]	WARNING	h.p.a.ActiveDirectoryUnixAuthenticationProvider$4#call: JENKINS-45576: `Rubbles` is an Exchange alias and aliases are not currently supported. Please use the group common name `The Rubbles` instead
  48.296 [id=13]	WARNING	h.p.a.ActiveDirectoryUnixAuthenticationProvider$4#call: Exhausted all configured domains and could not authenticate against any
  49.379 [id=13]	INFO	jenkins.model.Jenkins#cleanUp: Stopping Jenkins
  49.984 [id=13]	INFO	jenkins.model.Jenkins#cleanUp: Jenkins stopped
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.2 s - in hudson.plugins.active_directory.docker.TheFlintstonesTest

Line from /etc/hosts:

127.0.0.1 samdom.example.com

image

I have no idea why CI is failing.

@fbelzunc
Copy link
Contributor

I will try to get time to review this.

I just launched all the test on my local environment and all the tests are passing in the master branch. However, there is one failure in your PR

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running InjectedTest
[INFO] Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 12.448 s - in InjectedTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectoryAuthenticationProviderTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 s - in hudson.plugins.active_directory.ActiveDirectoryAuthenticationProviderTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectoryJCasCCompatibilityTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.279 s - in hudson.plugins.active_directory.ActiveDirectoryJCasCCompatibilityTest
[INFO] Running hudson.plugins.active_directory.ActiveDirectorySecurityRealmTest
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.468 s - in hudson.plugins.active_directory.ActiveDirectorySecurityRealmTest
[INFO] Running hudson.plugins.active_directory.RemoveIrrelevantGroupsTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.19 s - in hudson.plugins.active_directory.RemoveIrrelevantGroupsTest
[INFO] Running hudson.plugins.active_directory.WindowsAdsiModeUserCacheDisabledTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.005 s - in hudson.plugins.active_directory.WindowsAdsiModeUserCacheDisabledTest
[INFO] Running hudson.plugins.active_directory.WindowsAdsiModeUserCacheEnabledTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.004 s - in hudson.plugins.active_directory.WindowsAdsiModeUserCacheEnabledTest
[INFO] Running hudson.plugins.active_directory.docker.EntoEndUserCacheLookupDisabledTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.783 s - in hudson.plugins.active_directory.docker.EntoEndUserCacheLookupDisabledTest
[INFO] Running hudson.plugins.active_directory.docker.EntoEndUserCacheLookupEnabledTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.754 s - in hudson.plugins.active_directory.docker.EntoEndUserCacheLookupEnabledTest
[INFO] Running hudson.plugins.active_directory.docker.TheFlintstonesTest
[INFO] Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 343.771 s - in hudson.plugins.active_directory.docker.TheFlintstonesTest
[INFO]
[INFO] Results:
[INFO]
[WARNING] Tests run: 64, Failures: 0, Errors: 0, Skipped: 2
[INFO]
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.19:check (check) @ active-directory ---
[INFO] Resolved signature org.codehaus.mojo.signature:java18 version as 1.0 from dependencyManagement
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java18:1.0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  08:46 min
[INFO] Finished at: 2020-12-11T07:38:26+01:00
[INFO] ------------------------------------------------------------------------

@jvz
Copy link
Member Author

jvz commented Dec 11, 2020

I isolated the cause of the test failure by first removing my changes to custom.sh which made the test pass again. Changing the ordering of the commands in it didn't make the tests pass, but then I increased the log capture count which made it pass. If the tests are still failing for you, then that's beyond my knowledge here as it's specific to that test and not this PR. I didn't want to copy the test and create a brand new one just to avoid a flaky test.

@jvz
Copy link
Member Author

jvz commented Dec 15, 2020

@fbelzunc @jeffret-b I split out the new test and reverted my changes to the old test. Everything should be good to go now. Please review.

@jvz jvz closed this Dec 15, 2020
@jvz
Copy link
Member Author

jvz commented Dec 15, 2020

Re-triggering due to docker build timeout.

@jvz jvz reopened this Dec 15, 2020
@jvz jvz closed this Dec 15, 2020
@jvz
Copy link
Member Author

jvz commented Dec 15, 2020

Not sure why the test aborts before it's finished building the image, so this may take a few tries to get it to finish building.

@jvz jvz reopened this Dec 15, 2020
Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz
Copy link
Member Author

jvz commented Dec 15, 2020

@jeffret-b @fbelzunc tests passing now

Copy link

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. It makes some sense to pull these tests out. I haven't done any testing, but the code makes good sense -- clearer and more meaningful results.

@jvz
Copy link
Member Author

jvz commented Feb 16, 2021

So this PR is ready to merge. However, based on some bug reports we got related to the LDAP change matching this AD change, there seem to be a plugin or two that also needs updating to properly handle the exceptions thrown by this PR. I'll link back to those here, then you can safely merge this when those are merged.

@jvz
Copy link
Member Author

jvz commented Feb 16, 2021

jenkinsci/mailer-plugin#104 for one issue surfaced from the LDAP PR that would likewise apply to this PR.

@jvz
Copy link
Member Author

jvz commented Feb 16, 2021

And filed jenkinsci/email-ext-plugin#277 for the other related issue. Once those are both merged, this PR is good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants