From d38d3191c51830aa1f02cc1c0a294d046ec91683 Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 8 Sep 2025 08:49:48 +0200 Subject: [PATCH] Test: Jenkinsfile --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 +++ Jenkinsfile | 92 ++++++++++++++++++++++++++++++++++++++++------- package-lock.json | 4 +-- package.json | 2 +- 6 files changed, 90 insertions(+), 17 deletions(-) diff --git a/.env.development b/.env.development index 9006281..080ef19 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.864 +NEXT_PUBLIC_APP_VERSION=1.6.865 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 1a14e9e..75272ca 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.864 +NEXT_PUBLIC_APP_VERSION=1.6.865 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4130d72..0164667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.865] – 2025-09-08 + +- test: Jenkinsfile + +--- ## [1.6.864] – 2025-09-08 - fix: Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile index 87c3bfe..032a2c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,95 @@ pipeline { agent any - tools { nodejs 'node20' } // exakt der Name aus "Manage Jenkins → Tools" + + environment { + CI = "true" + NODE_ENV = "production" + NEXT_TELEMETRY_DISABLED = "1" + PORT = "3000" + } + + options { + timestamps() + } stages { - stage('Versions') { - steps { sh 'node -v && npm -v' } - } - stage('Install deps') { - steps { sh 'npm ci' } - } - stage('Playwright tests') { + stage('Checkout') { steps { - sh 'npx playwright install' // Browser-Binärdateien laden - sh 'npx playwright test' + checkout scm + sh ''' + set -eux + git status --short || true + # Submodule & LFS falls vorhanden + git submodule update --init --recursive || true + git lfs install || true + git lfs fetch || true + git lfs checkout || true + ''' + } + } + + stage('verify-mocks') { + steps { + sh ''' + set -eux + docker run --rm -v "$PWD":/ws -w /ws \ + mcr.microsoft.com/playwright:v1.54.2-jammy bash -lc " + pwd + node -v && npm -v + npm ci --ignore-scripts + echo '=== git ls-files ===' + git ls-files | grep -i '^mocks/device-cgi-simulator/SERVICE/systemMockData.js' || true + echo '=== ls -la ===' + ls -la mocks/device-cgi-simulator/SERVICE || true + echo '=== file exists? ===' + test -f mocks/device-cgi-simulator/SERVICE/systemMockData.js && echo 'FOUND' || (echo 'MISSING' && exit 1) + " + ''' + } + } + + stage('e2e-dev') { + steps { + sh ''' + set -eux + docker run --rm -v "$PWD":/ws -w /ws -p 3000:3000 \ + mcr.microsoft.com/playwright:v1.54.2-jammy bash -lc " + node -v && npm -v + env npm_config_production=false npm ci + npm run build + npm run server:sim & + # Auf Port 3000 warten + node -e \\"const http=require('http');let n=120;function ping(){http.get('http://localhost:3000',res=>{console.log('Server is up');process.exit(0)}).on('error',()=>{if(n--<=0){console.error('Server did not start');process.exit(1)}setTimeout(ping,1000)});}ping();\\" + npx playwright test --project=chromium + " + ''' } } } + post { success { - sh 'curl.exe -d "Tests erfolgreich" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' + sh ''' + docker run --rm curlimages/curl:8.9.1 \ + -d "Tests erfolgreich in Jenkins" \ + https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35 + ''' } failure { - sh 'curl.exe -d "Tests fehlgeschlagen" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' + sh ''' + docker run --rm curlimages/curl:8.9.1 \ + -d "Tests fehlgeschlagen in Jenkins" \ + https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9Z35 + ''' + } + always { + script { + if (fileExists('playwright-report')) { + archiveArtifacts artifacts: 'playwright-report/**', onlyIfSuccessful: false + } else { + echo 'Kein playwright-report gefunden.' + } + } } } } diff --git a/package-lock.json b/package-lock.json index 58bbbc5..16176d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.864", + "version": "1.6.865", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.864", + "version": "1.6.865", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index 5aaa1c1..800d36b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.864", + "version": "1.6.865", "private": true, "scripts": { "dev": "next dev -p 3000",