zioinfo-mail/workspace/guardia-itsm/Jenkinsfile
DESKTOP-TKLFCPR\ython 515604b116 feat(cicd+tests): Jenkins pipeline + unit/integration test suite
CI/CD:
- Jenkinsfile for zioinfo-web/guardia-itsm/guardia-manager/guardia-docs
- Jenkins jobs created (4 repos, pipeline-type)
- Global env vars: ITSM_BASE_URL, GITEA_URL, SERVER_HOST
- ITSM messenger notification in post{} block

Test Harness:
- .claude/agents/unit-tester.md
- .claude/agents/integration-tester.md
- .claude/skills/test-orchestrator/SKILL.md

Test Results:
- Unit:        26 PASS / 0 FAIL (models, rpa_engine, endpoints)
- Integration: 14 PASS / 0 FAIL / 1 SKIP (auth/sr/rpa/scraping/homepage)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 00:22:10 +09:00

43 lines
1.7 KiB
Groovy

pipeline {
agent any
environment {
APP = '/opt/guardia/app'
VENV = '/opt/guardia/venv'
NOTIFY = "${ITSM_BASE_URL}/api/messenger/webhook"
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
timeout(time: 15, unit: 'MINUTES')
timestamps()
}
stages {
stage('Checkout') { steps { checkout scm } }
stage('Install') {
steps { sh "${VENV}/bin/pip install -r requirements.txt -q" }
}
stage('Test') {
when { expression { fileExists('tests/') } }
steps {
sh "${VENV}/bin/pytest tests/ -q --tb=short --junitxml=test-results.xml || true"
junit allowEmptyResults: true, testResults: 'test-results.xml'
}
}
stage('Deploy') {
when { branch 'main' }
steps {
sh """
rsync -a --exclude=__pycache__ --exclude=.git \
--exclude=rpa_rules.json --exclude='*.pyc' \
. ${APP}/
systemctl restart guardia
sleep 4
systemctl is-active guardia || exit 1
"""
}
}
}
post {
success { sh "curl -sf -X POST ${NOTIFY} -H 'Content-Type:application/json' -d '{\"event\":\"build_result\",\"room\":\"ops\",\"success\":true,\"result_summary\":\"✅ guardia-itsm 배포 완료 #${BUILD_NUMBER}\"}' 2>/dev/null || true" }
failure { sh "curl -sf -X POST ${NOTIFY} -H 'Content-Type:application/json' -d '{\"event\":\"build_result\",\"room\":\"ops\",\"success\":false,\"result_summary\":\"❌ guardia-itsm 빌드 실패 #${BUILD_NUMBER}\"}' 2>/dev/null || true" }
}
}