You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-23 22:05:15 +02:00
229 lines
10 KiB
Plaintext
Vendored
229 lines
10 KiB
Plaintext
Vendored
def runCommand(String command) {
|
|
if (isUnix()) {
|
|
sh(script: command)
|
|
} else {
|
|
bat(script: command)
|
|
}
|
|
}
|
|
|
|
pipeline {
|
|
agent {
|
|
label 'windows'
|
|
}
|
|
stages {
|
|
|
|
stage('Read stages config') {
|
|
steps {
|
|
script {
|
|
def configText = readFile './service/tests_config.json'
|
|
env.STAGES_CONFIG = configText
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Decrypt Data') {
|
|
steps {
|
|
powershell encoding: 'UTF-8', script:'cd ./src/en/OInt; opm build; opm install oint-1.28.0.ospx; del oint-1.28.0.ospx'
|
|
withCredentials([string(credentialsId: 'gpgkey', variable: 'GPGKEY')]) {
|
|
bat encoding: 'UTF-8', script:'gpg --quiet --batch --yes --decrypt --passphrase="%GPGKEY%" --output ./data.json ./data.json.gpg'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Remove oint.bat if exists') {
|
|
steps {
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$batFile = "C:\\Program Files\\OneScript\\bin\\oint.bat"
|
|
if (Test-Path $batFile) {
|
|
Remove-Item -Path $batFile -Force
|
|
Write-Host "Файл oint.bat удален."
|
|
} else {
|
|
Write-Host "Файл oint.bat не найден, пропускаем удаление."
|
|
}
|
|
'''
|
|
|
|
// Проверяем, что файл действительно удален
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$batFile = "C:\\Program Files\\OneScript\\bin\\oint.bat"
|
|
if (Test-Path $batFile) {
|
|
Write-Error "Ошибка: Файл oint.bat не удален!"
|
|
exit 1
|
|
} else {
|
|
Write-Host "Проверка: oint.bat успешно удален или отсутствовал."
|
|
}
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Uninstall OInt if installed') {
|
|
steps {
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$uninstallerPath = "C:\\Program Files (x86)\\OInt\\unins000.exe"
|
|
if (Test-Path $uninstallerPath) {
|
|
Write-Host "OInt найден. Запускаем удаление..."
|
|
Start-Process -FilePath $uninstallerPath -ArgumentList "/VERYSILENT /NORESTART" -Wait
|
|
Write-Host "Удаление OInt завершено."
|
|
} else {
|
|
Write-Host "OInt не установлен. Пропускаем этап удаления."
|
|
}
|
|
'''
|
|
|
|
// Проверяем, что oint.bat в C:\Program Files (x86)\OInt\bin\oint.bat удален
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$batFile = "C:\\Program Files (x86)\\OInt\\bin\\oint.bat"
|
|
if (Test-Path $batFile) {
|
|
Write-Error "Ошибка: oint.bat всё ещё существует после uninstall!"
|
|
exit 1
|
|
} else {
|
|
Write-Host "Проверка: oint.bat после uninstall отсутствует."
|
|
}
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Prepare Download Dir') {
|
|
steps {
|
|
bat 'if not exist "%USERPROFILE%\\Downloads" mkdir "%USERPROFILE%\\Downloads"'
|
|
}
|
|
}
|
|
|
|
stage('Download Installer') {
|
|
steps {
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$url = "https://jenkins.openintegrations.dev/job/OpiBuild/job/OpiRelease/lastSuccessfulBuild/artifact/1.28.0/oint_1.28.0_installer_en.exe "
|
|
$output = "$env:USERPROFILE\\Downloads\\oint_installer.exe"
|
|
Invoke-WebRequest -Uri $url -OutFile $output
|
|
Write-Host "Инсталлер скачан в: $output"
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Install OInt') {
|
|
steps {
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$installerPath = "$env:USERPROFILE\\Downloads\\oint_installer.exe"
|
|
Write-Host "Запускаем установку: $installerPath"
|
|
Start-Process -FilePath $installerPath -ArgumentList "/VERYSILENT /NORESTART" -NoNewWindow -Wait
|
|
Write-Host "Установка завершена."
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Verify Installation') {
|
|
steps {
|
|
// Проверяем наличие oint.bat в C:\Program Files (x86)\OInt\bin\
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$batFile = "C:\\Program Files (x86)\\OInt\\bin\\oint.bat"
|
|
if (-not (Test-Path $batFile)) {
|
|
Write-Error "Ошибка: oint.bat не найден после установки!"
|
|
exit 1
|
|
} else {
|
|
Write-Host "Проверка: oint.bat найден после установки."
|
|
}
|
|
'''
|
|
|
|
// Проверяем, что where oint выводит нужный путь
|
|
powershell encoding: 'UTF-8', script: '''
|
|
$result = (Get-Command oint -ErrorAction SilentlyContinue).Source
|
|
$expectedPath = "C:\\Program Files (x86)\\OInt\\bin\\oint.bat"
|
|
|
|
if ($result -ne $expectedPath) {
|
|
Write-Error "Ошибка: Команда 'where oint' указывает не на тот путь: $result"
|
|
exit 1
|
|
} else {
|
|
Write-Host "Проверка: 'where oint' указывает на правильный путь: $result"
|
|
}
|
|
'''
|
|
}
|
|
}
|
|
stage('Create ReportPortal launch'){
|
|
steps{
|
|
bat encoding: 'UTF-8', script:'chcp 65001 & oscript ./ci/os/rp_start.os "CLI"'
|
|
}
|
|
}
|
|
|
|
stage('Testing-Bitrix24') {
|
|
when {
|
|
expression { return shouldRunStage('Bitrix24') }
|
|
}
|
|
steps {
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_TokenManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_ServerTime"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_PostsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_TaskManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_CommentsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_WorkingWithDrive"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_Kanban"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_Timekeeping"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_ChatManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_NotificationsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_TasksFieldsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_DepartmentsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B2_UsersManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_LeadsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_DealsManagement"')
|
|
}
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runCommand('1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "B24_CalendarsManagement"')
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
post{
|
|
always{
|
|
script {
|
|
catchError() {
|
|
runCommand('oscript ./ci/os/rp_stop.os "en"')
|
|
}
|
|
withCredentials([string(credentialsId: 'gpgkey', variable: 'GPGKEY')]) {
|
|
bat encoding: 'UTF-8', script:'del "./data.json.gpg"'
|
|
bat encoding: 'UTF-8', script:'gpg --batch --symmetric --cipher-algo AES256 --passphrase="%GPGKEY%" ./data.json'
|
|
bat encoding: 'UTF-8', script:'del "./data.json"'
|
|
}
|
|
withCredentials([gitUsernamePassword(credentialsId: 'gitmain', gitToolName: 'Default')]) {
|
|
bat "git config user.email vitaly.the.alpaca@gmail.com"
|
|
bat 'git config user.name "Vitaly the Alpaca (bot)"'
|
|
bat "git config --global core.ignorecase true"
|
|
bat "git add ."
|
|
bat 'git commit -m "Test data update (Jenkins)"'
|
|
bat "git push origin HEAD:main"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def shouldRunStage(stageName) {
|
|
def config = readJSON text: env.STAGES_CONFIG
|
|
return config[stageName] == true
|
|
} |