Getting password authentication failure for postgres user when running the script on gitlab pipeline

Description:

While running the script on gitlab, at the time of query execution, getting Password authentication failed even if i pass correct password and username.

<<< FAILURE!
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: FATAL: password authentication failed for user “user”
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user “user”

Note: Same script is running fine in local execution with same credentials.