mirror of
https://github.com/jenkinsci/kubernetes-operator.git
synced 2026-10-18 14:01:04 +02:00
fix(operator): Attempt to fix all the major issues present atm against the newest jenkins lts version (#784)
* fix(seed): fix #742, workaround #698 Original fix proposal: https://github.com/jenkinsci/kubernetes-operator/issues/742#issuecomment-1304398590 * fix(install-plugin.sh): fix #758, #739 * the fix was original attempted here: https://github.com/jenkinsci/kubernetes-operator/pull/764 but was not working correctly due to 2-3 additional changes which needed to be done * removed the openshift check because the env is not mention anywhere and also the new jenkins-plugin-cli does not a specific command for openshift. Finally this does not make any sense in general, the only problem in ocp will be the user id that will be mapped to a random uid but that's another story. The command to install the plugins should remain the same across different k8s flavours. * fix(doc/test): fix /usr/bin/tini in any doc and validation * fix(jenkins): remove AdminWhitelistRule to avoid jvm stack trace, see: https://www.jenkins.io/doc/book/security/controller-isolation/jep-235/#api-compatibility * fix(seed): fix seed img built on a previous jvm, fix #761 * fix(plugin): update the base plugin to work with the newest version of jenkins:lts * fix(run): fix #778 * fix(backup): add a trap to remove the tmp dir if the tar fail, also fix: #770 * test(chart): update chart values for testing, will revert before merge * fix(configmap): leftover * fix(tests): fix seed job test * fix(e2e) * fix(e2e): helm * fix(operator): update the temporary img to reflect latests changes * Fix Helm e2e tests * add trap in case of unwanted exit and make shellcheck happy * chore(plugin): update git ver to 5.0.0 * fix(backup): always force delete the backup directory * chore(operator): update the temporary img to reflect latest changes * chore(jenkins): upgrade jenkins latest lts
This commit is contained in:
@@ -24,13 +24,13 @@ import (
|
||||
const e2e = "e2e"
|
||||
|
||||
var expectedBasePluginsList = []plugins.Plugin{
|
||||
plugins.Must(plugins.New("configuration-as-code:1346.ve8cfa_3473c94")),
|
||||
plugins.Must(plugins.New("git:4.11.3")),
|
||||
plugins.Must(plugins.New("kubernetes:1.31.3")),
|
||||
plugins.Must(plugins.New("kubernetes-credentials-provider:0.20")),
|
||||
plugins.Must(plugins.New("job-dsl:1.78.1")),
|
||||
plugins.Must(plugins.New("workflow-aggregator:2.6")),
|
||||
plugins.Must(plugins.New("workflow-job:1145.v7f2433caa07f")),
|
||||
plugins.Must(plugins.New("configuration-as-code:1569.vb_72405b_80249")),
|
||||
plugins.Must(plugins.New("git:5.0.0")),
|
||||
plugins.Must(plugins.New("kubernetes:3802.vb_b_600831fcb_3")),
|
||||
plugins.Must(plugins.New("kubernetes-credentials-provider:1.208.v128ee9800c04")),
|
||||
plugins.Must(plugins.New("job-dsl:1.81")),
|
||||
plugins.Must(plugins.New("workflow-aggregator:590.v6a_d052e5a_a_b_5")),
|
||||
plugins.Must(plugins.New("workflow-job:1254.v3f64639b_11dd")),
|
||||
}
|
||||
|
||||
func createUserConfigurationSecret(namespace string, stringData map[string]string) {
|
||||
|
||||
@@ -125,10 +125,10 @@ func createJenkinsCRSafeRestart(name, namespace string, seedJob *[]v1alpha2.Seed
|
||||
},
|
||||
},
|
||||
Plugins: []v1alpha2.Plugin{
|
||||
{Name: "audit-trail", Version: "3.7"},
|
||||
{Name: "simple-theme-plugin", Version: "0.6"},
|
||||
{Name: "github", Version: "1.32.0"},
|
||||
{Name: "devoptics", Version: "1.1934", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1934/devoptics.hpi"},
|
||||
{Name: "audit-trail", Version: "3.11"},
|
||||
{Name: "simple-theme-plugin", Version: "136.v23a_15f86c53d"},
|
||||
{Name: "github", Version: "1.36.0"},
|
||||
{Name: "devoptics", Version: "1.1973", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1973/devoptics.hpi"},
|
||||
},
|
||||
PriorityClassName: priorityClassName,
|
||||
NodeSelector: map[string]string{"kubernetes.io/os": "linux"},
|
||||
|
||||
@@ -21,7 +21,7 @@ func configureAuthorizationToUnSecure(namespace, configMapName string) {
|
||||
Namespace: namespace,
|
||||
},
|
||||
Data: map[string]string{
|
||||
"set-unsecured-authorization.groovy": `
|
||||
"8-set-unsecured-authorization.groovy": `
|
||||
import hudson.security.*
|
||||
|
||||
def jenkins = jenkins.model.Jenkins.getInstance()
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest"
|
||||
)
|
||||
|
||||
const JenkinsTestImage = "jenkins/jenkins:2.319.3-lts"
|
||||
const JenkinsTestImage = "jenkins/jenkins:2.375.2-lts"
|
||||
|
||||
var (
|
||||
Cfg *rest.Config
|
||||
@@ -147,10 +147,10 @@ func RenderJenkinsCR(name, namespace string, seedJob *[]v1alpha2.SeedJob, groovy
|
||||
},
|
||||
},
|
||||
Plugins: []v1alpha2.Plugin{
|
||||
{Name: "audit-trail", Version: "3.10"},
|
||||
{Name: "simple-theme-plugin", Version: "0.7"},
|
||||
{Name: "github", Version: "1.34.1"},
|
||||
{Name: "devoptics", Version: "1.1934", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1934/devoptics.hpi"},
|
||||
{Name: "audit-trail", Version: "3.11"},
|
||||
{Name: "simple-theme-plugin", Version: "136.v23a_15f86c53d"},
|
||||
{Name: "github", Version: "1.36.0"},
|
||||
{Name: "devoptics", Version: "1.1973", DownloadURL: "https://jenkins-updates.cloudbees.com/download/plugins/devoptics/1.1973/devoptics.hpi"},
|
||||
},
|
||||
PriorityClassName: priorityClassName,
|
||||
NodeSelector: map[string]string{"kubernetes.io/os": "linux"},
|
||||
|
||||
+1
-1
@@ -93,5 +93,5 @@ func waitForJenkinsSafeRestart(jenkinsClient jenkinsclient.Jenkins) {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}, time.Second*200, time.Second*5).Should(gomega.BeTrue())
|
||||
}, time.Duration(170)*retryInterval, retryInterval).Should(gomega.BeTrue())
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ var _ = Describe("Jenkins Controller", func() {
|
||||
|
||||
cmd := exec.Command("../../bin/helm", "upgrade", "jenkins", "../../chart/jenkins-operator", "--namespace", namespace.Name, "--debug",
|
||||
"--set-string", fmt.Sprintf("jenkins.namespace=%s", namespace.Name),
|
||||
"--set-string", fmt.Sprintf("jenkins.image=%s", "jenkins/jenkins:2.319.3-lts"),
|
||||
"--set-string", fmt.Sprintf("jenkins.image=%s", "jenkins/jenkins:2.375.2-lts"),
|
||||
"--set-string", fmt.Sprintf("operator.image=%s", *imageName), "--install")
|
||||
output, err := cmd.CombinedOutput()
|
||||
Expect(err).NotTo(HaveOccurred(), string(output))
|
||||
@@ -75,15 +75,15 @@ var _ = Describe("Jenkins Controller with security validator", func() {
|
||||
},
|
||||
}
|
||||
invalidPlugins = []v1alpha2.Plugin{
|
||||
{Name: "simple-theme-plugin", Version: "0.6"},
|
||||
{Name: "audit-trail", Version: "3.5"},
|
||||
{Name: "github", Version: "1.29.0"},
|
||||
}
|
||||
validPlugins = []v1alpha2.Plugin{
|
||||
{Name: "simple-theme-plugin", Version: "0.6"},
|
||||
{Name: "audit-trail", Version: "3.8"},
|
||||
{Name: "github", Version: "1.31.0"},
|
||||
}
|
||||
validPlugins = []v1alpha2.Plugin{
|
||||
{Name: "simple-theme-plugin", Version: "136.v23a_15f86c53d"},
|
||||
{Name: "audit-trail", Version: "3.11"},
|
||||
{Name: "github", Version: "1.36.0"},
|
||||
}
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
@@ -117,7 +117,7 @@ var _ = Describe("Jenkins Controller with security validator", func() {
|
||||
jenkins := e2e.RenderJenkinsCR(jenkinsCRName, namespace.Name, seedJobs, groovyScripts, casc, "")
|
||||
jenkins.Spec.Master.Plugins = invalidPlugins
|
||||
jenkins.Spec.ValidateSecurityWarnings = true
|
||||
Expect(e2e.K8sClient.Create(context.TODO(), jenkins)).Should(MatchError("admission webhook \"vjenkins.kb.io\" denied the request: security vulnerabilities detected in the following user-defined plugins: \naudit-trail:3.5\ngithub:1.29.0"))
|
||||
Expect(e2e.K8sClient.Create(context.TODO(), jenkins)).Should(MatchError("admission webhook \"vjenkins.kb.io\" denied the request: security vulnerabilities detected in the following user-defined plugins: \ngithub:1.31.0"))
|
||||
})
|
||||
})
|
||||
Context("When Jenkins CR doesn't contain plugins with security warnings", func() {
|
||||
|
||||
Reference in New Issue
Block a user