Jenkinsfile auf Woodpecker-Parität umgestellt:

This commit is contained in:
ISA
2025-09-08 07:40:52 +02:00
parent 2eb8f3a255
commit 0865d61450
6 changed files with 78 additions and 43 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer # 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) NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.857 NEXT_PUBLIC_APP_VERSION=1.6.858
NEXT_PUBLIC_CPL_MODE=production NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.858] 2025-09-08
- fix: Jenkinsfile
---
## [1.6.857] 2025-09-08 ## [1.6.857] 2025-09-08
- Admin User nach einer Zeit von einer Stunde löschen (Cookie oder Local Storrage) , automatisch abmelden - Admin User nach einer Zeit von einer Stunde löschen (Cookie oder Local Storrage) , automatisch abmelden

106
Jenkinsfile vendored
View File

@@ -1,61 +1,88 @@
pipeline { pipeline {
agent any // Nutze das gleiche Playwright-Image wie Woodpecker für Parität
tools { nodejs 'node20' } // exakt der Name aus "Manage Jenkins → Tools" 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 { stages {
stage('Versions') { stage('Versions') {
steps { sh 'node -v && npm -v' } steps {
sh 'node -v && npm -v && npx playwright --version'
}
} }
stage('Verify mocks') { stage('Verify mocks') {
steps { steps {
sh ''' sh '''bash -euo pipefail <<'EOF'
# dash (/bin/sh) on Jenkins does not support -o pipefail; keep -e -u -x echo "[Verify mocks] working dir: $(pwd)"
set -eux node -v && npm -v
npm ci echo "HUSKY=$HUSKY"
echo "=== git ls-files ===" npm ci
git ls-files | grep -i "^mocks/device-cgi-simulator/SERVICE/systemMockData.js" || true echo "=== git ls-files ==="
echo "=== ls -la ===" git ls-files | grep -i '^mocks/device-cgi-simulator/SERVICE/systemMockData.js' || true
ls -la mocks/device-cgi-simulator/SERVICE || true echo "=== ls -la ==="
echo "=== file exists? ===" ls -la mocks/device-cgi-simulator/SERVICE || true
test -f mocks/device-cgi-simulator/SERVICE/systemMockData.js && echo "FOUND" || (echo "MISSING" && exit 1) 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)') { stage('Build') {
environment {
CI = 'true'
NODE_ENV = 'production'
NEXT_TELEMETRY_DISABLED = '1'
PORT = '3000'
}
steps { steps {
sh ''' sh '''bash -euo pipefail <<'EOF'
# dash (/bin/sh) on Jenkins does not support -o pipefail; keep -e -u -x env npm_config_production=false npm ci
set -eux npm run build
# Install devDependencies as well (rimraf, cross-env, etc.) EOF"""
env npm_config_production=false npm ci }
}
# Build Next.js stage('E2E chromium') {
npm run build steps {
sh '''bash -euo pipefail <<'EOF'
echo 'Start simulator'
npm run server:sim &
SIM_PID=$!
# Start local static simulator in background cleanup() {
npm run server:sim & echo 'Stopping simulator'
kill $SIM_PID 2>/dev/null || true
}
trap cleanup EXIT
# Ensure Playwright browsers and OS deps are installed (best-effort) echo 'Waiting for http://localhost:3000'
npx playwright install-deps || true 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 install
# Wait until simulator responds on port 3000 (no curl dependency) # Browser (Image hat sie normalerweise schon)
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 install --with-deps chromium || true
# Run tests (chromium only to match Woodpecker) echo 'Run tests (chromium)'
npx playwright test --project=chromium npx playwright test --project=chromium
''' EOF"""
} }
} }
} }
post { post {
success { success {
sh 'curl -d "Tests erfolgreich in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' sh 'curl -d "Tests erfolgreich in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35'
@@ -63,5 +90,8 @@ pipeline {
failure { failure {
sh 'curl -d "Tests fehlgeschlagen in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35' sh 'curl -d "Tests fehlgeschlagen in Jenkins" https://ntfy.sh/OEOr8DNB0aT2mXWg231PeEEKwvuzt86qgM8ezQmgfcX9ZIlZ35'
} }
always {
sh 'echo Workspace: $(pwd); ls -1'
}
} }
} }

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.857", "version": "1.6.858",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.857", "version": "1.6.858",
"dependencies": { "dependencies": {
"@fontsource/roboto": "^5.1.0", "@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4", "@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.857", "version": "1.6.858",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3000", "dev": "next dev -p 3000",