diff --git a/Jenkinsfile b/Jenkinsfile index 2915aa0..66a67d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,12 @@ -// Деплой Home AI Assistant на grigosserver. +// Home AI Assistant — деплой на Linux (Docker). // -// Jenkins: New Item → Pipeline → Pipeline script from SCM → этот репозиторий. -// Агент: хост с Docker, где лежит ~/to_services/Home_assistant (label ниже). +// Нода Jenkins: Labels = linux (Manage Jenkins → Nodes → мастер → Configure) // -// Один раз на сервере: -// git clone ~/to_services/Home_assistant -// cp .env.example .env # OPENROUTER_API_KEY и прочее -// mkdir -p data +// На сервере: /home/grigo/to_services/Home_assistant (.env, data/) pipeline { agent { - label 'мастер' + label 'linux' } options { @@ -34,12 +30,12 @@ pipeline { string( name: 'BACKEND_HEALTH_URL', defaultValue: 'http://127.0.0.1:8202/api/v1/health', - description: 'Проверка после деплоя' + description: 'Healthcheck после деплоя' ) booleanParam( name: 'RUN_TESTS', defaultValue: true, - description: 'npm run build + compileall в workspace Jenkins' + description: 'npm run build + compileall в workspace перед деплоем' ) booleanParam( name: 'DOCKER_PULL', @@ -57,6 +53,22 @@ pipeline { } stages { + stage('Test') { + when { + expression { return params.RUN_TESTS } + } + steps { + sh ''' + set -euxo pipefail + cd frontend + if [ -f package-lock.json ]; then npm ci; else npm install; fi + npm run build + cd .. + python3 -m compileall -q backend/app + ''' + } + } + stage('Preflight') { steps { sh ''' @@ -70,26 +82,6 @@ pipeline { } } - stage('Test') { - when { - expression { return params.RUN_TESTS } - } - steps { - sh ''' - set -euxo pipefail - cd frontend - if [ -f package-lock.json ]; then - npm ci - else - npm install - fi - npm run build - cd .. - python3 -m compileall -q backend/app - ''' - } - } - stage('Deploy') { steps { dir("${DEPLOY_DIR}") {