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

fix: seed job warnings, updated latest lts and plugins #1018

Merged
merged 7 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/auto-codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
ignore_words_list: aks,ags,startin
skip: "*.js,package-lock.json,*.lock,*/Font-Awesome/*,*.toml,*.svg,*assets/vendor/bootstrap*,cert-manager.crds.yaml"
ignore_words_list: aks,ags,startin,NotIn
skip: "*.js,package-lock.json,*.lock,*/Font-Awesome/*,*.toml,*.svg,*assets/vendor/bootstrap*,cert-manager.crds.yaml,*/docs/*"
pre-commit:
name: PreCommit
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion chart/jenkins-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Kubernetes native operator which fully manages Jenkins on Kubernetes
| jenkins.enabled | bool | `true` | |
| jenkins.env | list | `[]` | |
| jenkins.hostAliases | object | `{}` | |
| jenkins.image | string | `"jenkins/jenkins:2.440.1-lts"` | |
| jenkins.image | string | `"jenkins/jenkins:2.452.1-lts"` | |
| jenkins.imagePullPolicy | string | `"Always"` | |
| jenkins.imagePullSecrets | list | `[]` | |
| jenkins.labels | object | `{}` | |
Expand Down
12 changes: 6 additions & 6 deletions chart/jenkins-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jenkins:
# image is the name (and tag) of the Jenkins instance
# Default: jenkins/jenkins:lts
# It's recommended to use LTS (tag: "lts") version
image: jenkins/jenkins:2.440.1-lts
image: jenkins/jenkins:2.452.1-lts

# env contains jenkins container environment variables
env: []
Expand Down Expand Up @@ -90,19 +90,19 @@ jenkins:
#
# basePlugins:
# - name: kubernetes
# version: 4186.v1d804571d5d4
# version: 4238.v41b_3ef14a_5d8
# - name: workflow-job
# version: 1385.vb_58b_86ea_fff1
# version: 1400.v7fd111b_ec82f
# - name: workflow-aggregator
# version: 596.v8c21c963d92d
# - name: git
# version: 5.2.1
# version: 5.2.2
# - name: job-dsl
# version: "1.87"
# - name: configuration-as-code
# version: 11775.v810dc950b_514
# version: 1810.v9b_c30a_249a_4c
# - name: kubernetes-credentials-provider
# version: 1.234.vf3013b_35f5b_a
# version: 1.262.v2670ef7ea_0c5

basePlugins: []

Expand Down
2 changes: 1 addition & 1 deletion config.base.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GO_VERSION="1.15.6"
HELM_VERSION="3.12.3"
IMAGE_PULL_MODE="local"
KIND_CLUSTER_NAME="jenkins"
LATEST_LTS_VERSION="2.440.1"
LATEST_LTS_VERSION="2.452.1"
NAME="kubernetes-operator"
NAMESPACE="default"
OPERATOR_SDK_VERSION="1.3.0"
Expand Down
12 changes: 3 additions & 9 deletions pkg/configuration/user/seedjobs/seedjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
AgentName = "seed-job-agent"

// DefaultAgentImage is the default image used for the seed-job agent
defaultAgentImage = "jenkins/inbound-agent:3206.vb_15dcf73f6a_9-3"
defaultAgentImage = "jenkins/inbound-agent:3248.v65ecb_254c298-4"

creatingGroovyScriptName = "seed-job-groovy-script.groovy"

Expand Down Expand Up @@ -409,10 +409,6 @@ func agentDeploymentName(jenkins v1alpha2.Jenkins, agentName string) string {
}

