Merge branch 'master' into go-1.22-fix-tests

This commit is contained in:
xmbhasin 2025-03-23 12:40:14 -04:00
commit 7a06e4175f
10 changed files with 34 additions and 49 deletions

View File

@ -1,40 +0,0 @@
name: CI Lint
on:
push:
branches:
- master
- main
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
jobs:
codespell:
name: Codespell
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
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/*,go.sum"
pre-commit:
name: PreCommit
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5.1.0
- uses: DeterminateSystems/nix-installer-action@v12
with:
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@v7
with:
diagnostic-endpoint: ""
- name: Checkout
uses: actions/checkout@v4
- id: files
uses: tj-actions/changed-files@v44
- name: nix checks
run: nix flake check
- name: nix pre-commit
run: nix develop . --command pre-commit run --files ${{ steps.files.outputs.all_changed_files }} --show-diff-on-failure

View File

@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/nix-installer-action@v13
with:
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@v7
@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/nix-installer-action@v13
with:
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@v7

View File

@ -14,7 +14,7 @@ type JenkinsSpec struct {
Master JenkinsMaster `json:"master"`
// SeedJobs defines list of Jenkins Seed Job configurations
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration#configure-seed-jobs-and-pipelines
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-seed-jobs-and-pipelines/
// +optional
SeedJobs []SeedJob `json:"seedJobs,omitempty"`
@ -46,12 +46,12 @@ type JenkinsSpec struct {
SlaveService Service `json:"slaveService,omitempty"`
// Backup defines configuration of Jenkins backup
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configure-backup-and-restore/
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/
// +optional
Backup Backup `json:"backup,omitempty"`
// Backup defines configuration of Jenkins backup restore
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configure-backup-and-restore/
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/
// +optional
Restore Restore `json:"restore,omitempty"`
@ -311,6 +311,7 @@ type JenkinsMaster struct {
// periodSeconds: 10
// successThreshold: 1
// timeoutSeconds: 5
// lifecycle: {}
// name: jenkins-master
// readinessProbe:
// failureThreshold: 3

View File

@ -134,6 +134,9 @@ spec:
{{- with .Values.jenkins.env }}
env: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jenkins.lifecycle}}
lifecycle: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.jenkins.volumeMounts }}
volumeMounts: {{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -44,6 +44,9 @@ jenkins:
# imagePullPolicy defines policy for pulling images
imagePullPolicy: Always
# lifecycle is used if you want to specify lifecycle hooks for the master container
lifecycle: {}
# priorityClassName indicates the importance of a Pod relative to other Pods
# See: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
priorityClassName: ""

View File

@ -390,6 +390,11 @@ func (r *JenkinsReconciler) setDefaults(jenkins *v1alpha2.Jenkins) (requeue bool
changed = true
jenkinsContainer.LivenessProbe = resources.NewProbe(containerProbeURI, containerProbePortName, corev1.URISchemeHTTP, 80, 5, 12)
}
if jenkinsContainer.Lifecycle == nil {
logger.Info("Setting default Jenkins lifecycle")
changed = true
jenkinsContainer.Lifecycle = &corev1.Lifecycle{}
}
if len(jenkinsContainer.Command) == 0 {
logger.Info("Setting default Jenkins container command")
changed = true

View File

@ -243,6 +243,7 @@ func NewJenkinsMasterContainer(jenkins *v1alpha2.Jenkins) corev1.Container {
Image: jenkinsContainer.Image,
ImagePullPolicy: jenkinsContainer.ImagePullPolicy,
Command: jenkinsContainer.Command,
Lifecycle: jenkinsContainer.Lifecycle,
LivenessProbe: jenkinsContainer.LivenessProbe,
ReadinessProbe: jenkinsContainer.ReadinessProbe,
Ports: []corev1.ContainerPort{

View File

@ -6,8 +6,8 @@ const (
jobDslPlugin = "job-dsl:1.89"
kubernetesPlugin = "kubernetes:4295.v7fa_01b_309c95"
kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.262.v2670ef7ea_0c5"
// Depends on workflow-job which should be automatically downloaded
workflowAggregatorPlugin = "workflow-aggregator:600.vb_57cdd26fdd7"
workflowAggregatorPlugin = "workflow-aggregator:600.vb_57cdd26fdd7"
workflowJobPlugin = "workflow-job:1436.vfa_244484591f"
)
// basePluginsList contains plugins to install by operator.
@ -18,6 +18,7 @@ var basePluginsList = []Plugin{
Must(New(kubernetesPlugin)),
Must(New(kubernetesCredentialsProviderPlugin)),
Must(New(workflowAggregatorPlugin)),
Must(New(workflowJobPlugin)),
}
// BasePlugins returns list of plugins to install by operator.

View File

@ -109,6 +109,7 @@ setup() {
--set jenkins.nodeSelector.batstest=yep \
--set jenkins.image="jenkins/jenkins:2.479.2-lts" \
--set jenkins.imagePullPolicy="IfNotPresent" \
--set jenkins.lifecycle.preStop.command='["echo bats test"]' \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
--set jenkins.backup.image=quay.io/jenkins-kubernetes-operator/backup-pvc:e2e-test \
chart/jenkins-operator --wait
@ -141,6 +142,15 @@ setup() {
assert_success
}
#bats test_tags=phase:helm,scenario:more-options
@test "2.5 Helm: check lifecycle" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run ${KUBECTL} get pod jenkins-jenkins -o jsonpath={.spec.containers[0].lifecycle.preStop.exec.command[0]}
assert_success
assert_output "echo 'bats test'"
}
#bats test_tags=phase:helm,scenario:more-options
@test "2.12 Helm: check node selector again" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"

View File

@ -31,8 +31,8 @@ const (
jobDslPlugin = "job-dsl:1.89"
kubernetesPlugin = "kubernetes:4295.v7fa_01b_309c95"
kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.262.v2670ef7ea_0c5"
// Depends on workflow-job which should be automatically downloaded
workflowAggregatorPlugin = "workflow-aggregator:600.vb_57cdd26fdd7"
workflowAggregatorPlugin = "workflow-aggregator:600.vb_57cdd26fdd7"
workflowJobPlugin = "workflow-job:1436.vfa_244484591f"
)
var expectedBasePluginsList = []plugins.Plugin{
@ -42,6 +42,7 @@ var expectedBasePluginsList = []plugins.Plugin{
plugins.Must(plugins.New(kubernetesPlugin)),
plugins.Must(plugins.New(kubernetesCredentialsProviderPlugin)),
plugins.Must(plugins.New(workflowAggregatorPlugin)),
plugins.Must(plugins.New(workflowJobPlugin)),
}
func createUserConfigurationSecret(namespace string, stringData map[string]string) {