From 0865d61450bca671fe572542d00f50a91c8815fa Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 8 Sep 2025 07:40:52 +0200 Subject: [PATCH] =?UTF-8?q?Jenkinsfile=20auf=20Woodpecker-Parit=C3=A4t=20u?= =?UTF-8?q?mgestellt:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 +++ Jenkinsfile | 106 +++++++++++++++++++++++++++++----------------- package-lock.json | 4 +- package.json | 2 +- 6 files changed, 78 insertions(+), 43 deletions(-) diff --git a/.env.development b/.env.development index e990b30..7af4043 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.857 +NEXT_PUBLIC_APP_VERSION=1.6.858 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 a850aa2..e428c4b 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.857 +NEXT_PUBLIC_APP_VERSION=1.6.858 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6787337..9bac96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.858] – 2025-09-08 + +- fix: Jenkinsfile + +--- ## [1.6.857] – 2025-09-08 - Admin User nach einer Zeit von einer Stunde löschen (Cookie oder Local Storrage) , automatisch abmelden diff --git a/Jenkinsfile b/Jenkinsfile index 4ba98fe..70c0f9b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,61 +1,88 @@ pipeline { - agent any - tools { nodejs 'node20' } // exakt der Name aus "Manage Jenkins → Tools" + // Nutze das gleiche Playwright-Image wie Woodpecker für Parität + agent { + docker { + image 'mcr.microsoft.com/playwright:v1.54.2-jammy' + // root erlaubt playwright install (falls nötig) + args '-u 0:0' + } + } + + options { timestamps() } + + environment { + CI = 'true' + NODE_ENV = 'production' + NEXT_TELEMETRY_DISABLED = '1' + PORT = '3000' + HUSKY = '0' // Husky Hooks im CI deaktivieren + npm_config_fund = 'false' + npm_config_audit = 'false' + } stages { stage('Versions') { - steps { sh 'node -v && npm -v' } + steps { + sh 'node -v && npm -v && npx playwright --version' + } } stage('Verify mocks') { steps { - sh ''' - # dash (/bin/sh) on Jenkins does not support -o pipefail; keep -e -u -x - set -eux - npm ci - 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) - ''' + sh '''bash -euo pipefail <<'EOF' +echo "[Verify mocks] working dir: $(pwd)" +node -v && npm -v +echo "HUSKY=$HUSKY" +npm ci +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? ===" +if [ -f mocks/device-cgi-simulator/SERVICE/systemMockData.js ]; then + echo 'FOUND' +else + echo 'MISSING'; exit 1 +fi +EOF""" } } - stage('Build & E2E (chromium)') { - environment { - CI = 'true' - NODE_ENV = 'production' - NEXT_TELEMETRY_DISABLED = '1' - PORT = '3000' - } + stage('Build') { steps { - sh ''' - # dash (/bin/sh) on Jenkins does not support -o pipefail; keep -e -u -x - set -eux - # Install devDependencies as well (rimraf, cross-env, etc.) - env npm_config_production=false npm ci + sh '''bash -euo pipefail <<'EOF' +env npm_config_production=false npm ci +npm run build +EOF""" + } + } - # Build Next.js - npm run build + stage('E2E chromium') { + steps { + sh '''bash -euo pipefail <<'EOF' +echo 'Start simulator' +npm run server:sim & +SIM_PID=$! - # Start local static simulator in background - npm run server:sim & +cleanup() { + echo 'Stopping simulator' + kill $SIM_PID 2>/dev/null || true +} +trap cleanup EXIT - # Ensure Playwright browsers and OS deps are installed (best-effort) - npx playwright install-deps || true - npx playwright install +echo 'Waiting for http://localhost:3000' +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();" - # Wait until simulator responds on port 3000 (no curl dependency) - 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();" +# Browser (Image hat sie normalerweise schon) +npx playwright install --with-deps chromium || true - # Run tests (chromium only to match Woodpecker) - npx playwright test --project=chromium - ''' +echo 'Run tests (chromium)' +npx playwright test --project=chromium +EOF""" } } } + post { success { sh 'curl -d "Tests erfolgreich in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' @@ -63,5 +90,8 @@ pipeline { failure { sh 'curl -d "Tests fehlgeschlagen in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' } + always { + sh 'echo Workspace: $(pwd); ls -1' + } } } diff --git a/package-lock.json b/package-lock.json index 0a571b8..2927ce7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.857", + "version": "1.6.858", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.857", + "version": "1.6.858", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index eed672e..448f07a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.857", + "version": "1.6.858", "private": true, "scripts": { "dev": "next dev -p 3000",