Tag Archives: ci

[Solved] Angular&CI/CD:Error: initial exceeded maximum budget

During CI/CD process of angular project, the following errors occur:

Warning: initial exceeded maximum budget. Budget 2.00 MB was not met by 3.01 MB with a total of 5.01 MB.
Error: initial exceeded maximum budget. Budget 5.00 MB was not met by 6.83 kB with a total of 5.01 MB.

The packed file is too large for the specified file size

Solution: modify the angular in the project JSON configuration file (memory parameters)

 "budgets": [{
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "6mb"
                },
              ]

I originally set the maximum error to 5MB, but now I can set it to 6MB. The specific problem depends on the situation

How to Solve Brew install golangci-lint Error

Brew install golangci lint reports an error

Installation command:

brew install golangci-lint

report errors:

Error: No such file or directory @ rb_sysopen - /Users/...-go-1.16.6.big_sur.bottle.tar.gz

reason:

Go version problem

go 1.16.5 is already installed but outdated

Solution:

install go first and then golangci lint

brew install go
brew install golangci-lint

PHP CI (CodeIgniter) log level setting

1, Ci error level setting is generally in index. PHP, you can set the ENVIRONMENT. Generally speaking, development mode is selected when developing, and production mode is selected after the official release. The code is as follows:

/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 *
 * You can load different configurations depending on your
 * current environment. Setting the environment also influences
 * things like logging and error reporting.
 *
 * This can be set to anything, but default usage is:
 *
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 *
 */
	define('ENVIRONMENT', 'development');
/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */

if (defined('ENVIRONMENT'))
{
	switch (ENVIRONMENT)
	{
		case 'development':
			error_reporting(E_ALL);
		break;
	
		case 'testing':
		case 'production':
			error_reporting(0);
		break;

		default:
			exit('The application environment is not set correctly.');
	}
}

2, CI error log by default in the application/logs/log – [time]. PHP, log level, path, time format, etc., in the application/config/config. The PHP file Settings, the code is as follows:

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|	0 = Disables logging, Error logging TURNED OFF
|	1 = Error Messages (including PHP errors)
|	2 = Debug Messages
|	3 = Informational Messages
|	4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';

/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';

3, in their own code to log, you can call the global function log_message(‘ level ‘,’ message ‘), the level of parameters is (debug Debug, error error, information info), the content can be defined by themselves.

log_message('error', 'error message.');
log_message('debug', 'debug message.'); 
log_message('info', 'info message.');