In order to pass variables between the "before_script" and "script" parts of the same job you have to include the variables within the "variables" keyword section and not just simply have a line in the script section such as "VARIABLE_A='value'".
".gitlab-ci.yml" file allows you to define project-CI-wide variables, available for all the jobs without the need of inheritance those via "extends" keyword.