You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-23 22:05:15 +02:00
152 lines
4.7 KiB
Plaintext
Vendored
152 lines
4.7 KiB
Plaintext
Vendored
def runCommand(String command) {
|
|
if (isUnix()) {
|
|
sh(script: command)
|
|
} else {
|
|
bat(script: command)
|
|
}
|
|
}
|
|
|
|
pipeline {
|
|
agent {
|
|
label 'Deb-Agent' // Имя или метка агента
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Read stages config') {
|
|
steps {
|
|
script {
|
|
def configText = readFile './service/tests_config.json'
|
|
env.STAGES_CONFIG = configText
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Remove oint') {
|
|
steps {
|
|
script {
|
|
// Удаляем oint, если он установлен
|
|
sh 'dpkg -r oint || echo "oint not installed"'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Download oint package') {
|
|
steps {
|
|
script {
|
|
// Скачиваем новый deb-пакет oint
|
|
sh 'wget -O oint_1.30.0_all_en.deb https://jenkins.openintegrations.dev/job/OpiBuild/job/OpiRelease/lastSuccessfulBuild/artifact/1.30.0/oint_1.30.0_all_en.deb '
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Install oint package') {
|
|
steps {
|
|
script {
|
|
sh 'dpkg -i oint_1.30.0_all_en.deb'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Prepare'){
|
|
steps{
|
|
sh 'cd ./src/en/OInt && opm build && opm install oint-1.30.0.ospx && rm oint-1.30.0.ospx'
|
|
}
|
|
}
|
|
stage('Create ReportPortal launch'){
|
|
steps{
|
|
sh 'oscript ./ci/os/rp_start.os "CLI"'
|
|
}
|
|
}
|
|
|
|
stage('Testing-BuildCheck') {
|
|
when {
|
|
expression { return shouldRunStage('BuildCheck') }
|
|
}
|
|
steps {
|
|
script {
|
|
def tests = [
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'CheckIBToLastBuildCompliance'],
|
|
]
|
|
for (test in tests) {
|
|
runLibraryTest(test[0], test[1])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Testing-Dropbox') {
|
|
when {
|
|
expression { return shouldRunStage('Dropbox') }
|
|
}
|
|
steps {
|
|
script {
|
|
def tests = [
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_GetUpdateToken'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_UploadFile'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_UploadFileByURL'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_CreateFolder'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_CreateDeleteTag'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_GetAccount'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_AccessManagement'],
|
|
['./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os', 'DropboxAPI_GetFolderFileList'],
|
|
]
|
|
for (test in tests) {
|
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
|
runLibraryTest(test[0], test[1])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
post{
|
|
always{
|
|
script {
|
|
catchError() {
|
|
runCommand('oscript ./ci/os/rp_stop.os "en"')
|
|
}
|
|
withCredentials([gitUsernamePassword(credentialsId: 'gitmain', gitToolName: 'Default')]) {
|
|
sh "git config user.email vitaly.the.alpaca@gmail.com"
|
|
sh 'git config user.name "Vitaly the Alpaca (bot)"'
|
|
sh "git config --global core.ignorecase true"
|
|
sh "git add ."
|
|
sh 'git commit -m "Test data update (Jenkins)"'
|
|
sh "git push origin HEAD:main"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def shouldRunStage(stageName) {
|
|
try {
|
|
if (!env.STAGES_CONFIG) {
|
|
echo "[WARN] STAGES_CONFIG not set. Assuming stage '${stageName}' is ENABLED."
|
|
return true
|
|
}
|
|
def config = readJSON text: env.STAGES_CONFIG
|
|
def value = config[stageName]
|
|
if (value == null) {
|
|
echo "[WARN] Stage '${stageName}' not found in config. Defaulting to DISABLED."
|
|
return false
|
|
}
|
|
return value == true
|
|
} catch (Exception e) {
|
|
echo "[ERROR] Failed to parse STAGES_CONFIG: ${e.message}"
|
|
echo "Raw config: ${env.STAGES_CONFIG}"
|
|
// Решите: включать stage по умолчанию или нет?
|
|
return false // или true — по вашему усмотрению
|
|
}
|
|
}
|
|
|
|
def runLibraryTest(String configPath, String libraryName) {
|
|
try {
|
|
echo "Executing: 1testrunner -run \"${configPath}\" \"${libraryName}\""
|
|
runCommand("1testrunner -run \"${configPath}\" \"${libraryName}\"")
|
|
echo "Test ${libraryName} completed successfully"
|
|
} catch (Exception e) {
|
|
echo "ERROR in test ${libraryName}: ${e.getMessage()}"
|
|
throw e
|
|
}
|
|
} |