title: How do we use the 'variables' keyword in gitlab-ci.yml?
body: <p>I am trying to make use of the <code>variables:</code> keyword documented in the Gitlab CI Documentation here:</p>
  
  <p><strong>FROM: <a href="https://docs.gitlab.com/ce/ci/yaml/README.html" rel="noreferrer">https://docs.gitlab.com/ce/ci/yaml/README.html</a></strong></p>
  
  <blockquote>
    <p>variables</p>
    
    <p>This feature requires gitlab-runner with version equal or greater than
    0.5.0.</p>
    
    <p>GitLab CI allows you to add to .gitlab-ci.yml variables that are set
    in build environment. The variables are stored in repository and are
    meant to store non-sensitive project configuration, ie. RAILS_ENV or
    DATABASE_URL.</p>
  
  <pre><code>variables:   
    DATABASE_URL: "postgres://postgres@postgres/my_database"
  </code></pre>
    
    <p>These variables can be later used in all executed commands and
    scripts.</p>
    
    <p>The YAML-defined variables are also set to all created service
    containers, thus allowing to fine tune them.</p>
  </blockquote>
  
  <p>When I attempt to use it, my builds do not run any stages and are marked successful anyway, a good sign of bad YAML. I pasted my gitlab-ci.yml contents into the LINT tool in the settings area and the output error is:</p>
  
  <blockquote>
    <p><strong>Status</strong>: syntax is incorrect</p>
    
    <p><strong>Error</strong>: variables job: unknown parameter PACKAGE_NAME</p>
  </blockquote>
  
  <p>I'm using my YAML syntax the same as the docs, however it will not work. I'm unable to find any open bugs related to this. Below are my current versions and a sanitized version of my gitlab-ci.yml.</p>
  
  <p><strong>Gitlab Version</strong>:  7.13.2 Omnibus</p>
  
  <p><strong>Gitlab Runner Version</strong>: 0.5.2</p>
  
  <p><strong>gitlab-ci.yml (Sanitized)</strong></p>
  
  <pre><code>types:
    - test
    - build
  
  variables:
    PACKAGE_NAME: "awesome-django-app"
    PACKAGE_SUMMARY: "Awesome webapp backend."
    MAJOR_RELEASE: "1"
    MINOR_RELEASE: "0"
    PATCH_LEVEL: "0dev"
    DEV_DB_URL: "db"
    DEV_SERVER: "pydev.example.com"
    PROD_SERVER: "pyprod.example.com"
    TEST_SERVER: "pytest.example.com"
  
  envtest:
    type: test
    script:
    - ". ./testbuild.sh"
    tags:
    - python2.7
    - postgres
    - linux
    except:
    - tags
  
  buildrpm:
    type: build
    script:
    - mkdir -p ~/rpmbuild/SOURCES
    - mkdir -p ~/rpmbuild/SPECS
    - mkdir -p ~/tarbuild/$PACKAGE_NAME-$MAJOR_RELEASE.$MINOR_RELEASE.$PATCH_LEVEL
    - cp $PACKAGE_NAME.spec ~/rpmbuild/SPECS/.
    - cp -r * ~/tarbuild/$PACKAGE_NAME-$MAJOR_RELEASE.$MINOR_RELEASE.$PATCH_LEVEL/.
    - cd ~/tarbuild
    - tar -zcf ~/rpmbuild/SOURCES/$PACKAGE_NAME-$MAJOR_RELEASE.$MINOR_RELEASE.$PATCH_LEVEL.tar.gz *
    - cd ~
    - rm -Rf ~/tarbuild
    - rpmlint -i ~/rpmbuild/SPECS/$PACKAGE_NAME.spec
    - echo $CI_BUILD_ID
    - 'rpmbuild -ba ~/rpmbuild/SPECS/$PACKAGE_NAME.spec \
                      --define="_build_number $CI_BUILD_ID" \
                      --define="_python_version_min 2.7" \
                      --define="_version $MAJOR_RELEASE.$MINOR_RELEASE.$PATCH_LEVEL" \
                      --define="_package_name $PACKAGE_NAME" \
                      --define="_summary $SUMMARY"'
    - scp rpmbuild/RPMS/noarch/$PACKAGE_NAME-$MAJOR_RELEASE.$MINOR_RELEASE.$PATCH_LEVEL-$CI_BUILD_ID.noarch.rpm $DEV_SERVER:~/.
    tags:
    - python2.7
    - postgres
    - linux
    - rpm
    except:
    - tags
  </code></pre>
  
  <p><strong>Question:</strong> </p>
  
  <p>How do I use this value properly?</p>
  
  <p><strong>Additional Info:</strong></p>
  
  <p>Removing this section from the YAML file causes everything to work so the rest of the file is in working order. (Of course undefined variables lead to script errors...)</p>
  
  <p>Even just reducing the variables for testing down to just PACKAGE_NAME causes the same break.</p>