'Jenkins environmental variables on config yaml file

we have jenkins file with below Env variable. When we are trying to integration the docker compose and the config yaml file is not getting the value of the jenkins env variable instead its taking the variable name. Can some one help here what we are doing wrong

jenkins file:

        stage('Run tests') {
                steps {
                    withEnv([
                        "PASSWORD=${env.TEST_DB_CREDS_PSW}",
                        "USER=${env.TEST_DB_CREDS_USR}",
                    ]){
                    sh '''#!/bin/bash

                    {
                        cd atests 

                        docker-compose down
                        kill $$

Config.yaml:

dbconfig:

    dbuser: ${USER}
    dbpass: ${PASSWORD}
    dbname: 
    dbdrivername: 
    tablename: 

Can't begin Tx with ocd store: ERROR 1045 (28000): Access denied for user '${USER}'@'ip' (using password: YES)"}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source