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_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)

View File

@@ -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

View File

@@ -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

106
Jenkinsfile vendored
View File

@@ -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'
}
}
}

4
package-lock.json generated
View File

@@ -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",

View File

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