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

Adapt to jenkinsci/artifact-manager-s3-plugin#567 #733

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
}