Simple GitLab pipeline with variables

Variables are a type of environment variable. You can use them to:

Variables can be local and global as shown in this .gitlab-ci.yml:
stages:
    - build
    - test

variables:
    BUILD_FILE_NAME: laptop.txt

build laptop:
    image: alpine
    stage: build
    variables:
        START_MSG: "Building a laptop"
    script:
        - echo $START_MSG
        - mkdir build
        - echo "Mainboard" >> build/$BUILD_FILE_NAME
        - cat build/$BUILD_FILE_NAME
        - echo "Keyboard" >> build/$BUILD_FILE_NAME
    artifacts:
        paths:
            - build

test laptop:
    image: alpine
    stage: test
    script:
        - test -f build/$BUILD_FILE_NAME
        - grep "Mainboard" build/$BUILD_FILE_NAME
        - grep "Keyboard" build/$BUILD_FILE_NAME