Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Nov 29, 2024
1 parent e8b39a1 commit d2f0e41
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.jenkins.tools.test.hook;

import edu.umd.cs.findbugs.annotations.NonNull;
import org.jenkins.tools.test.model.hook.BeforeExecutionContext;
import org.jenkins.tools.test.model.hook.PluginCompatTesterHookBeforeExecution;
import org.kohsuke.MetaInfServices;

/**
* Workaround for the fact that Artifact Manager on S3 has a dependency (jclouds) which uses a newer version of
* Guice than Jenkins core. In this case, we intentionally violate upper bounds checks to maintain compatibility with
* core. This works because the version of Guice shipped by core (6.0.0) supports both javax and jakarta imports, while
* the version of Guice required by jclouds (7.0.0) supports only jakarta imports. In other words, the compatibility
* matrix of the older version is a superset of the compatibility matrix of the newer version.
*/
@MetaInfServices(PluginCompatTesterHookBeforeExecution.class)
public class ArtifactManagerS3Hook extends PluginCompatTesterHookBeforeExecution {
@Override
public boolean check(@NonNull BeforeExecutionContext context) {
return context.getPlugin().getPluginId().equals("artifact-manager-s3");
}

@Override
public void action(@NonNull BeforeExecutionContext context) {
context.getUpperBoundsExcludes().add("com.google.inject.extensions:guice-assistedinject");
context.getUpperBoundsExcludes().add("com.google.inject:guice");
context.getUpperBoundsExcludes().add("com.google.inject:guice:classes");
}

Check warning on line 27 in src/main/java/org/jenkins/tools/test/hook/ArtifactManagerS3Hook.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 24-27 are not covered by tests
}

0 comments on commit d2f0e41

Please sign in to comment.