Skip to content

Commit c29bb17

Browse files
Merge pull request #113 from marklogic/release/1.1.0
MLE-24161: Releasing MarkLogic Kubernetes Operator 1.1.0
2 parents 53bbed4 + 1b60e8f commit c29bb17

File tree

106 files changed

+3191
-19865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3191
-19865
lines changed

.github/workflows/pr-workflow.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 🏷️ JIRA ID Validator
2+
3+
on:
4+
# Using pull_request_target instead of pull_request to handle PRs from forks
5+
pull_request_target:
6+
types: [opened, edited, reopened, synchronize]
7+
# No branch filtering - will run on all PRs
8+
9+
jobs:
10+
jira-pr-check:
11+
name: 🏷️ Validate JIRA ticket ID
12+
# Use the reusable workflow from the central repository
13+
uses: marklogic/pr-workflows/.github/workflows/jira-id-check.yml@main
14+
with:
15+
# Pass the PR title from the event context
16+
pr-title: ${{ github.event.pull_request.title }}

.golangci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@ issues:
1616
linters:
1717
- dupl
1818
- lll
19+
- path: "test/*"
20+
linters:
21+
- dupl
22+
- errcheck
23+
- goconst
24+
- gocyclo
25+
- lll
26+
- unused
27+
- path: "pkg/*"
28+
linters:
29+
- lll
30+
- unparam
1931
linters:
2032
disable-all: true
2133
enable:
22-
- dupl
2334
- errcheck
24-
- exportloopref
25-
- goconst
26-
- gocyclo
2735
- gofmt
2836
- goimports
2937
- gosimple
3038
- govet
3139
- ineffassign
32-
- lll
33-
- misspell
34-
- nakedret
35-
- prealloc
3640
- staticcheck
3741
- typecheck
3842
- unconvert
39-
- unparam
4043
- unused

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# Copyright (c) 2024-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+
13
# Build the manager binary
2-
FROM golang:1.23.6 AS builder
4+
FROM golang:1.24.9 AS builder
35
ARG TARGETOS
46
ARG TARGETARCH
57

Jenkinsfile

Lines changed: 98 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+
13
/* groovylint-disable CompileStatic, LineLength, VariableTypeRequired */
24
// This Jenkinsfile defines internal MarkLogic build pipeline.
35

@@ -6,10 +8,14 @@
68
import groovy.json.JsonSlurperClassic
79

810
emailList = 'vitaly.korolev@progress.com, sumanth.ravipati@progress.com, peng.zhou@progress.com, barkha.choithani@progress.com, romain.winieski@progress.com'
9-
emailSecList = 'Rangan.Doreswamy@progress.com, Mahalakshmi.Srinivasan@progress.com'
11+
emailSecList = 'Mahalakshmi.Srinivasan@progress.com'
1012
gitCredID = 'marklogic-builder-github'
13+
operatorRegistry = 'ml-marklogic-operator-dev.bed-artifactory.bedford.progress.com'
1114
JIRA_ID = ''
1215
JIRA_ID_PATTERN = /(?i)(MLE)-\d{3,6}/
16+
operatorRepo = 'marklogic-kubernetes-operator'
17+
timeStamp = new Date().format('yyyyMMdd')
18+
branchNameTag = env.BRANCH_NAME.replaceAll('/', '-')
1319

1420
// Define local funtions
1521
void preBuildCheck() {
@@ -35,6 +41,7 @@ void preBuildCheck() {
3541
}
3642

3743
// our VMs sometimes disable bridge traffic. this should help to restore it.
44+
sh 'sudo modprobe br_netfilter'
3845
sh 'sudo sh -c "echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables"'
3946
}
4047

@@ -92,7 +99,7 @@ def getReviewState() {
9299
return reviewState
93100
}
94101

