diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java index 4ff103e..17d4eb7 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java @@ -1,7 +1,5 @@ package org.jenkinsci.plugins.kubernetes.cli; -import javax.annotation.Nonnull; - import com.cloudbees.plugins.credentials.CredentialsMatcher; import com.cloudbees.plugins.credentials.CredentialsMatchers; import com.cloudbees.plugins.credentials.common.StandardCertificateCredentials; @@ -9,7 +7,7 @@ import com.cloudbees.plugins.credentials.common.StandardListBoxModel; import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials; import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder; - +import edu.umd.cs.findbugs.annotations.NonNull; import org.jenkinsci.plugins.kubernetes.credentials.TokenProducer; import org.jenkinsci.plugins.plaincredentials.FileCredentials; import org.jenkinsci.plugins.plaincredentials.StringCredentials; @@ -31,7 +29,7 @@ public abstract class CredentialsLister { CredentialsMatchers.instanceOf(StandardCertificateCredentials.class), CredentialsMatchers.instanceOf(FileCredentials.class)); - public static ListBoxModel doFillCredentialsIdItems(@Nonnull @AncestorInPath Item item, + public static ListBoxModel doFillCredentialsIdItems(@NonNull @AncestorInPath Item item, @QueryParameter String serverUrl, @QueryParameter String credentialsId) { if (item == null ? !Jenkins.get().hasPermission(Jenkins.ADMINISTER) diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/GenericBuildStep.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/GenericBuildStep.java index 5c9db8e..08efab2 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/GenericBuildStep.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/GenericBuildStep.java @@ -4,15 +4,13 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - import org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter; import org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriterFactory; import org.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl; import org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback; import org.jenkinsci.plugins.workflow.steps.EnvironmentExpander; import org.jenkinsci.plugins.workflow.steps.StepContext; - +import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.FilePath; import hudson.model.TaskListener; @@ -78,7 +76,7 @@ public boolean start() throws Exception { * {@inheritDoc} */ @Override - public void stop(@Nonnull Throwable cause) throws Exception { + public void stop(@NonNull Throwable cause) throws Exception { getContext().onFailure(cause); } diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStep.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStep.java index 1a8ba94..246136c 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStep.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStep.java @@ -5,8 +5,6 @@ import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; - import org.jenkinsci.plugins.workflow.steps.Step; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.StepDescriptor; @@ -15,7 +13,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; - +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.Item; import hudson.util.ListBoxModel; @@ -97,7 +95,7 @@ public Set> getRequiredContext() { return new HashSet<>(); } - public ListBoxModel doFillCredentialsIdItems(@Nonnull @AncestorInPath Item item, + public ListBoxModel doFillCredentialsIdItems(@NonNull @AncestorInPath Item item, @QueryParameter String serverUrl, @QueryParameter String credentialsId) { return CredentialsLister.doFillCredentialsIdItems(item, serverUrl, credentialsId); } diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapper.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapper.java index c9e4531..399e3ec 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapper.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapper.java @@ -4,13 +4,11 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; - +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.EnvVars; import hudson.Extension; import hudson.FilePath; @@ -87,7 +85,7 @@ public String getDisplayName() { return "Configure Kubernetes CLI (kubectl) (deprecated, use the multi credentials one instead)"; } - public ListBoxModel doFillCredentialsIdItems(@Nonnull @AncestorInPath Item item, + public ListBoxModel doFillCredentialsIdItems(@NonNull @AncestorInPath Item item, @QueryParameter String serverUrl, @QueryParameter String credentialsId) { return CredentialsLister.doFillCredentialsIdItems(item, serverUrl, credentialsId); } diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlCredential.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlCredential.java index 022e024..7f92530 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlCredential.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/KubectlCredential.java @@ -1,12 +1,10 @@ package org.jenkinsci.plugins.kubernetes.cli; -import javax.annotation.Nonnull; - import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; - +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.AbstractDescribableImpl; import hudson.model.Descriptor; @@ -47,7 +45,7 @@ public String getDisplayName() { return ""; } - public ListBoxModel doFillCredentialsIdItems(@Nonnull @AncestorInPath Item item, + public ListBoxModel doFillCredentialsIdItems(@NonNull @AncestorInPath Item item, @QueryParameter String serverUrl, @QueryParameter String credentialsId) { return CredentialsLister.doFillCredentialsIdItems(item, serverUrl, credentialsId); } diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java index 106ee0d..d9659c6 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java @@ -5,11 +5,9 @@ import java.nio.charset.StandardCharsets; import java.util.Collections; -import javax.annotation.Nonnull; - import com.cloudbees.plugins.credentials.CredentialsProvider; import com.cloudbees.plugins.credentials.common.StandardCredentials; - +import edu.umd.cs.findbugs.annotations.NonNull; import org.jenkinsci.plugins.kubernetes.auth.KubernetesAuth; import org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthConfig; import org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthException; @@ -47,7 +45,7 @@ public class KubeConfigWriter { private final Launcher launcher; private final Run build; - public KubeConfigWriter(@Nonnull String serverUrl, String credentialsId, + public KubeConfigWriter(@NonNull String serverUrl, String credentialsId, String caCertificate, String clusterName, String contextName, String namespace, Boolean restrictKubeConfigAccess, FilePath workspace, Launcher launcher, Run build) { this.serverUrl = serverUrl; diff --git a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterFactory.java b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterFactory.java index 9e20e9a..0f0ea0b 100644 --- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterFactory.java +++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterFactory.java @@ -2,10 +2,8 @@ import java.io.IOException; -import javax.annotation.Nonnull; - import org.jenkinsci.plugins.workflow.steps.StepContext; - +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.FilePath; import hudson.Launcher; import hudson.model.Run; @@ -14,14 +12,14 @@ * @author Max Laverse */ public abstract class KubeConfigWriterFactory { - public static KubeConfigWriter get(@Nonnull String serverUrl, @Nonnull String credentialsId, + public static KubeConfigWriter get(@NonNull String serverUrl, @NonNull String credentialsId, String caCertificate, String clusterName, String contextName, String namespace, Boolean restrictKubeConfigAccess, FilePath workspace, Launcher launcher, Run build) { return new KubeConfigWriter(serverUrl, credentialsId, caCertificate, clusterName, contextName, namespace, restrictKubeConfigAccess, workspace, launcher, build); } - public static KubeConfigWriter get(@Nonnull String serverUrl, @Nonnull String credentialsId, + public static KubeConfigWriter get(@NonNull String serverUrl, @NonNull String credentialsId, String caCertificate, String clusterName, String contextName, String namespace, Boolean restrictKubeConfigAccess, StepContext context) throws IOException, InterruptedException { Run run = context.get(Run.class);