From bde83fc70530454366482008b03e72453d7fecbd Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Tue, 4 Sep 2018 17:53:18 +0200 Subject: [PATCH 01/10] [WIP] jenkinsfile integration --- .jenkins/bin/archive/gather_external_files.sh | 0 .jenkins/bin/init/append_files.sh | 14 + .jenkins/bin/init/composer_install.sh | 11 + .jenkins/bin/init/debug.sh | 13 + .jenkins/bin/tests/phpunit.sh | 6 + .../bin/unattended_install/default_env.sh | 6 + .../default-config-itop.php | 285 ++++++++++++++++++ .../unattended_install/default-params.xml | 69 +++++ .../unattended_install/unattended_install.php | 188 ++++++++++++ Jenkinsfile | 68 +++++ 10 files changed, 660 insertions(+) create mode 100755 .jenkins/bin/archive/gather_external_files.sh create mode 100755 .jenkins/bin/init/append_files.sh create mode 100755 .jenkins/bin/init/composer_install.sh create mode 100755 .jenkins/bin/init/debug.sh create mode 100755 .jenkins/bin/tests/phpunit.sh create mode 100755 .jenkins/bin/unattended_install/default_env.sh create mode 100644 .jenkins/configuration/default-environment/unattended_install/default-config-itop.php create mode 100644 .jenkins/configuration/default-environment/unattended_install/default-params.xml create mode 100644 .jenkins/configuration/default-environment/unattended_install/unattended_install.php create mode 100644 Jenkinsfile diff --git a/.jenkins/bin/archive/gather_external_files.sh b/.jenkins/bin/archive/gather_external_files.sh new file mode 100755 index 000000000..e69de29bb diff --git a/.jenkins/bin/init/append_files.sh b/.jenkins/bin/init/append_files.sh new file mode 100755 index 000000000..2e383001e --- /dev/null +++ b/.jenkins/bin/init/append_files.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -x + +# create target dirs +mkdir -p var +mkdir -p toolkit + +# cleanup target dirs +rm -rf toolkit/* + +# fill target dirs +curl http://www.combodo.com/documentation/iTopDataModelToolkit-2.3.zip | tar xvz --directory toolkit +cp -r .jenkins/configuration/default-environment/unattended_install/* toolkit diff --git a/.jenkins/bin/init/composer_install.sh b/.jenkins/bin/init/composer_install.sh new file mode 100755 index 000000000..cfea9704f --- /dev/null +++ b/.jenkins/bin/init/composer_install.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -x + +# on the root dir +composer install + + +# under the test dir +cd test +composer install diff --git a/.jenkins/bin/init/debug.sh b/.jenkins/bin/init/debug.sh new file mode 100755 index 000000000..8f9ea404a --- /dev/null +++ b/.jenkins/bin/init/debug.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -x + +whoami +pwd +ls + +echo "$BRANCH_NAME:${BRANCH_NAME}" + +echo "printenv :" +printenv + diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh new file mode 100755 index 000000000..e68f1bd2e --- /dev/null +++ b/.jenkins/bin/tests/phpunit.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -x + + +php test/vendor/bin/phpunit test/ --log-junit var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file diff --git a/.jenkins/bin/unattended_install/default_env.sh b/.jenkins/bin/unattended_install/default_env.sh new file mode 100755 index 000000000..e4a9e8c98 --- /dev/null +++ b/.jenkins/bin/unattended_install/default_env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -x + +cd toolkit +php unattended_install.php default-params.xml \ No newline at end of file diff --git a/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php new file mode 100644 index 000000000..71a82612b --- /dev/null +++ b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php @@ -0,0 +1,285 @@ + 'iTop is temporarily frozen, please wait... (the admin team)', + + // access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3 + // default: 3 + 'access_mode' => 3, + + 'allowed_login_types' => 'form|basic|external', + + // apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active) + // default: true + 'apc_cache.enabled' => true, + + // apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout) + // default: 3600 + 'apc_cache.query_ttl' => 3600, + + // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) + // default: '' + 'app_root_url' => 'http://127.0.0.1/itop/svn/trunk/', + + // buttons_position: Position of the forms buttons: bottom | top | both + // default: 'both' + 'buttons_position' => 'both', + + // cas_include_path: The path where to find the phpCAS library + // default: '/usr/share/php' + 'cas_include_path' => '/usr/share/php', + + // cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout + // default: 600 + 'cron_max_execution_time' => 600, + + // csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable). + // default: 'ISO-8859-1' + 'csv_file_default_charset' => 'ISO-8859-1', + + 'csv_import_charsets' => array ( + ), + + // csv_import_history_display: Display the history tab in the import wizard + // default: false + 'csv_import_history_display' => false, + + // date_and_time_format: Format for date and time display (per language) + // default: array ( + // 'default' => + // array ( + // 'date' => 'Y-m-d', + // 'time' => 'H:i:s', + // 'date_time' => '$date $time', + // ), + // ) + 'date_and_time_format' => array ( + 'default' => + array ( + 'date' => 'Y-m-d', + 'time' => 'H:i:s', + 'date_time' => '$date $time', + ), + 'FR FR' => + array ( + 'date' => 'd/m/Y', + 'time' => 'H:i:s', + 'date_time' => '$date $time', + ), + ), + + 'db_host' => '', + + 'db_name' => 'itop_ci_main', + + 'db_pwd' => 'c8mb0do', + + 'db_subname' => '', + + 'db_user' => 'root', + + // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$ + // default: '$difference$' + 'deadline_format' => '$difference$', + + 'default_language' => 'EN US', + + // disable_attachments_download_legacy_portal: Disable attachments download from legacy portal + // default: true + 'disable_attachments_download_legacy_portal' => true, + + // draft_attachments_lifetime: Lifetime (in seconds) of drafts' attachments and inline images: after this duration, the garbage collector will delete them. + // default: 3600 + 'draft_attachments_lifetime' => 3600, + + // email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode + // default: false + 'email_asynchronous' => false, + + // email_default_sender_address: Default address provided in the email from header field. + // default: '' + 'email_default_sender_address' => '', + + // email_default_sender_label: Default label provided in the email from header field. + // default: '' + 'email_default_sender_label' => '', + + // email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocole) + // default: 'PHPMail' + 'email_transport' => 'SMTP', + + // email_transport_smtp.host: host name or IP address (optional) + // default: 'localhost' + 'email_transport_smtp.host' => 'smtp.combodo.com', + + // email_transport_smtp.password: Authentication password (optional) + // default: '' + 'email_transport_smtp.password' => '++combodo++', + + // email_transport_smtp.port: port number (optional) + // default: 25 + 'email_transport_smtp.port' => 25, + + // email_transport_smtp.username: Authentication user (optional) + // default: '' + 'email_transport_smtp.username' => 'test2@combodo.com', + + // email_validation_pattern: Regular expression to validate/detect the format of an eMail address + // default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}' + 'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}', + + 'encryption_key' => '@iT0pEncr1pti0n!', + + 'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']', + + 'fast_reload_interval' => '60', + + // graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle + // default: '/usr/bin/dot' + 'graphviz_path' => '/usr/bin/dot', + + // inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width. + // default: '250' + 'inline_image_max_display_width' => 250, + + // inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database. + // default: '1600' + 'inline_image_max_storage_width' => 1600, + + // link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value) + // default: '\'' + 'link_set_attribute_qualifier' => '\'', + + // link_set_attribute_separator: Link set from string: attribute separator + // default: ';' + 'link_set_attribute_separator' => ';', + + // link_set_item_separator: Link set from string: line separator + // default: '|' + 'link_set_item_separator' => '|', + + // link_set_value_separator: Link set from string: value separator (between the attcode and the value itself + // default: ':' + 'link_set_value_separator' => ':', + + 'log_global' => true, + + 'log_issue' => true, + + 'log_notification' => true, + + 'log_web_service' => true, + + // max_combo_length: The maximum number of elements in a drop-down list. If more then an autocomplete will be used + // default: 50 + 'max_combo_length' => 50, + + 'max_display_limit' => '15', + + // max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit. + // default: 100 + 'max_linkset_output' => 100, + + 'min_display_limit' => '10', + + // online_help: Hyperlink to the online-help web page + // default: 'http://www.combodo.com/itop-help' + 'online_help' => 'http://www.combodo.com/itop-help', + + // php_path: Path to the php executable in CLI mode + // default: 'php' + 'php_path' => 'php', + + // portal_tickets: CSV list of classes supported in the portal + // default: 'UserRequest' + 'portal_tickets' => 'UserRequest', + + 'query_cache_enabled' => true, + + // search_manual_submit: Force manual submit of search requests (class => true) + // default: false + 'search_manual_submit' => array ( + 'Person' => true, + ), + + 'secure_connection_required' => false, + + // session_name: The name of the cookie used to store the PHP session id + // default: 'iTop' + 'session_name' => 'iTop', + + // shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu + // default: 'UI:Menu:Modify,UI:Menu:New' + 'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New', + + // source_dir: Source directory for the datamodel files. (which gets compiled to env-production). + // default: '' + 'source_dir' => 'datamodels/2.x/', + + 'standard_reload_interval' => '300', + + // synchro_trace: Synchronization details: none, display, save (includes 'display') + // default: 'none' + 'synchro_trace' => 'none', + + // timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitely configured in PHP + // default: 'Europe/Paris' + 'timezone' => 'Europe/Paris', + + // tracking_level_linked_set_default: Default tracking level if not explicitely set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936) + // default: 1 + 'tracking_level_linked_set_default' => 0, + + // url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes) + // default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?' + 'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?', +); + +/** + * + * Modules specific settings + * + */ +$MyModuleSettings = array( + 'itop-attachments' => array ( + 'allowed_classes' => array ( + 0 => 'Ticket', + ), + 'position' => 'relations', + 'preview_max_width' => 290, + ), + 'itop-backup' => array ( + 'mysql_bindir' => '', + 'week_days' => 'monday, tuesday, wednesday, thursday, friday', + 'time' => '23:30', + 'retention_count' => 5, + 'enabled' => true, + 'debug' => false, + ), + 'molkobain-console-tooltips' => array ( + 'decoration_class' => 'fas fa-question', + 'enabled' => true, + ), +); + +/** + * + * Data model modules to be loaded. Names are specified as relative paths + * + */ +$MyModules = array( + 'addons' => array ( + 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', + ), +); +?> \ No newline at end of file diff --git a/.jenkins/configuration/default-environment/unattended_install/default-params.xml b/.jenkins/configuration/default-environment/unattended_install/default-params.xml new file mode 100644 index 000000000..fc188ba02 --- /dev/null +++ b/.jenkins/configuration/default-environment/unattended_install/default-params.xml @@ -0,0 +1,69 @@ + + + upgrade + + + + datamodels/2.x/ + 2.5.0 + /var/lib/jenkins/workspace/iTop-CI/unattended_install/default-config-itop.php + extensions + production + + + + root + c8mb0do + itop_ci + + + + + http://127.0.0.1/itop/svn/trunk/ + /usr/bin/dot + + admin + admin + EN US + + EN US + + authent-external + authent-local + itop-backup + itop-config + itop-profiles-itil + itop-sla-computation + itop-tickets + itop-welcome-itil + itop-config-mgmt + itop-attachments + itop-datacenter-mgmt + itop-endusers-devices + itop-storage-mgmt + itop-virtualization-mgmt + itop-bridge-virtualization-storage + itop-service-mgmt + itop-request-mgmt + itop-portal + itop-portal-base + itop-change-mgmt + + + itop-config-mgmt-core + itop-config-mgmt-datacenter + itop-config-mgmt-end-user + itop-config-mgmt-storage + itop-config-mgmt-virtualization + itop-service-mgmt-enterprise + itop-ticket-mgmt-simple-ticket + itop-ticket-mgmt-simple-ticket-enhanced-portal + itop-change-mgmt-simple + + 1 + + + 1 + + + \ No newline at end of file diff --git a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php new file mode 100644 index 000000000..6022ff9f2 --- /dev/null +++ b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php @@ -0,0 +1,188 @@ +Get('mode'); + +if ($sMode == 'install') +{ + echo "Installation mode detected.\n"; + $bClean = utils::ReadParam('clean', false, true /* CLI allowed */); + if ($bClean) + { + echo "Cleanup mode detected.\n"; + $sTargetEnvironment = $oParams->Get('target_env', ''); + if ($sTargetEnvironment == '') + { + $sTargetEnvironment = 'production'; + } + $sTargetDir = APPROOT.'env-'.$sTargetEnvironment; + + // Configuration file + $sConfigFile = APPCONF.$sTargetEnvironment.'/'.ITOP_CONFIG_FILE; + if (file_exists($sConfigFile)) + { + echo "Trying to delete the configuration file: '$sConfigFile'.\n"; + @chmod($sConfigFile, 0770); // RWX for owner and group, nothing for others + unlink($sConfigFile); + } + else + { + echo "No config file to delete ($sConfigFile does not exist).\n"; + } + + // env-xxx directory + if (file_exists($sTargetDir)) + { + if (is_dir($sTargetDir)) + { + echo "Emptying the target directory '$sTargetDir'.\n"; + SetupUtils::tidydir($sTargetDir); + } + else + { + die("ERROR the target dir '$sTargetDir' exists, but is NOT a directory !!!\nExiting.\n"); + } + } + else + { + echo "No target directory to delete ($sTargetDir does not exist).\n"; + } + + // Database + $aDBSettings = $oParams->Get('database', array()); + $sDBServer = $aDBSettings['server']; + $sDBUser = $aDBSettings['user']; + $sDBPwd = $aDBSettings['pwd']; + $sDBName = $aDBSettings['name']; + $sDBPrefix = $aDBSettings['prefix']; + + if ($sDBPrefix != '') + { + die("Cleanup not implemented for a partial database (prefix= '$sDBPrefix')\nExiting."); + } + + $oMysqli = new mysqli($sDBServer, $sDBUser, $sDBPwd); + if ($oMysqli->connect_errno) + { + die("Cannot connect to the MySQL server (".$mysqli->connect_errno . ") ".$mysqli->connect_error."\nExiting"); + } + else + { + if ($oMysqli->select_db($sDBName)) + { + echo "Deleting database '$sDBName'\n"; + $oMysqli->query("DROP DATABASE `$sDBName`"); + } + else + { + echo "The database '$sDBName' does not seem to exist. Nothing to cleanup.\n"; + } + } + } +} + +$bHasErrors = false; +$aChecks = SetupUtils::CheckBackupPrerequisites(APPROOT.'data'); // mmm should be the backup destination dir + +$aSelectedModules = $oParams->Get('selected_modules'); +$sSourceDir = $oParams->Get('source_dir', 'datamodels/latest'); +$sExtensionDir = $oParams->Get('extensions_dir', 'extensions'); +$aChecks = array_merge($aChecks, SetupUtils::CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules)); + + +foreach($aChecks as $oCheckResult) +{ + switch($oCheckResult->iSeverity) + { + case CheckResult::ERROR: + $bHasErrors = true; + $sHeader = "Error"; + break; + + case CheckResult::WARNING: + $sHeader = "Warning"; + break; + + case CheckResult::INFO: + default: + $sHeader = "Info"; + break; + } + echo $sHeader.": ".$oCheckResult->sLabel; + if (strlen($oCheckResult->sDescription)) + { + echo ' - '.$oCheckResult->sDescription; + } + echo "\n"; +} + +if ($bHasErrors) +{ + echo "Encountered stopper issues. Aborting...\n"; + die; +} + +$bFoundIssues = false; + +$bInstall = utils::ReadParam('install', true, true /* CLI allowed */); +if ($bInstall) +{ + echo "Starting the unattended installation...\n"; + $oWizard = new ApplicationInstaller($oParams); + $bRes = $oWizard->ExecuteAllSteps(); + if (!$bRes) + { + echo "\nencountered installation issues!"; + $bFoundIssues = true; + } +} +else +{ + echo "No installation requested.\n"; +} +if (!$bFoundIssues && $bCheckConsistency) +{ + echo "Checking data model consistency.\n"; + ob_start(); + $sCheckRes = ''; + try + { + MetaModel::CheckDefinitions(false); + $sCheckRes = ob_get_clean(); + } + catch(Exception $e) + { + $sCheckRes = ob_get_clean()."\nException: ".$e->getMessage(); + } + if (strlen($sCheckRes) > 0) + { + echo $sCheckRes; + echo "\nfound consistency issues!"; + $bFoundIssues = true; + } +} + +if (!$bFoundIssues) +{ + // last line: used to check the install + // the only way to track issues in case of Fatal error or even parsing error! + echo "\ninstalled!"; + exit; +} diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..b034ee0eb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,68 @@ +pipeline { + agent any + stages { + + } + stage('init') { + parallel { + stage('debug') { + steps { + sh './.jenkins/bin/init/debug.sh' + } + } + stage('append files to project') { + steps { + sh './.jenkins/bin/init/append_files.sh' + } + } + stage('composer install') { + steps { + sh './.jenkins/bin/init/composer_install.sh' + } + } + } + } + + stage('unattended_install') { + parallel { + stage('debug') { + steps { + sh './.jenkins/bin/unattended_install/default_env.sh' + } + } + } + } + + stage('test') { + parallel { + stage('phpunit') { + steps { + sh './.jenkins/bin/tests/phpunit.sh' + } + } + } + } + + stage('archive phpunit result') { + parallel { + stage('archive phpunit result') { + steps { + junit 'var/test/phpunit-log.junit.xml' + } + } + } + + stage('notify') { + steps { + slackSend(color: '#00FF00', message: "Build finished (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") + } + } + + } + environment { + DEBUG_UNIT_TEST = '0' + } + options { + timeout(time: 20, unit: 'MINUTES') + } +} \ No newline at end of file From bef4ac83a4038b8a289cfba4d90b0232f6da2a03 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Tue, 4 Sep 2018 17:58:20 +0200 Subject: [PATCH 02/10] [WIP] jenkinsfile integration --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b034ee0eb..f53cacbe6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,6 @@ pipeline { agent any stages { - } stage('init') { parallel { stage('debug') { @@ -48,16 +47,16 @@ pipeline { stage('archive phpunit result') { steps { junit 'var/test/phpunit-log.junit.xml' + } } } } - stage('notify') { steps { slackSend(color: '#00FF00', message: "Build finished (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") } } - + } environment { DEBUG_UNIT_TEST = '0' From 7955dd86f408cf73cd3919013d032c2282f1c1b3 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Tue, 4 Sep 2018 18:00:34 +0200 Subject: [PATCH 03/10] [WIP] jenkinsfile integration --- .../unattended_install/unattended_install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php index 6022ff9f2..f95cac89e 100644 --- a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php +++ b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php @@ -1,5 +1,5 @@ Date: Tue, 4 Sep 2018 18:02:12 +0200 Subject: [PATCH 04/10] [WIP] jenkinsfile integration --- .../unattended_install/unattended_install.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php index f95cac89e..7f67bee85 100644 --- a/.jenkins/configuration/default-environment/unattended_install/unattended_install.php +++ b/.jenkins/configuration/default-environment/unattended_install/unattended_install.php @@ -1,5 +1,7 @@ Date: Tue, 4 Sep 2018 18:03:56 +0200 Subject: [PATCH 05/10] [WIP] jenkinsfile integration --- .jenkins/bin/tests/phpunit.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh index e68f1bd2e..d22439ffc 100755 --- a/.jenkins/bin/tests/phpunit.sh +++ b/.jenkins/bin/tests/phpunit.sh @@ -2,5 +2,6 @@ set -x +cd test -php test/vendor/bin/phpunit test/ --log-junit var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file +php vendor/bin/phpunit --log-junit var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file From 47c7a3c5e3e275a29137ef81111ff602e7e4c220 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Tue, 4 Sep 2018 18:05:19 +0200 Subject: [PATCH 06/10] [WIP] jenkinsfile integration --- .jenkins/bin/tests/phpunit.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh index d22439ffc..ea06fcdbb 100755 --- a/.jenkins/bin/tests/phpunit.sh +++ b/.jenkins/bin/tests/phpunit.sh @@ -4,4 +4,7 @@ set -x cd test + +export DEBUG_UNIT_TEST="0" + php vendor/bin/phpunit --log-junit var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file From 5dc39fe0686a1761501c318e6d25e99e13845372 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Tue, 4 Sep 2018 18:10:39 +0200 Subject: [PATCH 07/10] [WIP] jenkinsfile integration --- Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f53cacbe6..7a9b883a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,6 +58,17 @@ pipeline { } } + + post { +// always { +// +// } + failure { + junit 'var/test/phpunit-log.junit.xml' + slackSend(color: '#00FF00', message: "Ho no! Build failed! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") + } + } + environment { DEBUG_UNIT_TEST = '0' } From 148309245b7e2b0831f0678eeebb6eeee20cdc03 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Wed, 5 Sep 2018 08:00:07 +0200 Subject: [PATCH 08/10] [WIP] jenkinsfile integration --- .jenkins/bin/tests/phpunit.sh | 2 +- Jenkinsfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh index ea06fcdbb..4371d9e43 100755 --- a/.jenkins/bin/tests/phpunit.sh +++ b/.jenkins/bin/tests/phpunit.sh @@ -7,4 +7,4 @@ cd test export DEBUG_UNIT_TEST="0" -php vendor/bin/phpunit --log-junit var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file +php vendor/bin/phpunit --log-junit ../var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 7a9b883a5..5b3485025 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,7 @@ pipeline { stage('unattended_install') { parallel { - stage('debug') { + stage('unattended_install default env') { steps { sh './.jenkins/bin/unattended_install/default_env.sh' } From e473c46dc3a341d7035c3e85be09ce7d3de2ac80 Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Wed, 5 Sep 2018 08:08:19 +0200 Subject: [PATCH 09/10] [WIP] jenkinsfile integration --- Jenkinsfile | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5b3485025..2f49a0667 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,30 +42,14 @@ pipeline { } } - stage('archive phpunit result') { - parallel { - stage('archive phpunit result') { - steps { - junit 'var/test/phpunit-log.junit.xml' - } - } - } - } - stage('notify') { - steps { - slackSend(color: '#00FF00', message: "Build finished (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") - } - } - } post { -// always { -// -// } - failure { + always { junit 'var/test/phpunit-log.junit.xml' - slackSend(color: '#00FF00', message: "Ho no! Build failed! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") + } + failure { + slackSend(channel: "#jenkins-itop", color: '#FF0000', message: "Ho no! Build failed! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") } } From 79157c465af1e12aba1e1d926b0c0b865859a78c Mon Sep 17 00:00:00 2001 From: bruno DA SILVA Date: Fri, 7 Sep 2018 14:52:22 +0200 Subject: [PATCH 10/10] [WIP] jenkinsfile integration --- .jenkins/bin/tests/phpunit.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.jenkins/bin/tests/phpunit.sh b/.jenkins/bin/tests/phpunit.sh index 4371d9e43..3c327f6c9 100755 --- a/.jenkins/bin/tests/phpunit.sh +++ b/.jenkins/bin/tests/phpunit.sh @@ -1,10 +1,8 @@ #!/usr/bin/env bash - set -x cd test - export DEBUG_UNIT_TEST="0" php vendor/bin/phpunit --log-junit ../var/test/phpunit-log.junit.xml --teamcity \ No newline at end of file