95-
void resultNotification(message) {
102+
void resultNotification(status) {
96103
def author, authorEmail, emailList
97104
//add author of a PR to email list if available
98105
if (env.CHANGE_AUTHOR) {
@@ -107,11 +114,11 @@ void resultNotification(message) {
107114
jira_email_body = "${email_body} <br><br><b>Jira URL: </b><br><a href='${jira_link}'>${jira_link}</a>"
108115

109116
if (JIRA_ID) {
110-
def comment = [ body: "Jenkins pipeline build result: ${message}" ]
117+
def comment = [ body: "Jenkins pipeline build result: ${status}" ]
111118
jiraAddComment site: 'JIRA', idOrKey: JIRA_ID, failOnError: false, input: comment
112-
mail charset: 'UTF-8', mimeType: 'text/html', to: "${emailList}", body: "${jira_email_body}", subject: "${message}: ${env.JOB_NAME} #${env.BUILD_NUMBER} - ${JIRA_ID}"
119+
mail charset: 'UTF-8', mimeType: 'text/html', to: "${emailList}", body: "${jira_email_body}", subject: "🥷 ${status}: ${env.JOB_NAME} #${env.BUILD_NUMBER} - ${JIRA_ID}"
113120
} else {
114-
mail charset: 'UTF-8', mimeType: 'text/html', to: "${emailList}", body: "${email_body}", subject: "${message}: ${env.JOB_NAME} #${env.BUILD_NUMBER}"
121+
mail charset: 'UTF-8', mimeType: 'text/html', to: "${emailList}", body: "${email_body}", subject: "🥷 ${status}: ${env.JOB_NAME} #${env.BUILD_NUMBER}"
115122
}
116123
}
117124

@@ -125,15 +132,15 @@ void runTests() {
125132
}
126133

127134
void runMinikubeSetup() {
128-
sh '''
129-
make e2e-setup-minikube
130-
'''
135+
sh """
136+
make e2e-setup-minikube IMG=${operatorRepo}:${VERSION}
137+
"""
131138
}
132139

133140
void runE2eTests() {
134-
sh '''
135-
make e2e-test
136-
'''
141+
sh """
142+
make e2e-test IMG=${operatorRepo}:${VERSION}
143+
"""
137144
}
138145

139146
void runMinikubeCleanup() {
@@ -142,6 +149,43 @@ void runMinikubeCleanup() {
142149
'''
143150
}
144151

152+
void runBlackDuckScan() {
153+
// Trigger BlackDuck scan job with CONTAINER_IMAGES parameter when params.PUBLISH_IMAGE is true
154+
if (params.PUBLISH_IMAGE) {
155+
build job: 'securityscans/Blackduck/KubeNinjas/kubernetes-operator', wait: false, parameters: [ string(name: 'branch', value: "${env.BRANCH_NAME}"), string(name: 'CONTAINER_IMAGES', value: "${operatorRegistry}/${operatorRepo}:${VERSION}-${branchNameTag}-${timeStamp}") ]
156+
} else {
157+
build job: 'securityscans/Blackduck/KubeNinjas/kubernetes-operator', wait: false, parameters: [ string(name: 'branch', value: "${env.BRANCH_NAME}") ]
158+
}
159+
}
160+
161+
/**
162+
* Publishes the built Docker image to the internal Artifactory registry.
163+
* Tags the image with multiple tags (version-specific, branch-specific, latest).
164+
* Requires Artifactory credentials.
165+
*/
166+
void publishToInternalRegistry() {
167+
withCredentials([usernamePassword(credentialsId: 'builder-credentials-artifactory', passwordVariable: 'docker_password', usernameVariable: 'docker_user')]) {
168+
169+
sh """
170+
# make sure to logout first to avoid issues with cached credentials
171+
docker logout ${operatorRegistry}
172+
echo "${docker_password}" | docker login --username ${docker_user} --password-stdin ${operatorRegistry}
173+
174+
# Create tags
175+
docker tag ${operatorRepo}:${VERSION} ${operatorRegistry}/${operatorRepo}:${VERSION}
176+
docker tag ${operatorRepo}:${VERSION} ${operatorRegistry}/${operatorRepo}:${VERSION}-${branchNameTag}
177+
docker tag ${operatorRepo}:${VERSION} ${operatorRegistry}/${operatorRepo}:${VERSION}-${branchNameTag}-${timeStamp}
178+
docker tag ${operatorRepo}:${VERSION} ${operatorRegistry}/${operatorRepo}:latest
179+
180+
# Push images to internal registry
181+
docker push ${operatorRegistry}/${operatorRepo}:${VERSION}
182+
docker push ${operatorRegistry}/${operatorRepo}:${VERSION}-${branchNameTag}
183+
docker push ${operatorRegistry}/${operatorRepo}:${VERSION}-${branchNameTag}-${timeStamp}
184+
docker push ${operatorRegistry}/${operatorRepo}:latest
185+
"""
186+
}
187+
}
188+
145189
pipeline {
146190
agent {
147191
label {
@@ -153,15 +197,25 @@ pipeline {
153197
buildDiscarder logRotator(artifactDaysToKeepStr: '20', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
154198
skipStagesAfterUnstable()
155199
}
156-
// triggers {
157-
// //TODO: add scheduled runs
158-
// }
159-
// environment {
160-
// //TODO
161-
// }
200+
201+
triggers {
202+
// Trigger nightly builds on the develop branch
203+
parameterizedCron( env.BRANCH_NAME == 'develop' ? '''00 05 * * * % E2E_MARKLOGIC_IMAGE_VERSION=ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12
204+
00 05 * * * % E2E_MARKLOGIC_IMAGE_VERSION=ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-11; PUBLISH_IMAGE=false''' : '')
205+
}
206+
207+
environment {
208+
PATH = "/space/go/bin:${env.PATH}"
209+
MINIKUBE_HOME = "/space/minikube/"
210+
KUBECONFIG = "/space/.kube-config"
211+
GOPATH = "/space/go"
212+
}
213+
162214

163215
parameters {
164-
string(name: 'dockerImage', defaultValue: 'ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11', description: 'Docker image to use for tests.', trim: true)
216+
string(name: 'E2E_MARKLOGIC_IMAGE_VERSION', defaultValue: 'ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12', description: 'Docker image to use for tests.', trim: true)
217+
string(name: 'VERSION', defaultValue: '1.1.0', description: 'Version to tag the image with.', trim: true)
218+
booleanParam(name: 'PUBLISH_IMAGE', defaultValue: false, description: 'Publish image to internal registry')
165219
string(name: 'emailList', defaultValue: emailList, description: 'List of email for build notification', trim: true)
166220
}
167221

@@ -195,6 +249,26 @@ pipeline {
195249
runMinikubeCleanup()
196250
}
197251
}
252+
253+
// Publish image to internal registries (conditional)
254+
stage('Publish Image') {
255+
when {
256+
anyOf {
257+
branch 'develop'
258+
expression { return params.PUBLISH_IMAGE }
259+
}
260+
}
261+
steps {
262+
publishToInternalRegistry()
263+
}
264+
}
265+
266+
stage('Run-BlackDuck-Scan') {
267+
268+
steps {
269+
runBlackDuckScan()
270+
}
271+
}
198272

199273
}
200274

@@ -203,13 +277,16 @@ pipeline {
203277
publishTestResults()
204278
}
205279
success {
206-
resultNotification('BUILD SUCCESS ✅')
280+
resultNotification('✅ Success')
207281
}
208282
failure {
209-
resultNotification('BUILD ERROR ❌')
283+
resultNotification('❌ Failure')
210284
}
211285
unstable {
212-
resultNotification('BUILD UNSTABLE 🉑')
286+
resultNotification('⚠️ Unstable')
287+
}
288+
aborted {
289+
resultNotification('🚫 Aborted')
213290
}
214291
}
215292
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2024-2025 MarkLogic Corporation.
1+
Copyright (c) 2024-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
22

33
Apache License
44
Version 2.0, January 2004

Makefile

100644100755
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
# Copyright (c) 2024-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+
13
# VERSION defines the project version for the bundle.
24
# Update this value when you upgrade the version of your project.
35
# To re-generate a bundle for another specific version without changing the standard setup, you can:
46
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
57
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
VERSION ?= 1.0.0
8+
VERSION ?= 1.1.0
79

810
# VERIFY_HUGE_PAGES defines if hugepages test is enabled or not for e2e test
911
VERIFY_HUGE_PAGES ?= false
1012

1113
export E2E_DOCKER_IMAGE ?= $(IMG)
1214
export E2E_KUSTOMIZE_VERSION ?= $(KUSTOMIZE_VERSION)
1315
export E2E_CONTROLLER_TOOLS_VERSION ?= $(CONTROLLER_TOOLS_VERSION)
14-
export E2E_MARKLOGIC_IMAGE_VERSION ?= progressofficial/marklogic-db:11.3.1-ubi-rootless-2.1.0
15-
export E2E_KUBERNETES_VERSION ?= v1.31.0
16+
export E2E_MARKLOGIC_IMAGE_VERSION ?= progressofficial/marklogic-db:12.0.0-ubi9-rootless-2.2.2
17+
export E2E_KUBERNETES_VERSION ?= v1.31.13
1618

1719
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
1820
ENVTEST_K8S_VERSION = 1.31.0
@@ -157,22 +159,26 @@ endif
157159

158160
.PHONY: e2e-setup-minikube
159161
e2e-setup-minikube: kustomize controller-gen build docker-build
162+
minikube version
160163
minikube delete || true
161164
minikube start --driver=docker --kubernetes-version=$(E2E_KUBERNETES_VERSION) --memory=8192 --cpus=2
162165
minikube addons enable ingress
163166
minikube image load $(IMG)
167+
minikube image load $(E2E_MARKLOGIC_IMAGE_VERSION)
168+
minikube image load "docker.io/haproxytech/haproxy-alpine:3.2"
169+
minikube image ls
164170

165171
.PHONY: e2e-cleanup-minikube
166172
e2e-cleanup-minikube:
167173
@echo "=====Delete minikube cluster"
168174
minikube delete
169175

170176
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
171-
GOLANGCI_LINT_VERSION ?= v1.54.2
177+
GOLANGCI_LINT_VERSION ?= v1.62.2
172178
golangci-lint:
173179
@[ -f $(GOLANGCI_LINT) ] || { \
174180
set -e ;\
175-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
181+
GOBIN=$(shell dirname $(GOLANGCI_LINT)) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) ;\
176182
}
177183

178184
.PHONY: lint
@@ -199,7 +205,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
199205
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
200206
.PHONY: docker-build
201207
docker-build: ## Build docker image with the manager. to build for linux, add --platform="linux/amd64"
202-
$(CONTAINER_TOOL) buildx build -t ${IMG} .
208+
$(CONTAINER_TOOL) buildx build --platform="linux/amd64" -t ${IMG} .
203209

204210
.PHONY: docker-push
205211
docker-push: ## Push docker image with the manager.
@@ -260,7 +266,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
260266

261267
## Tool Versions
262268
KUSTOMIZE_VERSION ?= v5.5.0
263-
CONTROLLER_TOOLS_VERSION ?= v0.17.1
269+
CONTROLLER_TOOLS_VERSION ?= v0.19.0
264270

265271
.PHONY: kustomize
266272
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -363,6 +369,7 @@ $(HELMIFY): $(LOCALBIN)
363369
test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/arttor/helmify/cmd/helmify@latest
364370

365371
helm: manifests kustomize helmify
372+
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
366373
$(KUSTOMIZE) build config/default | $(HELMIFY) -image-pull-secrets -original-name charts/marklogic-operator-kubernetes
367374

368375
.PHONY: image-scan

0 commit comments

Comments
 (0)