stages:
  - First
  - Second

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
  - workdir/

First:
  stage: First
  image:
    name: alpine
    entrypoint: ["/bin/sh", "-c"]
  script:
  - mkdir -p workdir
  - echo "asdf" > workdir/app.txt


Second:
  stage: Second
  image: alpine
  script:
  - cat workdir/app.txt

# First:
#   stage: First
#   cache:
#     key: ${CI_COMMIT_REF_SLUG}
#     paths:
#       - workdir/
#     policy: push
#   image:
#     name: alpine
#     entrypoint: ["/bin/sh", "-c"]
#   script:
#     - mkdir -p workdir
#     - echo "asdf" > workdir/app.txt

# Second:
#   stage: Second
#   cache:
#     key: ${CI_COMMIT_REF_SLUG}
#     paths:
#       - workdir/
#     policy: pull
#   image: alpine
#   script:
#     - cat workdir/app.txt

# cache: &global_cache
#   key: ${CI_COMMIT_REF_SLUG}
#   paths:
#     - workdir/
#   policy: push

# First:
#   stage: First
#   cache:
#     <<: *global_cache
#     policy: push
#   image:
#     name: alpine
#     entrypoint: ["/bin/sh", "-c"]
#   script:
#     - mkdir -p workdir
#     - echo "asdf" > workdir/app.txt

# Second:
#   stage: Second
#   cache:
#     <<: *global_cache
#     policy: pull
#   image: alpine
#   script:
#     - cat workdir/app.txt