func agentDeployment(jenkins *v1alpha2.Jenkins, namespace string, agentName string, secret string, kubernetesDomainName string) (*appsv1.Deployment, error) {
jenkinsSlavesServiceFQDN, err := resources.GetJenkinsSlavesServiceFQDN(jenkins, kubernetesDomainName)
if err != nil {
return nil, err
}
jenkinsHTTPServiceFQDN, err := resources.GetJenkinsHTTPServiceFQDN(jenkins, kubernetesDomainName)
if err != nil {
return nil, err
Expand Down Expand Up @@ -455,10 +451,8 @@ func agentDeployment(jenkins *v1alpha2.Jenkins, namespace string, agentName stri
Image: agentImage,
Env: []corev1.EnvVar{
{
Name: "JENKINS_TUNNEL",
Value: fmt.Sprintf("%s:%d",
jenkinsSlavesServiceFQDN,
jenkins.Spec.SlaveService.Port),
Name: "JENKINS_WEB_SOCKET",
Value: "true",
},
{
Name: "JENKINS_SECRET",
Expand Down
4 changes: 3 additions & 1 deletion pkg/configuration/user/seedjobs/seedjobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func TestEnsureSeedJobs(t *testing.T) {
var agentDeployment appsv1.Deployment
err = fakeClient.Get(ctx, types.NamespacedName{Namespace: jenkins.Namespace, Name: agentDeploymentName(*jenkins, AgentName)}, &agentDeployment)
assert.NoError(t, err)
assert.Equal(t, "jenkins/inbound-agent:3206.vb_15dcf73f6a_9-3", agentDeployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, "jenkins/inbound-agent:3248.v65ecb_254c298-4", agentDeployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, "JENKINS_WEB_SOCKET", agentDeployment.Spec.Template.Spec.Containers[0].Env[0].Name)
assert.Equal(t, "true", agentDeployment.Spec.Template.Spec.Containers[0].Env[0].Value)
})

t.Run("delete agent deployment when no seed jobs", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const (
// SeedJobSuffix is a suffix added for all seed jobs
SeedJobSuffix = "job-dsl-seed"
// DefaultJenkinsMasterImage is the default Jenkins master docker image
DefaultJenkinsMasterImage = "jenkins/jenkins:2.440.1-lts"
DefaultJenkinsMasterImage = "jenkins/jenkins:2.452.1-lts"
// DefaultHTTPPortInt32 is the default Jenkins HTTP port
DefaultHTTPPortInt32 = int32(8080)
// DefaultSlavePortInt32 is the default Jenkins port for slaves
Expand Down
10 changes: 5 additions & 5 deletions pkg/plugins/base_plugins.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package plugins

const (
configurationAsCodePlugin = "configuration-as-code:1775.v810dc950b_514"
gitPlugin = "git:5.2.1"
configurationAsCodePlugin = "configuration-as-code:1810.v9b_c30a_249a_4c"
gitPlugin = "git:5.2.2"
jobDslPlugin = "job-dsl:1.87"
kubernetesPlugin = "kubernetes:4186.v1d804571d5d4"
kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.258.v95949f923a_a_e"
kubernetesPlugin = "kubernetes:4238.v41b_3ef14a_5d8"
kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.262.v2670ef7ea_0c5"
workflowAggregatorPlugin = "workflow-aggregator:596.v8c21c963d92d"
workflowJobPlugin = "workflow-job:1385.vb_58b_86ea_fff1"
workflowJobPlugin = "workflow-job:1400.v7fd111b_ec82f"
)

// basePluginsList contains plugins to install by operator.
Expand Down
38 changes: 31 additions & 7 deletions test/bats/1-deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ diag() {
--set namespace=${DETIK_CLIENT_NAMESPACE} \
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
--set jenkins.seedJobs[0].id=seed-job \
--set jenkins.seedJobs[0].targets="cicd/jobs/*.jenkins" \
--set jenkins.seedJobs[0].description="jobs-from-operator-repo" \
--set jenkins.seedJobs[0].repositoryBranch=master \
--set jenkins.seedJobs[0].repositoryUrl=https://github.com/jenkinsci/kubernetes-operator \
--set jenkins.seedJobs[0].buildPeriodically="10 * * * *" \
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
assert ${HELM} status default
Expand Down Expand Up @@ -118,23 +124,41 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.10 Helm: upgrade from main branch same values" {
@test "1.10 Helm: check Jenkins seed job status and logs" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run verify "there is 1 deployment named 'seed-job-agent-jenkins'"
assert_success

run verify "there is 1 pod named 'seed-job-agent-jenkins-'"
assert_success

run try "at most 20 times every 10s to get pods named 'seed-job-agent-jenkins-' and verify that '.status.containerStatuses[?(@.name==\"jnlp\")].ready' is 'true'"
assert_success

run ${KUBECTL} logs -l app=seed-job-agent-selector
assert_success
assert_output --partial 'INFO: Connected'

}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.11 Helm: upgrade from main branch same values" {
run echo ${DETIK_CLIENT_NAMESPACE}
run echo ${OPERATOR_IMAGE}
run ${HELM} upgrade default \
--set jenkins.namespace=${DETIK_CLIENT_NAMESPACE} \
--set namespace=${DETIK_CLIENT_NAMESPACE} \
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
chart/jenkins-operator
assert_success
assert ${HELM} status default
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.11 Helm: check Jenkins operator pods status again" {
@test "1.12 Helm: check Jenkins operator pods status again" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run verify "there is 1 deployment named 'default-jenkins-operator'"
assert_success
Expand All @@ -147,7 +171,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.12 Helm: check Jenkins operator pods status" {
@test "1.13 Helm: check Jenkins operator pods status" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run verify "there is 1 deployment named 'default-jenkins-operator'"
assert_success
Expand All @@ -160,7 +184,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.13 Helm: check Jenkins Pod status" {
@test "1.14 Helm: check Jenkins Pod status" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run try "at most 20 times every 10s to get pods named 'jenkins-jenkins' and verify that '.status.containerStatuses[?(@.name==\"jenkins-master\")].ready' is 'true'"
assert_success
Expand All @@ -170,7 +194,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.14 Helm: clean" {
@test "1.15 Helm: clean" {
run ${HELM} uninstall default
assert_success
# Wait for the complete removal
Expand Down
4 changes: 2 additions & 2 deletions test/bats/2-deploy-with-more-options.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ setup() {
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.nodeSelector.batstest=yep \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
Expand Down Expand Up @@ -101,7 +101,7 @@ setup() {
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.nodeSelector.batstest=yep \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
chart/jenkins-operator
assert_success
Expand Down
4 changes: 2 additions & 2 deletions test/bats/3-deploy-with-webhook.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ setup() {
--set namespace=${DETIK_CLIENT_NAMESPACE} \
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=true \
--set webhook.enabled=true \
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
Expand Down Expand Up @@ -86,7 +86,7 @@ setup() {
--set namespace=${DETIK_CLIENT_NAMESPACE} \
--set operator.image=${OPERATOR_IMAGE} \
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=true \
--set webhook.enabled=true \
chart/jenkins-operator
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
const e2e = "e2e"

var expectedBasePluginsList = []plugins.Plugin{
plugins.Must(plugins.New("configuration-as-code:1775.v810dc950b_514")),
plugins.Must(plugins.New("git:5.2.1")),
plugins.Must(plugins.New("kubernetes:4186.v1d804571d5d4")),
plugins.Must(plugins.New("kubernetes-credentials-provider:1.258.v95949f923a_a_e")),
plugins.Must(plugins.New("configuration-as-code:1810.v9b_c30a_249a_4c")),
plugins.Must(plugins.New("git:5.2.2")),
plugins.Must(plugins.New("kubernetes:4238.v41b_3ef14a_5d8")),
plugins.Must(plugins.New("kubernetes-credentials-provider:1.262.v2670ef7ea_0c5")),
plugins.Must(plugins.New("job-dsl:1.87")),
plugins.Must(plugins.New("workflow-aggregator:596.v8c21c963d92d")),
plugins.Must(plugins.New("workflow-job:1385.vb_58b_86ea_fff1")),
plugins.Must(plugins.New("workflow-job:1400.v7fd111b_ec82f")),
}

func createUserConfigurationSecret(namespace string, stringData map[string]string) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
)

const JenkinsTestImage = "jenkins/jenkins:2.440.1-lts"
const JenkinsTestImage = "jenkins/jenkins:2.452.1-lts"

var (
Cfg *rest.Config
Expand Down
2 changes: 1 addition & 1 deletion test/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.440.1-lts"),
"--set-string", fmt.Sprintf("jenkins.image=%s", "jenkins/jenkins:2.452.1-lts"),
"--set-string", fmt.Sprintf("operator.image=%s", *imageName), "--install")
output, err := cmd.CombinedOutput()
Expect(err).NotTo(HaveOccurred(), string(output))
Expand Down
Loading