From ad1faa33ffcec69c6697f82060bb9d927dd03576 Mon Sep 17 00:00:00 2001
From: ferndem <39851927+ferndem@users.noreply.github.com>
Date: Sat, 17 Feb 2024 10:40:26 +0100
Subject: [PATCH 1/2] update snakeyml
update library snakyml for plugin problem
---
pom.xml | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3d767eb..923e5bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,15 +20,13 @@
1.0.0
- 2.401.1
+ 2.401.3
bom-2.401.x
- 2357.v1043f8578392
+ 2555.v3190a_8a_c60c6
2.3.0
- 1.4.0
- 0.11
-
+
4.3.0
@@ -102,7 +100,6 @@
org.jenkinsci.plugins
kubernetes-credentials
- ${jenkins-kubernetes-credentials.version}
org.jenkins-ci.plugins
@@ -136,7 +133,6 @@
org.jenkinsci.plugins
pipeline-model-definition
- ${jenkins-declarative.version}
test
@@ -163,13 +159,11 @@
org.jenkins-ci.plugins
docker-commons
- 439.va_3cb_0a_6a_fb_29
test
org.jenkins-ci.plugins
matrix-auth
- 2.6.6
test
From a24e3e5579ab2345e16c0a6dc911478d049ffe9b Mon Sep 17 00:00:00 2001
From: Fernando De Mennato
Date: Sat, 17 Feb 2024 13:24:15 +0100
Subject: [PATCH 2/2] replace deprecate method
---
pom.xml | 1 -
.../plugins/kubernetes/cli/CredentialsLister.java | 2 +-
.../plugins/kubernetes/cli/KubectlBuildStepTest.java | 4 ++--
.../plugins/kubernetes/cli/KubectlBuildWrapperTest.java | 6 ++++--
.../plugins/kubernetes/cli/helpers/DummyCredentials.java | 4 ++--
.../kubernetes/cli/helpers/DummyTokenCredentialImpl.java | 7 ++++++-
.../kubernetes/cli/helpers/UnsupportedCredentialImpl.java | 7 ++++++-
.../cli/kubeconfig/KubeConfigWriterAuthTest.java | 2 +-
.../cli/kubeconfig/KubeConfigWriterBuilderTest.java | 2 +-
9 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index 923e5bd..67b9aa2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,6 @@
Kubernetes CLI Plugin
https://github.com/jenkinsci/kubernetes-cli-plugin
- org.jenkins-ci.plugins
kubernetes-cli
${revision}${changelist}
hpi
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 8a8c6cb..4ff103e 100644
--- a/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java
+++ b/src/main/java/org/jenkinsci/plugins/kubernetes/cli/CredentialsLister.java
@@ -41,7 +41,7 @@ public static ListBoxModel doFillCredentialsIdItems(@Nonnull @AncestorInPath Ite
return new StandardListBoxModel()
.includeEmptyValue()
.includeMatchingAs(
- ACL.SYSTEM,
+ ACL.SYSTEM2,
item,
StandardCredentials.class,
URIRequirementBuilder.fromUri(serverUrl).build(),
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStepTest.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStepTest.java
index c35ae61..065926f 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStepTest.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildStepTest.java
@@ -151,8 +151,8 @@ public void testEnvVariableFormat() throws Exception {
assertBuildStatus(b, Result.SUCCESS);
String regExp = "Using temporary file '(.+).kube(.+)config'";
Pattern kubeConfigPathRegexp = Pattern.compile(regExp);
- assertTrue("No line in the logs matched the regular expression '" + regExp + "': " + r.getLog(b),
- kubeConfigPathRegexp.matcher(r.getLog(b)).find());
+ assertTrue("No line in the logs matched the regular expression '" + regExp + "': " + JenkinsRule.getLog(b),
+ kubeConfigPathRegexp.matcher(JenkinsRule.getLog(b)).find());
}
private void assertBuildStatus(WorkflowRun b, Result result) throws Exception {
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapperTest.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapperTest.java
index a8f93f2..e2799df 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapperTest.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/KubectlBuildWrapperTest.java
@@ -10,6 +10,8 @@
import org.jenkinsci.plugins.envinject.EnvInjectBuildWrapper;
import org.jenkinsci.plugins.envinject.EnvInjectJobPropertyInfo;
import org.jenkinsci.plugins.kubernetes.cli.helpers.DummyCredentials;
+import org.jenkinsci.plugins.matrixauth.AuthorizationType;
+import org.jenkinsci.plugins.matrixauth.PermissionEntry;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
@@ -140,10 +142,10 @@ public void testListingCredentialsWithoutAncestorAndMissingPermissions() throws
r.jenkins.setSecurityRealm(r.createDummySecurityRealm());
ProjectMatrixAuthorizationStrategy as = new ProjectMatrixAuthorizationStrategy();
- as.add(Jenkins.READ, "user-not-enough-permissions");
+ as.add(Jenkins.READ, new PermissionEntry(AuthorizationType.EITHER, "user-not-enough-permissions"));
r.jenkins.setAuthorizationStrategy(as);
- try (ACLContext unused = ACL.as(User.get("user-not-enough-permissions", true, null).impersonate())) {
+ try (ACLContext unused = ACL.as2(User.get("user-not-enough-permissions", true, null).impersonate2())) {
ListBoxModel options = d.doFillCredentialsIdItems(null, "", "1");
assertEquals("- current -", options.get(0).name);
assertEquals(1, options.size());
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyCredentials.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyCredentials.java
index 1a4d527..a88f239 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyCredentials.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyCredentials.java
@@ -30,7 +30,7 @@ public static BaseStandardCredentials secretCredential(String credentialId) {
public static BaseStandardCredentials certificateCredential(String credentialId) {
byte[] storeFile = TestResourceLoader.loadAsByteArray("kubernetes.pkcs12");
- CertificateCredentialsImpl.KeyStoreSource keyStoreSource = new CertificateCredentialsImpl.UploadedKeyStoreSource(
+ CertificateCredentialsImpl.KeyStoreSource keyStoreSource = new CertificateCredentialsImpl.UploadedKeyStoreSource(null,
SecretBytes.fromBytes(storeFile));
return new CertificateCredentialsImpl(CredentialsScope.GLOBAL, credentialId, "sample", PASSPHRASE,
keyStoreSource);
@@ -38,7 +38,7 @@ public static BaseStandardCredentials certificateCredential(String credentialId)
public static BaseStandardCredentials brokenCertificateCredential(String credentialId) {
byte[] storeFile = TestResourceLoader.loadAsByteArray("kubernetes.pkcs12");
- CertificateCredentialsImpl.KeyStoreSource keyStoreSource = new CertificateCredentialsImpl.UploadedKeyStoreSource(
+ CertificateCredentialsImpl.KeyStoreSource keyStoreSource = new CertificateCredentialsImpl.UploadedKeyStoreSource(null,
SecretBytes.fromBytes(storeFile));
return new CertificateCredentialsImpl(CredentialsScope.GLOBAL, credentialId, "sample", "bad-passphrase",
keyStoreSource);
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyTokenCredentialImpl.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyTokenCredentialImpl.java
index 7be07d2..bd21a2f 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyTokenCredentialImpl.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/DummyTokenCredentialImpl.java
@@ -7,7 +7,12 @@
public class DummyTokenCredentialImpl extends UsernamePasswordCredentialsImpl implements TokenProducer {
- public DummyTokenCredentialImpl(CredentialsScope scope, String id, String description, String username,
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public DummyTokenCredentialImpl(CredentialsScope scope, String id, String description, String username,
String password) {
super(scope, id, description, username, password);
}
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/UnsupportedCredentialImpl.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/UnsupportedCredentialImpl.java
index 0b63821..9e61c0b 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/UnsupportedCredentialImpl.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/helpers/UnsupportedCredentialImpl.java
@@ -4,7 +4,12 @@
public class UnsupportedCredentialImpl extends BaseStandardCredentials {
- public UnsupportedCredentialImpl(String id, String description) {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public UnsupportedCredentialImpl(String id, String description) {
super(id, description);
}
}
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterAuthTest.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterAuthTest.java
index 171871a..72dd0bd 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterAuthTest.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterAuthTest.java
@@ -36,7 +36,7 @@ public class KubeConfigWriterAuthTest {
FilePath workspace;
Launcher mockLauncher;
- AbstractBuild build;
+ AbstractBuild, ?> build;
private static String dumpBuilder(ConfigBuilder configBuilder) throws JsonProcessingException {
return Serialization.asYaml(configBuilder.build());
diff --git a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterBuilderTest.java b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterBuilderTest.java
index ea3a779..1b1f745 100644
--- a/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterBuilderTest.java
+++ b/src/test/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriterBuilderTest.java
@@ -34,7 +34,7 @@ public class KubeConfigWriterBuilderTest {
public TemporaryFolder tempFolder = new TemporaryFolder();
FilePath workspace;
Launcher mockLauncher;
- AbstractBuild build;
+ AbstractBuild, ?> build;
private static String dumpBuilder(ConfigBuilder configBuilder) throws JsonProcessingException {
return Serialization.asYaml(configBuilder.build());