From f7ba568117d7a9588b265b8f56a9865591b4beab Mon Sep 17 00:00:00 2001 From: Thomas Roger Date: Thu, 19 Dec 2024 11:07:01 +0100 Subject: [PATCH 1/3] NXJS-218: Run tests against LTS 2025 --- ci/Jenkinsfiles/build.groovy | 23 +++++++++++----- .../environments/functional-tests-2025.yaml | 4 +++ ci/helm/helmfile.yaml.gotmpl | 27 ++++++++++++++++--- ...yaml.gotmpl => values-mongodb.yaml.gotmpl} | 0 ci/helm/values/values-nuxeo.yaml.gotmpl | 20 +++++++++++++- 5 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 ci/helm/environments/functional-tests-2025.yaml rename ci/helm/values/{values-mongodb-6.yaml.gotmpl => values-mongodb.yaml.gotmpl} (100%) diff --git a/ci/Jenkinsfiles/build.groovy b/ci/Jenkinsfiles/build.groovy index e686143..617e594 100644 --- a/ci/Jenkinsfiles/build.groovy +++ b/ci/Jenkinsfiles/build.groovy @@ -33,9 +33,9 @@ Closure buildFunctionalTestStage(String containerId, String nodejsVersion, Strin return { container(containerId) { nxWithHelmfileDeployment(namespace: testNamespace, environment: "functional-tests-${nuxeoVersion}", - secrets: [[name: 'platform-cluster-tls', namespace: 'platform']], envVars: ["NUXEO_VERSION=${nuxeoVersion}-${VERSION}", - "JS_REPORTS_DIR=nuxeo-${nuxeoVersionSlug}-node-${nodejsVersionSlug}", "NUXEO_DOMAIN=${nuxeoDomain}", - "NUXEO_BASE_URL=https://${nuxeoDomain}/nuxeo"]) { + secrets: [[name: 'platform-cluster-tls', namespace: 'platform'], [name: 'instance-clid-preprod', namespace: 'platform']], + envVars: ["NUXEO_VERSION=${nuxeoVersion}-${VERSION}", "JS_REPORTS_DIR=nuxeo-${nuxeoVersionSlug}-node-${nodejsVersionSlug}", + "NUXEO_DOMAIN=${nuxeoDomain}", "NUXEO_BASE_URL=https://${nuxeoDomain}/nuxeo"]) { script { try { sh "yarn it:cover" @@ -160,6 +160,15 @@ pipeline { } } } + stage('Nuxeo 2025') { + steps { + container('nodejs-active') { + script { + nxDocker.build(skaffoldFile: 'ci/docker/nuxeo/skaffold.yaml', envVars: ["FTESTS_VERSION=2025-${VERSION}", "NUXEO_VERSION=2025.x"]) + } + } + } + } } } @@ -167,9 +176,11 @@ pipeline { steps { script { def stages = [:] - // run functional tests against latest nuxeo version for active node - stages["Against Nuxeo 2023 - Node.js ${NODEJS_ACTIVE_VERSION}"] = - buildFunctionalTestStage("nodejs-active", env.NODEJS_ACTIVE_VERSION, '2023') + // run functional tests against latest and upcoming nuxeo version for active node + for (nuxeoVersion in ["2023", "2025"]) { + stages["Against Nuxeo ${nuxeoVersion} - Node.js ${NODEJS_ACTIVE_VERSION}"] = + buildFunctionalTestStage("nodejs-active", env.NODEJS_ACTIVE_VERSION, nuxeoVersion) + } // run functional tests against all nuxeo version for maintenance mode for (nuxeoVersion in ["10.10", "2021", "2023"]) { stages["Against Nuxeo ${nuxeoVersion} - Node.js ${NODEJS_MAINTENANCE_VERSION}"] = diff --git a/ci/helm/environments/functional-tests-2025.yaml b/ci/helm/environments/functional-tests-2025.yaml new file mode 100644 index 0000000..5a86287 --- /dev/null +++ b/ci/helm/environments/functional-tests-2025.yaml @@ -0,0 +1,4 @@ +opensearch: + enabled: true +elasticsearch: + enabled: false diff --git a/ci/helm/helmfile.yaml.gotmpl b/ci/helm/helmfile.yaml.gotmpl index bd28860..4ee8030 100644 --- a/ci/helm/helmfile.yaml.gotmpl +++ b/ci/helm/helmfile.yaml.gotmpl @@ -33,6 +33,18 @@ environments: mongodb: image: tag: "6.0.2" + functional-tests-2025: + values: + - environments/functional-tests-2025.yaml + - nuxeo: + image: + tag: {{ env "NUXEO_VERSION" | default "2025.x" | quote }} + opensearch: + image: + tag: "1.3.19" + mongodb: + image: + tag: "8.0.3" --- repositories: - name: bitnami @@ -58,7 +70,7 @@ releases: chart: nuxeo/nuxeo version: ~3.1.0 needs: - - {{ eq .Environment.Name "functional-tests-2023" | ternary "opensearch" "elasticsearch" }} + - {{ any (eq .Environment.Name "functional-tests-2023") (eq .Environment.Name "functional-tests-2025") | ternary "opensearch" "elasticsearch" }} - "mongodb" values: - values/values-nuxeo.yaml.gotmpl @@ -111,10 +123,19 @@ releases: {{ end }} {{ if eq .Environment.Name "functional-tests-2023" }} - name: mongodb - chart: bitnami/mongodb + chart: oci://registry-1.docker.io/bitnamicharts/mongodb version: 13.3.1 values: - - values/values-mongodb-6.yaml.gotmpl + - values/values-mongodb.yaml.gotmpl + - values/values-mongodb-commons.yaml.gotmpl + - values/values-tolerations.yaml.gotmpl +{{ end }} +{{ if eq .Environment.Name "functional-tests-2025" }} + - name: mongodb + chart: oci://registry-1.docker.io/bitnamicharts/mongodb + version: 16.1.1 + values: + - values/values-mongodb.yaml.gotmpl - values/values-mongodb-commons.yaml.gotmpl - values/values-tolerations.yaml.gotmpl {{ end }} diff --git a/ci/helm/values/values-mongodb-6.yaml.gotmpl b/ci/helm/values/values-mongodb.yaml.gotmpl similarity index 100% rename from ci/helm/values/values-mongodb-6.yaml.gotmpl rename to ci/helm/values/values-mongodb.yaml.gotmpl diff --git a/ci/helm/values/values-nuxeo.yaml.gotmpl b/ci/helm/values/values-nuxeo.yaml.gotmpl index 221244a..f46bc80 100644 --- a/ci/helm/values/values-nuxeo.yaml.gotmpl +++ b/ci/helm/values/values-nuxeo.yaml.gotmpl @@ -43,9 +43,27 @@ ingress: - {{ requiredEnv "NUXEO_DOMAIN" }} secretName: platform-cluster-tls {{- end }} +customProperties: + dev: | + org.nuxeo.dev=true + org.nuxeo.rest.stack.enable=true {{- if hasPrefix "10.10" .Values.nuxeo.image.tag }} {{/* this value is lost for 10.10 */}} -customProperties: elasticsearch: | elasticsearch.client=RestClient {{- end }} +{{- if hasPrefix "2025" .Values.nuxeo.image.tag }} + default: | + nuxeo.append.templates.default=default +{{- end }} +{{- if hasPrefix "2025" .Values.nuxeo.image.tag }} +customEnvs: +- name: NUXEO_CONNECT_URL + value: https://nos-preprod-connect.nuxeocloud.com/nuxeo/site/ +- name: NUXEO_CLID + valueFrom: + secretKeyRef: + name: instance-clid-preprod + key: instance.clid +packages: nuxeo-audit-opensearch1 +{{- end }} \ No newline at end of file From 4dc11516c81147fffd34458b898f192c26892a5a Mon Sep 17 00:00:00 2001 From: Thomas Roger Date: Tue, 7 Jan 2025 16:12:49 +0100 Subject: [PATCH 2/3] NXJS-218: fix multipart/form-data handling --- lib/operation.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/operation.js b/lib/operation.js index c1626cc..527d6ea 100644 --- a/lib/operation.js +++ b/lib/operation.js @@ -108,19 +108,22 @@ class Operation extends Base { */ execute(opts = {}) { const options = this._computeOptions(opts); - options.headers = options.headers || {}; - options.headers['Content-Type'] = this._computeContentTypeHeader(this._automationParams.input); + const body = this._computeRequestBody(); + const headers = this._computeRequestHeaders(body); + const url = this._computeRequestURL(); let finalOptions = { + body, + headers, + url, method: 'POST', - url: this._computeRequestURL(), - body: this._computeRequestBody(), }; finalOptions = extend(true, finalOptions, options); return this._nuxeo.http(finalOptions); } - _computeContentTypeHeader(input) { - return this._isMultipartInput(input) ? 'multipart/form-data' : 'application/json'; + _computeRequestHeaders(body) { + const contentType = body instanceof FormData ? body.getHeaders()['content-type'] : 'application/json'; + return { 'Content-Type': contentType }; } _computeRequestURL() { @@ -167,7 +170,7 @@ class Operation extends Base { context: this._automationParams.context, }; const form = new FormData(); - form.append('params', JSON.stringify(automationParams)); + form.append('params', JSON.stringify(automationParams), { contentType: 'application/json' }); let inputIndex = 0; for (const blob of input) { @@ -186,7 +189,7 @@ class Operation extends Base { context: this._automationParams.context, }; const form = new FormData(); - form.append('params', JSON.stringify(automationParams)); + form.append('params', JSON.stringify(automationParams), { contentType: 'application/json' }); form.append('input', input.content, input.name); return form; } From c1cfb8fc0ca6b3743442bb731fd9505a9d27197a Mon Sep 17 00:00:00 2001 From: Thomas Roger Date: Wed, 8 Jan 2025 10:59:51 +0100 Subject: [PATCH 3/3] NXJS-218: increase nuxeo startup delay --- ci/helm/values/values-nuxeo.yaml.gotmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/helm/values/values-nuxeo.yaml.gotmpl b/ci/helm/values/values-nuxeo.yaml.gotmpl index f46bc80..b602f02 100644 --- a/ci/helm/values/values-nuxeo.yaml.gotmpl +++ b/ci/helm/values/values-nuxeo.yaml.gotmpl @@ -66,4 +66,6 @@ customEnvs: name: instance-clid-preprod key: instance.clid packages: nuxeo-audit-opensearch1 -{{- end }} \ No newline at end of file +{{- end }} +startupProbe: + initialDelaySeconds: 90 \ No newline at end of file